Author: Amir Ban
Date: 02:11:50 01/26/00
Go up one level in this thread
On January 25, 2000 at 18:56:37, Peter Fendrich wrote: >I tried to use the clock() function (in NT4) and it didn't behave as I expected >it to. >It is said to "Return elapsed CPU time for current process". >I hoped to be able to run performance tests with my chess program in the >background while doing other things in the foreground and yet get the same >results. >The clock() is definitely affected by other processes so I get very varied >results depending on what I'm doing in the foreground. > >How come? > >//Peter That's quite a lot of discussion on your question here, but AFAIK the answer is simple. In VisualC++ clock() returns the elapsed time. The documentation is misleading. To get CPU time, use GetProcessTimes, and take userTime from the returned structure. It's in 100 nsec units. If you are interested in measuring your context switch times and other o/s overhead (I know you are not), look at kernelTime. This works reliably AFAIK. On SMP it will even sum the times of the different processors, so on a 4-way machine you can get up to 4 CPU seconds for each elapsed second Amir
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.