Documentation_timers_timer_stats

来源:互联网 发布:安装ubuntu到u盘 编辑:程序博客网 时间:2024/04/27 17:48
Chinese translated version of Documentation/virtual/kvm/locking.txt


If you have any comment or update to the content, please contact the
original document maintainer directly.  However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help.  Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.


Chinese maintainer: 王明达 530999000@qq.com
---------------------------------------------------------------------
Documentation/virtual/kvm/locking.txt的中文翻译


如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。


中文版维护者: 王明达 530999000@qq.com
中文版翻译者: 王明达 530999000@qq.com


以下为正文


---------------------------------------------------------------------


timer_stats - timer usage statistics


timer_stats - 定时器使用情况统计
------------------------------------


timer_stats is a debugging facility to make the timer (ab)usage in a Linux
system visible to kernel and userspace developers. If enabled in the config
but not used it has almost zero runtime overhead, and a relatively small
data structure overhead. Even if collection is enabled runtime all the
locking is per-CPU and lookup is hashed.


timer_stats是一个调试设施来使timer(ab)在Linux系统里对于内核以及用户空间开发者
可见。如果在配置里可行但不使用在运行开销几乎为0和相对较小的数据结构的开销时。即
使收集运行时启用锁定每个CPU和散列查找。


timer_stats should be used by kernel and userspace developers to verify that
their code does not make unduly use of timers. This helps to avoid unnecessary
wakeups, which should be avoided to optimize power consumption.


timer_stats应该由内核和用户控件开发者使用来验证他们的代码不过度使用定时器。这有
助于避免那些应该避免使用以优化功耗的不必要的唤醒。


It can be enabled by CONFIG_TIMER_STATS in the "Kernel hacking" configuration
section.


它可以通过CONFIG_TIMER_STATS的“内核黑客”的配置部分。


timer_stats collects information about the timer events which are fired in a
Linux system over a sample period:


timer_stats收集被解雇Linux系统在样本期间的计时器事件的信息:


- the pid of the task(process) which initialized the timer
- the name of the process which initialized the timer
- the function where the timer was initialized
- the callback function which is associated to the timer
- the number of events (callbacks)


timer_stats adds an entry to /proc: /proc/timer_stats


This entry is used to control the statistics functionality and to read out the
sampled information.


这个词条是用来控制统计信息的功能和读出采样信息。


The timer_stats functionality is inactive on bootup.


在启动时的timer_stats功能是无效的。


To activate a sample period issue:


激活一个采样周期的问题:


# echo 1 >/proc/timer_stats


To stop a sample period issue:


停止一个采样周期


# echo 0 >/proc/timer_stats


The statistics can be retrieved by:


索引统计:


# cat /proc/timer_stats


The readout of /proc/timer_stats automatically disables sampling. The sampled
information is kept until a new sample period is started. This allows multiple
readouts.


/proc/timer_stats读出自动禁用采样。保持抽样信息知道一个新的采样周期开始。这允许多
个读数。


Sample output of /proc/timer_stats:


/ proc/ timer_stats中的输出示例:


Timerstats sample period: 3.888770 s
  12,     0 swapper          hrtimer_stop_sched_tick (hrtimer_sched_tick)
  15,     1 swapper          hcd_submit_urb (rh_timer_func)
   4,   959 kedac            schedule_timeout (process_timeout)
   1,     0 swapper          page_writeback_init (wb_timer_fn)
  28,     0 swapper          hrtimer_stop_sched_tick (hrtimer_sched_tick)
  22,  2948 IRQ 4            tty_flip_buffer_push (delayed_work_timer_fn)
   3,  3100 bash             schedule_timeout (process_timeout)
   1,     1 swapper          queue_delayed_work_on (delayed_work_timer_fn)
   1,     1 swapper          queue_delayed_work_on (delayed_work_timer_fn)
   1,     1 swapper          neigh_table_init_no_netlink (neigh_periodic_timer)
   1,  2292 ip               __netdev_watchdog_up (dev_watchdog)
   1,    23 events/1         do_cache_clean (delayed_work_timer_fn)
90 total events, 30.0 events/sec


The first column is the number of events, the second column the pid, the third
column is the name of the process. The forth column shows the function which
initialized the timer and in parenthesis the callback function which was
executed on expiry.


第一列是事件的数量,第二列是pid,第三列是进程的名称。第四列显示了初始化定时器的函数
括号里的函数执行到期。


    Thomas, Ingo


Added flag to indicate 'deferrable timer' in /proc/timer_stats. A deferrable
timer will appear as follows
  10D,     1 swapper          queue_delayed_work_on (delayed_work_timer_fn)