]>
Commit | Line | Data |
---|---|---|
82f67cd9 IM |
1 | timer_stats - timer usage statistics |
2 | ------------------------------------ | |
3 | ||
4 | timer_stats is a debugging facility to make the timer (ab)usage in a Linux | |
5 | system visible to kernel and userspace developers. It is not intended for | |
6 | production usage as it adds significant overhead to the (hr)timer code and the | |
7 | (hr)timer data structures. | |
8 | ||
9 | timer_stats should be used by kernel and userspace developers to verify that | |
10 | their code does not make unduly use of timers. This helps to avoid unnecessary | |
11 | wakeups, which should be avoided to optimize power consumption. | |
12 | ||
13 | It can be enabled by CONFIG_TIMER_STATS in the "Kernel hacking" configuration | |
14 | section. | |
15 | ||
16 | timer_stats collects information about the timer events which are fired in a | |
17 | Linux system over a sample period: | |
18 | ||
19 | - the pid of the task(process) which initialized the timer | |
20 | - the name of the process which initialized the timer | |
21 | - the function where the timer was intialized | |
22 | - the callback function which is associated to the timer | |
23 | - the number of events (callbacks) | |
24 | ||
25 | timer_stats adds an entry to /proc: /proc/timer_stats | |
26 | ||
27 | This entry is used to control the statistics functionality and to read out the | |
28 | sampled information. | |
29 | ||
30 | The timer_stats functionality is inactive on bootup. | |
31 | ||
32 | To activate a sample period issue: | |
33 | # echo 1 >/proc/timer_stats | |
34 | ||
35 | To stop a sample period issue: | |
36 | # echo 0 >/proc/timer_stats | |
37 | ||
38 | The statistics can be retrieved by: | |
39 | # cat /proc/timer_stats | |
40 | ||
41 | The readout of /proc/timer_stats automatically disables sampling. The sampled | |
42 | information is kept until a new sample period is started. This allows multiple | |
43 | readouts. | |
44 | ||
45 | Sample output of /proc/timer_stats: | |
46 | ||
47 | Timerstats sample period: 3.888770 s | |
48 | 12, 0 swapper hrtimer_stop_sched_tick (hrtimer_sched_tick) | |
49 | 15, 1 swapper hcd_submit_urb (rh_timer_func) | |
50 | 4, 959 kedac schedule_timeout (process_timeout) | |
51 | 1, 0 swapper page_writeback_init (wb_timer_fn) | |
52 | 28, 0 swapper hrtimer_stop_sched_tick (hrtimer_sched_tick) | |
53 | 22, 2948 IRQ 4 tty_flip_buffer_push (delayed_work_timer_fn) | |
54 | 3, 3100 bash schedule_timeout (process_timeout) | |
55 | 1, 1 swapper queue_delayed_work_on (delayed_work_timer_fn) | |
56 | 1, 1 swapper queue_delayed_work_on (delayed_work_timer_fn) | |
57 | 1, 1 swapper neigh_table_init_no_netlink (neigh_periodic_timer) | |
58 | 1, 2292 ip __netdev_watchdog_up (dev_watchdog) | |
59 | 1, 23 events/1 do_cache_clean (delayed_work_timer_fn) | |
60 | 90 total events, 30.0 events/sec | |
61 | ||
62 | The first column is the number of events, the second column the pid, the third | |
63 | column is the name of the process. The forth column shows the function which | |
64 | initialized the timer and in parantheses the callback function which was | |
65 | executed on expiry. | |
66 | ||
67 | Thomas, Ingo | |
68 |