Re: Is timeGetTime monotonic and uniform?
- From: NoSpam@xxxxxxxxxxx (Bob Masta)
- Date: Sun, 03 Dec 2006 14:10:17 GMT
On Sun, 03 Dec 2006 11:31:59 +0100,
=?ISO-8859-15?Q?=22Martin_v=2E_L=F6wis=22?= <martin@xxxxxxxxxxx>
wrote:
I'm looking for a way to measure durations on Windows
(i.e. differences between start and end time)
The stock GetSystemTimeAsFileTime is not appropriate,
as the result will be incorrect if the system time
is adjusted, e.g. due to the time service starting
(or manual adjustment).
Next candidate is GetTickCount(). I know this runs
over after 47d, but I wonder whether the description
"milliseconds since the system has started" is really
correct, given that it also says "This value is also affected
by adjustments made by the GetSystemTimeAdjustment function."
Next candidate is timeGetTime(). It has nearly the
same description as GetTickCount, but without the
remark that it is influenced by GetSystemTimeAdjustment.
Does that mean it is not influenced by time adjustments?
Or did they just leave that out of the description?
Are there any other functions I should use?
Regards,
Martin
The instruction I would use is RDTSC, which is an
assembler opcode (ReaD Time Stamp Counter)
that returns the CPU ticks since boot time in EDX:EAX.
Note that the tick rate varies as a function of the CPU
clock rate, which can be a serious problem on systems
that slow the clock for power-saving. Nonetheless, RDTSC
is still useful for many timing operations, such as code
optimization.
You can use the API function QueryPerformanceCounter
to obtain the same functionality as RDTSC, and then use
QueryPerformanceFrequency to get the CPU rate. I don't
know if QueryPerfomanceFrequency changes during
power saving, or if it is a system constant.
Best regards,
Bob Masta
dqatechATdaqartaDOTcom
D A Q A R T A
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Home of DaqGen, the FREEWARE signal generator
.
- Follow-Ups:
- Re: Is timeGetTime monotonic and uniform?
- From: "Martin v. Löwis"
- Re: Is timeGetTime monotonic and uniform?
- From: alanglloyd@xxxxxxx
- Re: Is timeGetTime monotonic and uniform?
- References:
- Is timeGetTime monotonic and uniform?
- From: "Martin v. Löwis"
- Is timeGetTime monotonic and uniform?
- Prev by Date: Re: Is timeGetTime monotonic and uniform?
- Next by Date: Re: Is timeGetTime monotonic and uniform?
- Previous by thread: Re: Is timeGetTime monotonic and uniform?
- Next by thread: Re: Is timeGetTime monotonic and uniform?
- Index(es):
Relevant Pages
|
Loading