views:

86

answers:

2

Hi,

I added some additional code to the Linux kernel (the scheduler) and now I would like to know what is the impact of this modification.

For user processes I always used:

clock_gettime(CLOCK_PROCESS_CPUTIME_ID, ...);

Now I am wondering if there is a kernel-equivalent routine that I could use to do something similar.

Many thanks for your assistance, Martin

+4  A: 

Take a look at ftrace. Latencytop is based on that. There are good articles at lwn (here, here, and here)

Measuring scheduler performance is notoriously hard, so good luck :)

amarillion
THanks for that I will have a look at it. However, is there also something similar as the clock_gettime in Linux?
Martin
There is, but you don't want to try doing it that way in the kernel. ftrace is the right thing, it does all the hard parts for you.
Andrew McGregor
+1  A: 

unsigned long long native_sched_clock(void); from asm/timer.h for x86

unsigned long long sched_clock(void); from linux/sched.h for any arch

They are wrappers around rdtsc - tick counter reader.

upd.

there is also linux/clocksource.h

timecounter_init - initialize a time counter
timecounter_read - return nanoseconds elapsed since timecounter_init()
osgx