Measuring synchronization in Linux kernel mode

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

For custom processes, I always used:

clock_gettime(CLOCK_PROCESS_CPUTIME_ID, ...); 

Now I'm wondering if there is an equivalent program in the kernel that I could use something like that.

Thanks so much for your help, Martin

+4
source share
2 answers

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

Measuring the performance of a scheduler is notoriously difficult, so good luck :)

+4
source

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

These are the wrappers around rdtsc - tick the counter counter.

update

there is also linux/clocksource.h

 timecounter_init - initialize a time counter timecounter_read - return nanoseconds elapsed since timecounter_init() 
+2
source

Source: https://habr.com/ru/post/1299725/


All Articles