Hacker News new | past | comments | ask | show | jobs | submit login

It still is totally unreliable, and avoids documented best practices.

https://www.intel.com/content/dam/www/public/us/en/documents...

3.2.1 The Improved Benchmarking Method




Is there a reasonable way to do this without disabling preemption? All of these examples require the code to be in the kernel or for the kernel to be modified, which isn't really useful in all the places you need to benchmark.


No, you need a proper API for benchmarking. chrono only gives you one, for a single timestamp.

Benchmarking needs a separate timer_start and timer_end function. One with cpuid,rdtsc and one with rdtscp,cpuid.


Its very easy to get two timestamps at the start and end of the routine and subtract the difference with Chrono. No cpu pinning or preemption control is necessary.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: