Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #6667

Time measuring on Windows

From BartC <bc@freeuk.com>
Newsgroups comp.programming
Subject Time measuring on Windows
Date 2016-05-29 10:53 +0100
Organization A noiseless patient Spider
Message-ID <niee0v$ded$1@dont-email.me> (permalink)

Show all headers | View raw


I need to measure how long short processes take to execute.

All the docs point to using QueryPerformanceCounter() (as opposed to 
using, for example, the RDTSC machine instruction).

But I'm getting crazy results.

If I call QPC(), then count to ten million (a task that should take 8ms 
based on how long it took to count to a billion), and call it again, the 
difference between the two readings should give an indication of how 
long it took.

But I've seen results from 180,000 to over 600,000! (Even RDTSC gives me 
20M to 42M, but that's across two cores; I thought QPC was supposed to 
fix that). I understand values need to be scaled to get actual times, 
but the problem is they are inconsistent.

Is there a more reliable way of measuring execution times in the 
millisecond range?

(This is for a process within a program; I don't want to use an external 
utility to measure the complete runtime of an executable as that will 
include all sorts of overheads.)

-- 
Bartc

Back to comp.programming | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Time measuring on Windows BartC <bc@freeuk.com> - 2016-05-29 10:53 +0100
  Re: Time measuring on Windows "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2016-05-29 17:16 +0200
    Re: Time measuring on Windows BartC <bc@freeuk.com> - 2016-05-29 17:32 +0100
      Re: Time measuring on Windows "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2016-05-29 19:04 +0200

csiph-web