当前位置: 首页 > 工具软件 > Flip timer > 使用案例 >

Documentation/timers/timer_stats

钱京
2023-12-01

Chinese translated version of Documentation/timers/timer_stats

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: 799942107@qq.com
---------------------------------------------------------------------
Documentation/timers/timer_stats的中文翻译


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

中文版维护者: 黄佳露   799942107@qq.com
中文版翻译者: 黄佳露   799942107@qq.com
中文版校译者: 潘丽卡   774945605@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是一种能使定时器(ab)用法在linux系统对内核与用户空间开发人员可见得
调试工具。如果在配置中启用它但是又不用它,这几乎等同于零运行时的开销,和一个相
对较小的数据结构的开销。即使运行时启用收集功能,所有的锁定都是per-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:
- 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收集计时器事件的信息,这些事件在Linux系统的一个采样周期中被启动:
-pid的任务(进程),初始化计时器
-进程的名字,初始化计时器
-计时器初始化的函数
-与计时器有关的回调函数
-事件的数量(回调函数)

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

timer_stats添加一个条目到/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
Timerstats样本期: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
总共90个事件、30.0事件/秒

 


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
添加标记表明在/proc/timer_stats的‘可延迟计时器’。一个可延迟计时器会出现以下事件:
  10D,     1 swapper          queue_delayed_work_on (delayed_work_timer_fn)


 

 类似资料:

相关阅读

相关文章

相关问答