[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linrad] Re: Resources
What we are looking for, I'm afraid, is a way to get at the desired
information from "plain old C". No C#, no .Net, no Registry, just a
plain vanilla system call. As far as I can tell, one does not exist in
Windows.
-- Joe, K1JT
Bill Tracey wrote:
Take a look @:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/perfmon/base/performance_data_collection.asp
This is for native code - you can either go thru the (older) registry
interface, or the newer Pdh interface
For C#/.net stuff this little snip (borrowed from the PowerSDR source
code) will do the job:
private static PerformanceCounter cpu_usage;
public static float CpuUsage
{
get
{
if (cpu_usage == null)
{
cpu_usage = new PerformanceCounter(
"Processor", "%
Processor Time", "_Total", true);
}
return cpu_usage.NextValue();
}
}
PerformanceCounter is the package System.Diagnostics
Cheers,
Bill (kd5tfd)
At 05:58 PM 8/25/2005, Joe Taylor wrote:
Stan --
I believe the question Leif was asking -- and which I would like to
have an answer for, as well -- is how a running program can
interrogate the Windows system to find out what fraction of the
system's time is being spent in its "idle loop." The difference
between this fraction and 1.0 is the "CPU utilization".
-- Joe, K1JT
#############################################################
This message is sent to you because you are subscribed to
the mailing list <linrad@xxxxxxxxxxxxxxxxxxxxx>.
To unsubscribe, E-mail to: <linrad-off@xxxxxxxxxxxxxxxxxxxxx>
To switch to the DIGEST mode, E-mail to <linrad-digest@xxxxxxxxxxxxxxxxxxxxx>
To switch to the INDEX mode, E-mail to <linrad-index@xxxxxxxxxxxxxxxxxxxxx>
Send administrative queries to <linrad-request@xxxxxxxxxxxxxxxxxxxxx>
LINRADDARNIL