whisper.cpp icon indicating copy to clipboard operation
whisper.cpp copied to clipboard

Add process-specific timings

Open abitofevrything opened this issue 1 year ago • 3 comments

Adds functions that use CLOCK_PROCESS_CPUTIME_ID instead of CLOCK_MONOTONIC for timings, and are therefore not affected by other processes on the system.

One thing to check before we merge: since the time is per-process, the time reported is n_threads times more than realtime since each active thread adds to the timings - should we adjust for this?

Also updated bench-all to include information about the measured parameters, better formatting and better configuration detection.

Closes #382.

abitofevrything avatar Jan 08 '23 11:01 abitofevrything

@abitofevrything Can you verify that everything is good on Windows? After that I will merge it

ggerganov avatar Jan 15 '23 10:01 ggerganov

Tested on my Windows machine and there seems to be some issues with using clock(). Apparently its implementation is OS-specific and on Windows it returns wall clock time instead of process time.

Apparently there is a GetProcessTimes to get process time, but I'll need to look into that later.

abitofevrything avatar Jan 15 '23 12:01 abitofevrything

Well, I changed the implementation to use GetProcessTimes but the issue with the timing still persists: process time is sometimes counted as negative.

I'm pretty sure this is an underflow/overflow issue, or an issue with the wrong data type being used somewhere, but I don't have a setup to debug this. I'll see what I could do, but if anyone used to windows development has any idea what is happening here I'd be glad if you could let me know.

abitofevrything avatar Jan 15 '23 14:01 abitofevrything