Changeset 6910 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/Manager
- Timestamp:
- 10/12/11 15:48:53 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/Manager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/Manager/ConfigManager.cs
r6897 r6910 46 46 private Slave slave; 47 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 UpdateSlaveInfo();55 }56 57 private void UpdateSlaveInfo() {58 55 cpuCounter = new PerformanceCounter(); 59 56 cpuCounter.CategoryName = "Processor"; 60 57 cpuCounter.CounterName = "% Processor Time"; 61 58 cpuCounter.InstanceName = "_Total"; 59 memCounter = new PerformanceCounter("Memory", "Available Bytes", true); 62 60 63 61 Asleep = false; … … 70 68 slave.OperatingSystem = Environment.OSVersion.VersionString; 71 69 slave.CpuSpeed = GetCpuSpeed(); 72 slave.FreeMemory = GetFreeMemory(); 73 slave.HbInterval = (int)Settings.Default.HeartbeatInterval.TotalSeconds; 70 71 UpdateSlaveInfo(); 72 } 73 74 private void UpdateSlaveInfo() { 75 if (slave != null) { 76 slave.FreeMemory = GetFreeMemory(); 77 slave.HbInterval = (int)Settings.Default.HeartbeatInterval.TotalSeconds; 78 } 74 79 } 75 80 … … 240 245 /// returns free memory of machine in MB 241 246 /// </summary> 242 public staticint GetFreeMemory() {247 public int GetFreeMemory() { 243 248 int mb = 0; 244 249 245 250 try { 246 PerformanceCounter counter = new PerformanceCounter("Memory", "Available Bytes", true); 247 mb = (int)(counter.NextValue() / 1024 / 1024); 251 mb = (int)(memCounter.NextValue() / 1024 / 1024); 248 252 } 249 253 catch { } … … 252 256 253 257 public float GetCpuUtilization() { 254 return cpuCounter.NextValue(); 258 float cpuVal = 0.0F; 259 260 try { 261 return cpuCounter.NextValue(); 262 } 263 catch { } 264 return cpuVal; 255 265 } 256 266 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/Manager/HeartbeatManager.cs
r6893 r6910 97 97 SlaveId = info.Id, 98 98 FreeCores = info.Cores.HasValue ? info.Cores.Value - SlaveStatusInfo.UsedCores : 0, 99 FreeMemory = ConfigManager. GetFreeMemory(),99 FreeMemory = ConfigManager.Instance.GetFreeMemory(), 100 100 CpuUtilization = ConfigManager.Instance.GetCpuUtilization(), 101 101 JobProgress = ConfigManager.Instance.GetExecutionTimeOfAllJobs(),
Note: See TracChangeset
for help on using the changeset viewer.