Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/27/13 15:25:42 (11 years ago)
Author:
pfleck
Message:

#2063:
Updated wrong endpoint address.
Re-enabled performance counters for slaves.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.Slave/3.3/Manager/ConfigManager.cs

    r9373 r9661  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Diagnostics;
    2425using System.Linq;
    2526using System.Management;
     
    4445    private TaskManager jobManager;
    4546    private Slave slave;
    46     //private PerformanceCounter cpuCounter;
    47     //private PerformanceCounter memCounter;
     47    private PerformanceCounter cpuCounter;
     48    private PerformanceCounter memCounter;
    4849
    4950    /// <summary>
     
    5253    public ConfigManager(TaskManager jobManager) {
    5354      this.jobManager = jobManager;
    54       /*cpuCounter = new PerformanceCounter();
     55      cpuCounter = new PerformanceCounter();
    5556      cpuCounter.CategoryName = "Processor";
    5657      cpuCounter.CounterName = "% Processor Time";
    57       cpuCounter.InstanceName = "_Total";*/
    58       //memCounter = new PerformanceCounter("Memory", "Available Bytes", true);
     58      cpuCounter.InstanceName = "_Total";
     59      memCounter = new PerformanceCounter("Memory", "Available Bytes", true);
    5960
    6061      Asleep = false;
     
    255256    /// </summary>   
    256257    public int GetFreeMemory() {
    257       int mb = 0;
    258 
    259       try {
    260         //mb = (int)(memCounter.NextValue() / 1024 / 1024);
    261         mb = 1024;
    262       }
    263       catch { }
    264       return mb;
     258      try {
     259        return (int)(memCounter.NextValue() / 1024 / 1024);
     260      }
     261      catch {
     262        return 0;
     263      }
    265264    }
    266265
    267266    public float GetCpuUtilization() {
    268       float cpuVal = 0.0F;
    269       /*try {
     267      try {
    270268        return cpuCounter.NextValue();
    271269      }
    272       catch { }    */
    273       return cpuVal;
     270      catch {
     271        return 0.0f;
     272      }
    274273    }
    275274  }
Note: See TracChangeset for help on using the changeset viewer.