On Mon, 1 Mar 2004, Toby Ewing wrote:
Hi, all
Frank suggested using the CPU timer, and I agree that it's a much better benchmark than the clock timer (I keep discovering gems in gpc.pas!). But I'm getting identical results from the two timers:
var time1, time2 : longCard; dummy, cpu1, cpu2 : integer; .. time1 := GetMicroSecondTime; dummy := 0; cpu1 := GetCPUTime(dummy);
for i := 1 to big do j := randNorm(0.0, 1.0);
dummy := 0; cpu2 := GetCPUTime(dummy); time2 := GetMicroSecondTime; writeln('Time for ', big:1, ' randNorms: ', ((time2-time1)*0.000001):7:2, ' seconds, ', (cpu2-cpu1):5, ' cpu seconds.'); ..
When the computer is idle except for this program, I get: Time for 100000000 randNorms: 171.03 seconds, 171 cpu seconds.
Why not try a program that does user input, say through a readln. When testing, you can delay the input as long as you wish. The net cpu time should be minimal, but the wall clock time obviously increases as you wait.
Tom