Guys,
Allow me to keep this topic going for a bit longer.
Since Hutch, Marinus, JJ and I are going through different routes, I wonder how the benchmarks behave (not done it yet). But an interesting one though.
I'm dealing with dwords and doing the stuff in cpu prior to FPU. Marinus is going SIMD with dd, and JJ is full dq.
My approach was:
.data
SchedulerMS dd 1 ; granularity for Sleep
PerfCountFreq dd 0
LastCounter dd 0
EndCounter dd 0
ElapsedCounter dd 0
tFPS dd 0
MSPerFrame real8 0.0
SleepMS sdword 0
TargetSecPerFrame real8 16.0
.code
inv timeBeginPeriod, SchedulerMS
.IF eax != TIMERR_NOERROR
console "ATTENTION: timeBeginPeriod failed!" ; (console is my printf macro)
.ENDIF
inv QueryPerformanceFrequency, ADDR PerfCountFreq
inv QueryPerformanceCounter, ADDR LastCounter
; prog loop starts
;;; code here
inv QueryPerformanceCounter, ADDR EndCounter
mov ecx, LastCounter
mov eax, EndCounter
sub eax, ecx
mov edx, 1000
mov ElapsedCounter, eax
mul edx
push eax
fild dword ptr [esp]
fidiv PerfCountFreq
fstp MSPerFrame
mov eax, PerfCountFreq
cdq
div dword ptr ElapsedCounter
mov tFPS, eax
fld TargetSecPerFrame
fsub MSPerFrame
fistp SleepMS
cmp SleepMS, 0
jle done
inv Sleep, dword ptr [SleepMS]
done:
[code]
By natural selection, I must be running far behind...but who knows... any comments?
edit to organize the code