win-pvdrivers

changeset 870:bc0658d4bcee

Add timestamps to debug log messages
author James Harper <james.harper@bendigoit.com.au>
date Wed Mar 02 22:48:07 2011 +1100 (2011-03-02)
parents 34e72b071e51
children babee70630ad
files xenpci/xenpci_dbgprint.c
line diff
     1.1 --- a/xenpci/xenpci_dbgprint.c	Tue Mar 01 23:47:47 2011 +1100
     1.2 +++ b/xenpci/xenpci_dbgprint.c	Wed Mar 02 22:48:07 2011 +1100
     1.3 @@ -69,10 +69,23 @@ static volatile LONG debug_print_lock = 
     1.4  static void XenDbgPrint(PCHAR string, ULONG length)
     1.5  {
     1.6    ULONG i;
     1.7 +  ULONGLONG j;
     1.8 +  LARGE_INTEGER current_time;
     1.9    //KIRQL old_irql = 0;
    1.10  
    1.11    while(InterlockedCompareExchange(&debug_print_lock, 1, 0) == 1)
    1.12      KeStallExecutionProcessor(1);
    1.13 +  
    1.14 +  KeQuerySystemTime(&current_time);
    1.15 +  current_time.QuadPart /= 10000; /* convert to ms */
    1.16 +  for (j = 1000000000000000000L; j >= 1; j /= 10)
    1.17 +    if (current_time.QuadPart / j)
    1.18 +      break;
    1.19 +  for (; j >= 1; j /= 10)
    1.20 +    WRITE_PORT_UCHAR(XEN_IOPORT_LOG, '0' + ((current_time.QuadPart / j) % 10));
    1.21 +  WRITE_PORT_UCHAR(XEN_IOPORT_LOG, ':');
    1.22 +  WRITE_PORT_UCHAR(XEN_IOPORT_LOG, ' ');
    1.23 +      
    1.24    for (i = 0; i < length; i++)
    1.25      WRITE_PORT_UCHAR(XEN_IOPORT_LOG, string[i]);
    1.26    /* release the lock */