Reputation: 41
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
Upvotes: 4
Views: 699
Reputation: 94165
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()
Upvotes: 2
Reputation: 24907
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 :)
Upvotes: 4