diff --git a/reactos/ntoskrnl/config/ntapi.c b/reactos/ntoskrnl/config/ntapi.c index 0d622696cef..deb21ad9f0b 100644 --- a/reactos/ntoskrnl/config/ntapi.c +++ b/reactos/ntoskrnl/config/ntapi.c @@ -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; diff --git a/reactos/ntoskrnl/include/internal/ke.h b/reactos/ntoskrnl/include/internal/ke.h index 8f70db9a369..e2e63172ec0 100644 --- a/reactos/ntoskrnl/include/internal/ke.h +++ b/reactos/ntoskrnl/include/internal/ke.h @@ -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 *************************************************************************/ diff --git a/reactos/ntoskrnl/ke/i386/kiinit.c b/reactos/ntoskrnl/ke/i386/kiinit.c index 10e47627316..ea7f140ac39 100644 --- a/reactos/ntoskrnl/ke/i386/kiinit.c +++ b/reactos/ntoskrnl/ke/i386/kiinit.c @@ -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); diff --git a/reactos/ntoskrnl/ps/process.c b/reactos/ntoskrnl/ps/process.c index 2cc0c4f6ae2..5b904f2504e 100644 --- a/reactos/ntoskrnl/ps/process.c +++ b/reactos/ntoskrnl/ps/process.c @@ -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: /*