Skip to content
Snippets Groups Projects
Commit bbdb7730 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Remove unused method GetCpuUsage.

Refers to #36
parent 2ce97b73
No related branches found
No related tags found
No related merge requests found
......@@ -32,29 +32,6 @@ namespace ATxCommon
return -1;
}
/// <summary>
/// Get the CPU usage in percent over all cores.
/// </summary>
/// <returns>CPU usage in percent or -1 if an error occured.</returns>
public static int GetCpuUsage() {
// TODO: fix bug #36
try {
var searcher = new ManagementObjectSearcher("select * from Win32_PerfFormattedData_PerfOS_Processor");
foreach (var mo in searcher.Get()) {
var obj = (ManagementObject)mo;
var usage = obj["PercentProcessorTime"];
var name = obj["Name"];
if (name.ToString().Equals("_Total"))
return Convert.ToInt32(usage);
}
}
catch (Exception ex) {
Log.Warn("Error in GetCpuUsage: {0}", ex.Message);
}
return -1;
}
/// <summary>
/// Get the free space of a drive in bytes.
/// </summary>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment