How to measure performance inside Kernel?
michi1 at michaelblizek.twilightparadox.com
michi1 at michaelblizek.twilightparadox.com
Thu Feb 9 13:12:24 EST 2012
Hi!
On 10:58 Thu 09 Feb , Peter Senna Tschudin wrote:
...
> But I want to repeat the tests on specific portion of code, not on
> entire application. Is there a safe way of do something like:
>
> start_bench ( ?? ); /* start measurement */
>
> buf_ptr_end = q->bufs[q->num_buffers];
>
> for (buf_ptr = q->bufs[0]; buf_ptr < buf_ptr_end; ++buf_ptr)
> buf_ptr->state = VB2_BUF_STATE_DEQUEUED;
>
> end_bench ( ?? ); /* end measurement */
Yes, you can do this. If you search for a way for time measurement, take a
look at include/linux/ktime.h .
> And is this the correct approach for testing the performance of
> specific portion of Kernel code?
Why not? I would be a be worried about how the cpu-cache effects the
measurement, especially because your benchmark already showed that a
significant time is spent there.
-Michi
--
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com
More information about the Kernelnewbies
mailing list