* times.cc (hires_ms::prime): Add lots of temporary debugging output.

This commit is contained in:
Christopher Faylor 2005-11-03 14:59:23 +00:00
parent cdf5300155
commit 314f743e1e
2 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2005-11-03 Christopher Faylor <cgf@timesys.com>
* times.cc (hires_ms::prime): Add lots of temporary debugging output.
2005-11-02 Christopher Faylor <cgf@timesys.com> 2005-11-02 Christopher Faylor <cgf@timesys.com>
* times.cc (hires_ms::minperiod): Make copy-on-fork. * times.cc (hires_ms::minperiod): Make copy-on-fork.

View File

@ -629,22 +629,30 @@ hires_ms::prime ()
TIMECAPS tc; TIMECAPS tc;
FILETIME f; FILETIME f;
debug_printf ("entering, minperiod %d", minperiod);
if (!minperiod) if (!minperiod)
if (timeGetDevCaps (&tc, sizeof (tc)) != TIMERR_NOERROR) if (timeGetDevCaps (&tc, sizeof (tc)) != TIMERR_NOERROR)
minperiod = 1; minperiod = 1;
else else
{ {
debug_printf ("timeGetDevCaps succeeded");
minperiod = min (max (tc.wPeriodMin, 1), tc.wPeriodMax); minperiod = min (max (tc.wPeriodMin, 1), tc.wPeriodMax);
timeBeginPeriod (minperiod); timeBeginPeriod (minperiod);
} }
debug_printf ("inited %d");
if (!inited) if (!inited)
{ {
int priority = GetThreadPriority (GetCurrentThread ()); int priority = GetThreadPriority (GetCurrentThread ());
debug_printf ("priority %d", priority);
SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_TIME_CRITICAL); SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_TIME_CRITICAL);
debug_printf ("SetThreadPriority to THREAD_PRIORITY_TIME_CRITICAL");
initime_ms = timeGetTime (); initime_ms = timeGetTime ();
debug_printf ("after timeGetTime");
GetSystemTimeAsFileTime (&f); GetSystemTimeAsFileTime (&f);
debug_printf ("after GetSystemTimeAsFileTime");
SetThreadPriority (GetCurrentThread (), priority); SetThreadPriority (GetCurrentThread (), priority);
debug_printf ("SetThreadPriority(%p, %d)", GetCurrentThread(), priority);
inited = 1; inited = 1;
initime_us.HighPart = f.dwHighDateTime; initime_us.HighPart = f.dwHighDateTime;
@ -652,6 +660,7 @@ hires_ms::prime ()
initime_us.QuadPart -= FACTOR; initime_us.QuadPart -= FACTOR;
initime_us.QuadPart /= 10; initime_us.QuadPart /= 10;
} }
debug_printf ("returning");
return minperiod; return minperiod;
} }