From: Paul Durrant Date: Mon, 19 Mar 2018 17:16:51 +0000 (+0000) Subject: Log system timers pre- and post-suspend X-Git-Tag: 9.0.0-rc1~63 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=af662f48159e1a94dcebc0c99a2aa2a22342ab1c;p=pvdrivers%2Fwin%2Fxenbus.git Log system timers pre- and post-suspend It's useful to know what difference, if any, in the main system timers Windows is subject to across a suspend/resume or migrate. Signed-off-by: Paul Durrant --- diff --git a/src/xenbus/suspend.c b/src/xenbus/suspend.c index 18cae1b..5667e84 100644 --- a/src/xenbus/suspend.c +++ b/src/xenbus/suspend.c @@ -140,6 +140,46 @@ SuspendDeregister( __SuspendFree(Callback); } +static FORCEINLINE VOID +__SuspendLogTimers( + IN const CHAR *Prefix + ) +{ + LARGE_INTEGER SystemTime; + LARGE_INTEGER TickCount; + ULONG TimeIncrement; + LARGE_INTEGER PerformanceCounter; + LARGE_INTEGER PerformanceFrequency; + + KeQuerySystemTime(&SystemTime); + + TimeIncrement = KeQueryTimeIncrement(); + KeQueryTickCount(&TickCount); + + PerformanceCounter = KeQueryPerformanceCounter(&PerformanceFrequency); + + LogPrintf(LOG_LEVEL_INFO, + "%s: SystemTime = %08x.%08x\n", + Prefix, + SystemTime.HighPart, + SystemTime.LowPart); + + LogPrintf(LOG_LEVEL_INFO, + "%s: TickCount = %08x.%08x (TimeIncrement = %08x)\n", + Prefix, + TickCount.HighPart, + TickCount.LowPart, + TimeIncrement); + + LogPrintf(LOG_LEVEL_INFO, + "%s: PerformanceCounter = %08x.%08x (Frequency = %08x.%08x)\n", + Prefix, + PerformanceCounter.HighPart, + PerformanceCounter.LowPart, + PerformanceFrequency.HighPart, + PerformanceFrequency.LowPart); +} + NTSTATUS #pragma prefast(suppress:28167) // Function changes IRQL SuspendTrigger( @@ -158,6 +198,8 @@ SuspendTrigger( SyncCapture(); SyncDisableInterrupts(); + __SuspendLogTimers("PRE-SUSPEND"); + LogPrintf(LOG_LEVEL_INFO, "SUSPEND: SCHEDOP_shutdown:SHUTDOWN_suspend ====>\n"); status = SchedShutdown(SHUTDOWN_suspend); @@ -165,6 +207,8 @@ SuspendTrigger( "SUSPEND: SCHEDOP_shutdown:SHUTDOWN_suspend <==== (%08x)\n", status); + __SuspendLogTimers("POST-SUSPEND"); + if (NT_SUCCESS(status)) { PLIST_ENTRY ListEntry;