timer_stats.txt 2.7 KB

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