mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
Fixed ExGetCurrentProcessorUsage (thanks to Mike)
svn path=/trunk/; revision=11295
This commit is contained in:
parent
597aeb8577
commit
10d4df0a8b
1 changed files with 7 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: sysinfo.c,v 1.51 2004/10/12 00:56:46 ion Exp $
|
/* $Id: sysinfo.c,v 1.52 2004/10/16 18:45:03 ion Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -54,12 +54,15 @@ ExGetCurrentProcessorCpuUsage (
|
||||||
{
|
{
|
||||||
PKPCR Pcr;
|
PKPCR Pcr;
|
||||||
ULONG TotalTime;
|
ULONG TotalTime;
|
||||||
ULONG PercentTime;
|
ULONG PercentTime = 0;
|
||||||
|
ULONGLONG ScaledIdle;
|
||||||
|
|
||||||
Pcr = KeGetCurrentKPCR();
|
Pcr = KeGetCurrentKPCR();
|
||||||
|
|
||||||
TotalTime = Pcr->PrcbData.KernelTime + Pcr->PrcbData.UserTime;
|
/* FIXME: Needs Idle Thread to be implented properly */
|
||||||
PercentTime = 100 - (TotalTime / Pcr->PrcbData.CurrentThread->KernelTime * 100);
|
ScaledIdle = Pcr->PrcbData.IdleThread->KernelTime * 100;
|
||||||
|
TotalTime = Pcr->PrcbData.KernelTime + Pcr->PrcbData.UserTime
|
||||||
|
if (TotalTime) PercentTime = 100 - (ScaledIdle / TotalTime);
|
||||||
CpuUsage = &PercentTime;
|
CpuUsage = &PercentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue