[PERF]: Not in any way a scientific number you should bet the farm on, but we do now count the number of cycles at the very first instruction of kernel initialization, at the moment SMSS initializes the registry (when we call kernel initialization complete), and at the moment there have been 12 processes created (10 without counting idle/system), which is a bit less than a normal GUI boot. We also display the number if interrupts, system calls, and context switches it took to get us there. A purely comparative number, perhaps worthy for inclusion in testman/regression tests?

svn path=/trunk/; revision=45297
This commit is contained in:
Sir Richard 2010-01-28 15:51:18 +00:00
parent 5147b861f3
commit da7d769c43
4 changed files with 29 additions and 0 deletions

View file

@ -890,6 +890,14 @@ NtInitializeRegistry(IN USHORT Flag)
/* Always do this as kernel mode */
if (KeGetPreviousMode() == UserMode) return ZwInitializeRegistry(Flag);
/* Enough of the system has booted by now */
BootCyclesEnd = __rdtsc();
DPRINT1("Boot took %I64d cycles!\n", BootCyclesEnd - BootCycles);
DPRINT1("Interrupts: %d System Calls: %d Context Switches: %d\n",
KeGetCurrentPrcb()->InterruptCount,
KeGetCurrentPrcb()->KeSystemCalls,
KeGetContextSwitches(KeGetCurrentPrcb()));
/* Validate flag */
if (Flag > CM_BOOT_FLAG_MAX) return STATUS_INVALID_PARAMETER;

View file

@ -139,6 +139,8 @@ extern ULONG_PTR KiBugCheckData[5];
extern ULONG KiFreezeFlag;
extern ULONG KiDPCTimeout;
extern PGDI_BATCHFLUSH_ROUTINE KeGdiFlushUserBatch;
extern ULONGLONG BootCycles, BootCyclesEnd;
extern ULONG ProcessCount;
/* MACROS *************************************************************************/

View file

@ -25,6 +25,10 @@ ULONG_PTR KiDoubleFaultStack = (ULONG_PTR)&KiDoubleFaultStackData[KERNEL_STACK_S
KSPIN_LOCK KiFreezeExecutionLock;
KSPIN_LOCK Ki486CompatibilityLock;
/* Perf */
ULONG ProcessCount;
ULONGLONG BootCycles, BootCyclesEnd;
/* FUNCTIONS *****************************************************************/
VOID
@ -683,6 +687,9 @@ KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
PKTSS Tss;
PKIPCR Pcr;
/* Boot cycles timestamp */
BootCycles = __rdtsc();
/* Check if we are being booted from FreeLDR */
if (!((ULONG_PTR)LoaderBlock & 0x80000000)) KiRosPrepareForSystemStartup((PROS_LOADER_PARAMETER_BLOCK)LoaderBlock);

View file

@ -843,6 +843,18 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
/* Run the Notification Routines */
PspRunCreateProcessNotifyRoutines(Process, TRUE);
/* If 12 processes have been created, enough of user-mode is ready */
if (++ProcessCount == 12)
{
/* Enough of the system has booted by now */
BootCyclesEnd = __rdtsc();
DPRINT1("User Boot took %I64d cycles!\n", BootCyclesEnd - BootCycles);
DPRINT1("Interrupts: %d System Calls: %d Context Switches: %d\n",
KeGetCurrentPrcb()->InterruptCount,
KeGetCurrentPrcb()->KeSystemCalls,
KeGetContextSwitches(KeGetCurrentPrcb()));
}
CleanupWithRef:
/*