Open GoogleCodeExporter opened 9 years ago
I agree here. I would really like to see a easier way to interface with the
Business layer.
Original comment by ZeroAvia...@gmail.com
on 25 Jun 2012 at 7:02
Well, if you're trying to find a specific device/sensor, below is a method that
would get the average CPU clock speed from all cores:
//CPU Hardware Index
int CPU_HW_IDX = 0;
//Computer object
Computer cp = new Computer();
//Finds the Hardware index of the Processor
//This can be a method or can be put in your loading sequence
//For this example, we'll be using a method
private void Get_CPU_HW_IDX()
{
for (int i = 0; i < cp.Hardware.Count(); i++)
{
if (cp.Hardware[i].HardwareType.ToString() == "")
{
CPU_HW_IDX = i;
}
}
}
//Gets Average CPU Clock speed
private double Get_CPUCLKSPD()
{
int CoreCount = 0;
int CoreClockSum = 0;
for (int i = 0; i < cp.Hardware[CPU_HW_IDX].Sensors.Count(); i++)
{
if (cp.Hardware[CPU_HW_IDX].Sensors[i].SensorType.ToString() == "Clock" &&
cp.Hardware[CPU_HW_IDX].Sensors[i].Name != "Bus Speed")
{
CoreCount++;
CoreClockSum = Convert.ToInt32(CoreClockSum + (int)cp.Hardware[CPU_HW_IDX].Sensors[i].Value);
}
}
return ((double)CoreClockSum / (double)CoreCount) / 1000; //Returns value in GHz
}
A "GetHardware" function could be made from this. Hope this helps.
Original comment by ztom...@gmail.com
on 3 Oct 2012 at 10:36
Original issue reported on code.google.com by
CJ.FixTh...@gmail.com
on 19 Apr 2012 at 5:15