Thread (14 messages) 14 messages, 5 authors, 2012-02-14

How to measure performance inside Kernel?

From: peter.senna@gmail.com (Peter Senna Tschudin)
Date: 2012-02-10 21:47:37

Dear list,

As Michi suggested, I did some testing with ktime.h, but I found a
simpler solution with time.h.

I'm not sure if it is correct, and I would like to have some help... :-)

The code that I'm using for execution time measurement is:

#include <linux/time.h>

getnstimeofday (ts_start); /*stopwatch start*/

for (i = 0; i < q->num_buffers; ++i)
	q->bufs[i]->state = VB2_BUF_STATE_DEQUEUED;

getnstimeofday (ts_end); /*stopwatch stop*/

diff = timespec_sub(end, begin);

printk ("%lu,", diff.tv_nsec );

Am I doing anything wrong? Can mysterious stuff like out of order
execution engine, brake the stopwatch?

The full module code is at: http://goo.gl/cCMIa

Thank you!

Peter

On Thu, Feb 9, 2012 at 10:58 AM, Peter Senna Tschudin
[off-list ref] wrote:
Dear list,

I'm looking for a way to compare the performance of two different
codes inside Kernel. I was able to do some comparison on user land but
I want to test the specific portion of code inside Kernel.
-- 
Peter Senna Tschudin
peter.senna at gmail.com
gpg id: 48274C36
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help