- Timestamp:
- 06/27/13 15:25:42 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.Slave/3.3/Manager/ConfigManager.cs
r9373 r9661 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Diagnostics; 24 25 using System.Linq; 25 26 using System.Management; … … 44 45 private TaskManager jobManager; 45 46 private Slave slave; 46 //private PerformanceCounter cpuCounter;47 //private PerformanceCounter memCounter;47 private PerformanceCounter cpuCounter; 48 private PerformanceCounter memCounter; 48 49 49 50 /// <summary> … … 52 53 public ConfigManager(TaskManager jobManager) { 53 54 this.jobManager = jobManager; 54 /*cpuCounter = new PerformanceCounter();55 cpuCounter = new PerformanceCounter(); 55 56 cpuCounter.CategoryName = "Processor"; 56 57 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); 59 60 60 61 Asleep = false; … … 255 256 /// </summary> 256 257 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 } 265 264 } 266 265 267 266 public float GetCpuUtilization() { 268 float cpuVal = 0.0F; 269 /*try { 267 try { 270 268 return cpuCounter.NextValue(); 271 269 } 272 catch { } */ 273 return cpuVal; 270 catch { 271 return 0.0f; 272 } 274 273 } 275 274 }
Note: See TracChangeset
for help on using the changeset viewer.