#!/bin/sh sudo trace-cmd record \ -e syscalls:sys_enter_nanosleep \ -e timer:hrtimer_start \ -e sched:sched_switch \ -e irq_vectors:local_timer_entry \ -e timer:hrtimer_expire_entry \ -e sched:sched_wakeup \ -e syscalls:sys_exit_nanosleep \ chrt -f 98 /bin/sleep 2 # Notice the chain of events (and their latencies!): # # sys_enter_nanosleep (call to clock_nanosleep()) # hrtimer_start (hrtimer set) # sched_switch (go to sleep) # # ... about 2 seconds later ... # # local_timer_entry (cpu in irq vector) # hrtimer_expire_entry (hrtimer callback) # sched_wakeup (wake the sleeping task) # sched_switch (task scheduled) # sys_exit_nanosleep (return from clock_nanosleep()) kernelshark