mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 20:39:33 +08:00
* times.cc (hires_ms::prime): More debugging.
(hires_ms::usecs): Ditto.
This commit is contained in:
parent
39dd399c50
commit
f359a29fc8
@ -1,3 +1,8 @@
|
|||||||
|
2005-11-04 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* times.cc (hires_ms::prime): More debugging.
|
||||||
|
(hires_ms::usecs): Ditto.
|
||||||
|
|
||||||
2005-11-03 Christopher Faylor <cgf@timesys.com>
|
2005-11-03 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* times.cc (stupid_printf): Define and use throughout -- temporarily.
|
* times.cc (stupid_printf): Define and use throughout -- temporarily.
|
||||||
|
@ -240,8 +240,8 @@ frok::child (void *)
|
|||||||
cygbench ("fork-child");
|
cygbench ("fork-child");
|
||||||
ld_preload ();
|
ld_preload ();
|
||||||
fixup_hooks_after_fork ();
|
fixup_hooks_after_fork ();
|
||||||
cygwin_finished_initializing = true;
|
|
||||||
_my_tls.fixup_after_fork ();
|
_my_tls.fixup_after_fork ();
|
||||||
|
cygwin_finished_initializing = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,8 +144,11 @@ totimeval (struct timeval *dst, FILETIME *src, int sub, int flag)
|
|||||||
dst->tv_sec = x / (long long) (1e6);
|
dst->tv_sec = x / (long long) (1e6);
|
||||||
}
|
}
|
||||||
|
|
||||||
hires_ms NO_COPY gtod;
|
hires_ms gtod;
|
||||||
UINT hires_ms::minperiod;
|
UINT NO_COPY hires_ms::minperiod; /* minperiod needs to be NO_COPY since it
|
||||||
|
is a trigger for setting timeBeginPeriod
|
||||||
|
which needs to be set once for every
|
||||||
|
program. */
|
||||||
|
|
||||||
/* FIXME: Make thread safe */
|
/* FIXME: Make thread safe */
|
||||||
extern "C" int
|
extern "C" int
|
||||||
@ -631,15 +634,16 @@ hires_ms::prime ()
|
|||||||
FILETIME f;
|
FILETIME f;
|
||||||
|
|
||||||
stupid_printf ("entering, minperiod %d", minperiod);
|
stupid_printf ("entering, minperiod %d", minperiod);
|
||||||
if (!minperiod)
|
if (minperiod)
|
||||||
if (timeGetDevCaps (&tc, sizeof (tc)) != TIMERR_NOERROR)
|
/* done previously */;
|
||||||
minperiod = 1;
|
else if (timeGetDevCaps (&tc, sizeof (tc)) != TIMERR_NOERROR)
|
||||||
else
|
minperiod = 1;
|
||||||
{
|
else
|
||||||
stupid_printf ("timeGetDevCaps succeeded");
|
{
|
||||||
minperiod = min (max (tc.wPeriodMin, 1), tc.wPeriodMax);
|
minperiod = min (max (tc.wPeriodMin, 1), tc.wPeriodMax);
|
||||||
timeBeginPeriod (minperiod);
|
stupid_printf ("timeGetDevCaps succeeded. tc.wPeriodMin %u, tc.wPeriodMax %u, minperiod %u", tc.wPeriodMin, tc.wPeriodMax, minperiod);
|
||||||
}
|
timeBeginPeriod (minperiod);
|
||||||
|
}
|
||||||
stupid_printf ("inited %d");
|
stupid_printf ("inited %d");
|
||||||
|
|
||||||
if (!inited)
|
if (!inited)
|
||||||
@ -668,17 +672,23 @@ stupid_printf ("returning");
|
|||||||
LONGLONG
|
LONGLONG
|
||||||
hires_ms::usecs (bool justdelta)
|
hires_ms::usecs (bool justdelta)
|
||||||
{
|
{
|
||||||
|
stupid_printf ("before call to prime(), minperiod %u, process priority %d", minperiod, GetThreadPriority (GetCurrentThread ()));
|
||||||
if (!minperiod) /* NO_COPY variable */
|
if (!minperiod) /* NO_COPY variable */
|
||||||
prime ();
|
prime ();
|
||||||
|
stupid_printf ("after call to prime(), process priority %d", GetThreadPriority (GetCurrentThread ()));
|
||||||
|
|
||||||
DWORD now = timeGetTime ();
|
DWORD now = timeGetTime ();
|
||||||
|
stupid_printf ("after call to timeGetTime, process priority %d", GetThreadPriority (GetCurrentThread ()));
|
||||||
if ((int) (now - initime_ms) < 0)
|
if ((int) (now - initime_ms) < 0)
|
||||||
{
|
{
|
||||||
|
stupid_printf ("special casing, process priority %d", GetThreadPriority (GetCurrentThread ()));
|
||||||
inited = 0;
|
inited = 0;
|
||||||
prime ();
|
prime ();
|
||||||
now = timeGetTime ();
|
now = timeGetTime ();
|
||||||
}
|
}
|
||||||
// FIXME: Not sure how this will handle the 49.71 day wrap around
|
// FIXME: Not sure how this will handle the 49.71 day wrap around
|
||||||
LONGLONG res = initime_us.QuadPart + ((LONGLONG) (now - initime_ms) * 1000);
|
LONGLONG res = initime_us.QuadPart + ((LONGLONG) (now - initime_ms) * 1000);
|
||||||
|
stupid_printf ("res %U, process priority %d", res, GetThreadPriority (GetCurrentThread ()));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user