c - What are the best to ways measure latencies from user space to kernel space? -
i have measure latency between user space program driver interacts with. send packet through application. latecny between write
in user space corresponding write
function in kernel
i used clock_gettime
clock_monotonic
in user space , getrawmonotonic
in kernel (driver) , when see difference, huge (around 4ms). using wrong approach.
so, best ways this?
to measure single context switch user- kernel-space, try use tsc (time stamp counter). available on x86 , arms, user- , kernel-space.
more info tsc on wikipedia: https://en.wikipedia.org/wiki/time_stamp_counter
bsd-licensed implementation x86 could found here , for 64-bit arm here.
also, comments suggested, consider use standard tool available measure round-trip latency, i.e. use-to-kernel , back.
Comments
Post a Comment