]> xenbits.xensource.com Git - people/pauldu/xenbus.git/commitdiff
Log system timers pre- and post-suspend
authorPaul Durrant <paul.durrant@citrix.com>
Mon, 19 Mar 2018 17:16:51 +0000 (17:16 +0000)
committerPaul Durrant <paul.durrant@citrix.com>
Mon, 19 Mar 2018 17:16:51 +0000 (17:16 +0000)
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 <paul.durrant@citrix.com>
src/xenbus/suspend.c

index 18cae1b5dcc6f0d7797fd65cb893417bb20dfb0b..5667e8446176010f9d9a817493d2dd68f31f9358 100644 (file)
@@ -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;