4 ms·
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,
by fooblaster 4y ago
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.
- rurban 4y agoNo, 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.
- fooblaster 4y agoIts 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.