mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Improved Passive Level kernel and user time counters.
svn path=/trunk/; revision=9145
This commit is contained in:
parent
9a4b93f87e
commit
a746bec6f1
3 changed files with 45 additions and 30 deletions
|
@ -32,9 +32,9 @@
|
|||
|
||||
#ifndef __ASM__
|
||||
extern LARGE_INTEGER SystemBootTime;
|
||||
extern ULONG KiKernelTime;
|
||||
extern ULONG KiUserTime;
|
||||
extern ULONG KiDpcTime;
|
||||
extern volatile ULONG KiKernelTime;
|
||||
extern volatile ULONG KiUserTime;
|
||||
extern volatile ULONG KiDpcTime;
|
||||
#endif
|
||||
|
||||
/* INTERNAL KERNEL FUNCTIONS ************************************************/
|
||||
|
@ -136,6 +136,9 @@ KeBugCheckWithTf(ULONG BugCheckCode,
|
|||
VOID
|
||||
KiDumpTrapFrame(PKTRAP_FRAME Tf, ULONG ExceptionNr, ULONG cr2);
|
||||
|
||||
VOID
|
||||
KiUpdateProcessThreadTime(VOID);
|
||||
|
||||
#endif /* not __ASM__ */
|
||||
|
||||
#define MAXIMUM_PROCESSORS 32
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: irq.c,v 1.41 2004/03/09 21:49:53 dwelch Exp $
|
||||
/* $Id: irq.c,v 1.42 2004/04/14 23:32:38 jimtabor Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/i386/irq.c
|
||||
|
@ -521,6 +521,11 @@ KiInterruptDispatch (ULONG irq, PKIRQ_TRAPFRAME Trapframe)
|
|||
|
||||
HalEndSystemInterrupt (old_level, 0);
|
||||
|
||||
if (old_level==PASSIVE_LEVEL)
|
||||
{
|
||||
KiUpdateProcessThreadTime();
|
||||
}
|
||||
|
||||
if (old_level==PASSIVE_LEVEL && Trapframe->Cs != KERNEL_CS)
|
||||
{
|
||||
CurrentThread = KeGetCurrentThread();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: timer.c,v 1.69 2004/04/14 17:14:45 jimtabor Exp $
|
||||
/* $Id: timer.c,v 1.70 2004/04/14 23:32:37 jimtabor Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -38,9 +38,9 @@ LARGE_INTEGER SystemBootTime = (LARGE_INTEGER)0LL;
|
|||
LARGE_INTEGER SystemBootTime = { 0 };
|
||||
#endif
|
||||
|
||||
ULONG KiKernelTime;
|
||||
ULONG KiUserTime;
|
||||
ULONG KiDpcTime;
|
||||
volatile ULONG KiKernelTime;
|
||||
volatile ULONG KiUserTime;
|
||||
volatile ULONG KiDpcTime;
|
||||
|
||||
/*
|
||||
* Number of timer interrupts since initialisation
|
||||
|
@ -600,10 +600,7 @@ KiUpdateSystemTime(KIRQL oldIrql,
|
|||
*/
|
||||
{
|
||||
LARGE_INTEGER Time;
|
||||
/*
|
||||
PKTHREAD CurrentThread;
|
||||
PKPROCESS CurrentProcess;
|
||||
*/
|
||||
|
||||
assert(KeGetCurrentIrql() == PROFILE_LEVEL);
|
||||
|
||||
KiRawTicks++;
|
||||
|
@ -634,24 +631,6 @@ KiUpdateSystemTime(KIRQL oldIrql,
|
|||
SharedUserData->SystemTime.LowPart = Time.u.LowPart;
|
||||
SharedUserData->SystemTime.High1Part = Time.u.HighPart;
|
||||
|
||||
/*
|
||||
CurrentThread = KeGetCurrentThread();
|
||||
CurrentProcess = KeGetCurrentProcess();
|
||||
|
||||
if (CurrentThread->PreviousMode == UserMode)
|
||||
{
|
||||
++CurrentThread->UserTime;
|
||||
++CurrentProcess->UserTime;
|
||||
++KiUserTime;
|
||||
}
|
||||
if (CurrentThread->PreviousMode == KernelMode)
|
||||
{
|
||||
++CurrentProcess->KernelTime;
|
||||
++CurrentThread->KernelTime;
|
||||
++KiKernelTime;
|
||||
}
|
||||
*/
|
||||
|
||||
KiReleaseSpinLock(&TimerValueLock);
|
||||
|
||||
/*
|
||||
|
@ -694,3 +673,31 @@ KeInitializeTimerImpl(VOID)
|
|||
TimerInitDone = TRUE;
|
||||
DPRINT("Finished KeInitializeTimerImpl()\n");
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
KiUpdateProcessThreadTime(VOID)
|
||||
{
|
||||
PKTHREAD CurrentThread;
|
||||
PKPROCESS CurrentProcess;
|
||||
|
||||
assert(KeGetCurrentIrql() == PASSIVE_LEVEL);
|
||||
|
||||
CurrentThread = KeGetCurrentThread();
|
||||
CurrentProcess = KeGetCurrentProcess();
|
||||
|
||||
DPRINT("KiKernelTime %u, KiUserTime %u \n", KiKernelTime, KiUserTime);
|
||||
|
||||
if (CurrentThread->PreviousMode == UserMode)
|
||||
{
|
||||
++CurrentThread->UserTime;
|
||||
++CurrentProcess->UserTime;
|
||||
++KiUserTime;
|
||||
}
|
||||
if (CurrentThread->PreviousMode == KernelMode)
|
||||
{
|
||||
++CurrentProcess->KernelTime;
|
||||
++CurrentThread->KernelTime;
|
||||
++KiKernelTime;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue