当前位置: 首页 > 工具软件 > 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: biyu tang<tangbiyu17@qq.com>
---------------------------------------------------------------------
Documentation/timers/timer_stats的中文翻译


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


中文版维护者: 唐碧瑜  biyu tang<tangbiyu17@qq.com>
中文版翻译者: 唐碧瑜  biyu tang<tangbiyu17@qq.com>
中文版校译者: 唐碧瑜  biyu tang<tangbiyu17@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:

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)

-任务(过程)的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

通过# echo 1 >/proc/timer_stats激活一个采样周期的问题

To stop a sample period issue:
# echo 0 >/proc/timer_stats

通过# echo 0 >/proc/timer_stats停止一个采样周期的问题

The statistics can be retrieved by:
# cat /proc/timer_stats

通过# 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
定时器采样周期: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个事件每秒。

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)

添加标志以表明在/ PROC/ timer_stats中的‘可延迟的定时器’。一个可延迟的定时器会
出现如下:
   10D,     1 swapper          queue_delayed_work_on (delayed_work_timer_fn)

 

 类似资料:

相关阅读

相关文章

相关问答