Documentation\accounting\delay—accounting

Chinese translated version of Documentation\accounting\delay—accounting


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>
---------------------------------------------------------------------
DocumentationDocumentation\accounting\delay—accounting的中文翻译


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


中文版维护者: 唐碧瑜  biyu tang<tangbiyu17@qq.com>
中文版翻译者: 唐碧瑜  biyu tang<tangbiyu17@qq.com>
中文版校译者: 唐碧瑜  biyu tang<tangbiyu17@qq.com>

 

 

 

 


以下为正文
---------------------------------------------------------------------

Delay accounting
----------------
推迟核算

Tasks encounter delays in execution when they wait
for some kernel resource to become available e.g. a
runnable task may wait for a free CPU to run on.

执行任务当他们等待某些内核资源可用就会发生延误,例如一个
可运行的任务可能会等待一个空闲的CPU去运行。

The per-task delay accounting functionality measures
the delays experienced by a task while

每个任务的延迟计算功能衡量一个任务所经历的延迟。

a) waiting for a CPU (while being runnable)
b) completion of synchronous block I/O initiated by the task
c) swapping in pages
d) memory reclaim

a)等待一个CPU(当可运行)
b)完成由任务发起的同步块I/O
c)在页中交换
d)内存回收

and makes these statistics available to userspace through
the taskstats interface.

并且使这些统计数据能让用户空间获得通过任务状态接口

Such delays provide feedback for setting a task's cpu priority,
io priority and rss limit values appropriately. Long delays for
important tasks could be a trigger for raising its corresponding priority.

这种延误为设置一个任务的CPU优先级提供反馈,IO优先和适当RSS极限值。对于
重要的任务长延迟可能是提高其相应优先级触发器。

The functionality, through its use of the taskstats interface, also provides
delay statistics aggregated for all tasks (or threads) belonging to a
thread group (corresponding to a traditional Unix process). This is a commonly
needed aggregation that is more efficiently done by the kernel.

通过其使用的taskstats接口,还提供了延迟统计汇总所有任务(或线程)属于一个
线程组(对应于传统的Unix进程)的功能。这是一种常用的所需的聚合能更高效地
由内核完成

Userspace utilities, particularly resource management applications, can also
aggregate delay statistics into arbitrary groups. To enable this, delay
statistics of a task are available both during its lifetime as well as on its
exit, ensuring continuous and complete monitoring can be done.

用户空间的实用程序,特别是资源管理的应用程序,也可以汇总延迟统计到任意组。
要启用此功能,延缓统计任务可在其生命周期,以及其退出的时候,确保做到连续
和完整的监控。

Interface
---------
接口

Delay accounting uses the taskstats interface which is described
in detail in a separate document in this directory. Taskstats returns a
generic data structure to userspace corresponding to per-pid and per-tgid
statistics. The delay accounting functionality populates specific fields of
this structure. See
     include/linux/taskstats.h
for a description of the fields pertaining to delay accounting.
It will generally be in the form of counters returning the cumulative
delay seen for cpu, sync block I/O, swapin, memory reclaim etc.

延迟计算使用在目录的单独文件中被详细描述的taskstats接口。 Taskstats返回
用户空间对应的每PID和每TGID的的通用数据结构统计数据。延迟计算功能用这种
结构填充特定领域。见
    include/linux/taskstats.h
延迟计算有关的字段的说明。它通常是计数器的形式返回累计延迟CPU,同步块I / O,
换入,内存回收等。

Taking the difference of two successive readings of a given
counter (say cpu_delay_total) for a task will give the delay
experienced by the task waiting for the corresponding resource
in that interval.

以一个给定的连续两个读数之差的计数器(比如说cpu_delay_total)任务会在该时间
间隔给延迟任务所经历的等待相应的资源。

When a task exits, records containing the per-task statistics
are sent to userspace without requiring a command. If it is the last exiting
task of a thread group, the per-tgid statistics are also sent. More details
are given in the taskstats interface description.

当一个任务退出,包含每个任务统计的记录无需命令被发送到用户空间。如果它是最后一个退出
一个线程组的任务,每TGID的统计数据也被发送。更多细节在taskstats接口描述。

The getdelays.c userspace utility in this directory allows simple commands to
be run and the corresponding delay statistics to be displayed. It also serves
as an example of using the taskstats interface.

getdelays.c的用户空间实用程序在此目录中允许简单的命令运行,并显示相应的延迟统计。它也可
作为一个taskstats接口使用的例子。

Usage
-----
用法

Compile the kernel with
 CONFIG_TASK_DELAY_ACCT=y
 CONFIG_TASKSTATS=y


 CONFIG_TASK_DELAY_ACCT=y
 CONFIG_TASKSTATS=y
编译内核
   
Delay accounting is enabled by default at boot up.
To disable, add
   nodelayacct
to the kernel boot options. The rest of the instructions
below assume this has not been done.

在启动时,默认情况下是启用的延迟计算的。
要禁用,加
   nodelayacct
对于内核引导选项,说明剩余部分尚未完成。

After the system has booted up, use a utility
similar to  getdelays.c to access the delays
seen by a given task or a task group (tgid).
The utility also allows a given command to be
executed and the corresponding delays to be
seen.

系统启动后,一个给定的任务或任务组(TGID),使用工具类似getdelays.c访问可看到延迟。
该实用程序还允许执行给定的命令,可看到相应的延迟。

General format of the getdelays command

getdelays命令的一般格式

getdelays [-t tgid] [-p pid] [-c cmd...]


Get delays, since system boot, for pid 10
对于pid 10从系统启动以来获得延迟
# ./getdelays -p 10
(output similar to next case)

Get sum of delays, since system boot, for all pids with tgid 5
从系统启动以来获得延迟总和,对于所有的pid和tgid 5
# ./getdelays -t 5


CPU count real total virtual total delay total
 7876 92005750 100000000 24001500
IO count delay total
 0 0
SWAP count delay total
 0 0
RECLAIM count delay total
 0 0

Get delays seen in executing a given simple command
执行一个简单的命令获得延迟
# ./getdelays -c ls /

bin   data1  data3  data5  dev  home  media  opt   root  srv        sys  usr
boot  data2  data4  data6  etc  lib   mnt    proc  sbin  subdomain  tmp  var


CPU count real total virtual total delay total
 6 4000250  4000000  0
IO count delay total
 0 0
SWAP count delay total
 0 0
RECLAIM count delay total
 0 0

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值