https://access.redhat.com/articles/782993

Determine what tasks are periodically taking processor time

Updated 2014年五月7日21:34 -

English

When running a latency-sensitive application one might notice that on a regular basis (for example every 5 minutes) there is a delay. The SystemTap periodic.stp script can provide some possible causes of that regular delay. The SystemTap periodic.stp script generates a list of the number of times that various scheduled functions run and the time between each scheduled execution. In the case of delay every five minutes one would run the periodic script for tens of minutes and then look through the output list for a function that has a period of approximately 300,000,00 microseconds (5 minutes60seconds1,000,000 microseconds/second).

Follow the instructions in the SystemTap Beginners Guide to install SystemTap. The SystemTap --all-modules option should be included on the command line when using periodic.stp script so the script can map the kernel module instruction addresses back to function names and make it easier to interpret what is periodically running. The periodic script will collect data until Ctrl+c is pressed. Below is an example run of periodic.stp:

Raw

$ /usr/share/doc/systemtap-*/examples/profiling/periodic.stp --all-modules
#monitoring timer periods (press control-c for output)
^C#type   function                                            period(us)     count
kernel  0xffffffffa0c59200 [stap_eb782113d30627ea6aa3ef949        1000     13552
kernel  0xffffffffa0c59200 [stap_eb782113d30627ea6aa3ef949        1000     13552
kernel  0xffffffffa0c59200 [stap_eb782113d30627ea6aa3ef949        1000     13551
kernel  0xffffffffa0c59200 [stap_eb782113d30627ea6aa3ef949        1000     13550
work_q  do_dbs_timer                                              9999      1354
work_q  do_dbs_timer                                              9999      1354
kernel  0xffffffffa0c590e0 [stap_eb782113d30627ea6aa3ef949        9999      1354
work_q  do_dbs_timer                                             10000      1354
work_q  do_dbs_timer                                             10022      1351
kernel  0xffffffffa0c59020 [stap_eb782113d30627ea6aa3ef949       19999       676
kernel  monitor_timeout+0x0/0x10 [intel_ips]                    200003        67
kernel  clocksource_watchdog+0x0/0x230 [kernel]                 500033        26
kernel  tcp_delack_timer+0x0/0x270 [kernel]                     981240        13
work_q  i915_gem_retire_work_handler                           1007250        12
work_q  vmstat_update                                          1000000        12
kernel  ipmi_timeout+0x0/0x470 [kernel]                        1000002        12
work_q  vmstat_update                                          1000000        12
kernel  br_fdb_cleanup+0x0/0x120 [bridge]                       999999        12
work_q  vmstat_update                                           999999        12
work_q  vmstat_update                                          1000000        12
process kslowd000(157)                                            4983         8
work_q  cache_reap                                             2000001         6
kernel  e1000_watchdog+0x0/0x20 [e1000e]                       2000001         6
work_q  cache_reap                                             1999999         6
work_q  cache_reap                                             1999998         6
kernel  br_hello_timer_expired+0x0/0x90 [bridge]               1999998         6
work_q  cache_reap                                             2000000         6
kernel  tcp_write_timer+0x0/0x200 [kernel]                     2933662         3
kernel  cfq_idle_slice_timer+0x0/0x100 [kernel]                2037998         3
work_q  flush_to_ldisc                                         3017627         3
kernel  dev_watchdog+0x0/0x280 [kernel]                        5000425         2
process bdi-default(29)                                        5000211         2
process ips-adjust(892)                                        5000047         2
kernel  sync_supers_timer_fn+0x0/0x20 [kernel]                 6000000         2
kernel  inet_twdr_hangman+0x0/0xd0 [kernel]                    7499776         1
process kslowd000(157)                                            1126         1
process flush-253:0(1336)                                      4999981         1
work_q  do_cache_clean                                            4875         1
process flush-253:4(11335)                                     5000013         1

The first column is the type of queue that the task periodically run and can be a process, a kernel, or a work_q. A process entry is a user-space process with the second column listing the process name and the associated PID. A kernel entry is a kernel function scheduled to run with the second column listing the function and module name. A work_q entry is also a function in kernel-space, but it runs in a process context and is able to sleep. The period(us) column lists the measured period in microseconds between starts of the task. Variation in the time measurements may cause a timer interval of 10000 (1 millisecond) to be off, for example 9999 microseconds. The data is collated by the kernel timer data structure. A timer data structure may be initialized for each processor. Thus, for a periodic task running on all processrs of a four processor machine there would be four entries in the periodic.stp output (as seen for do_dbs_timer above). The last column is the count which indicates the number of times that the function or process ran.

The SystemTap runtime needs to do some regular runtime adjustment to keep the time measurements accurate because the processor can change the clock speed. Every microsecond there the SystemTap task is running on each of the four processors of the machine. Those are the first four entries associated with the stap_eb782113d30627ea6aa3ef949 kernel module.

The periodic.stp script makes clear the tasks the kernel is regularly performing. The do_dbs_timer is part of the kernel code that adjust the processor clock frequency. It is running every 10 milliseconds (9999 microseconds) to determine whether the processor clock speed needs to be adjusted. The vmstat_update function is running once a second keep track of the virtual memory of system. The cache_reap runs every two seconds to reclaim memory being used to cache files.

Determine what tasks are periodically taking processor time相关推荐

  1. pyspider architecture--官方文档

    原文地址:http://docs.pyspider.org/en/latest/Architecture/ Architecture This document describes the reaso ...

  2. Linux/Documentations: Kernel Livepatching

    Linux/Document: Livepatch_RToax-CSDN博客Livepatch - The Linux Kernel documentationhttps://www.kernel.o ...

  3. Linux/Document: Livepatch

    Livepatch - The Linux Kernel documentationhttps://www.kernel.org/doc/html/latest/livepatch/livepatch ...

  4. Linux开机启动过程(14):start_kernel()->sched_init()调度器初始化

    Kernel initialization. Part 8. 在原文的基础上添加了5.10.13部分的源码解读. Scheduler initialization This is the eighth ...

  5. 判断当前Windows XP操作系统是32位还是64位的方法

    昨天在调查怎样区分Windows XP32位和64位的问题,在网上找了一下,大家常用的有两种方法. 方法一.通过指针来判断. 在32位操作系统上指针长是4个字节,而在64位系统上指针为8个字节. 方法 ...

  6. AES加密解密算法的C代码实现

     AES 加密解密的原理我就不说了, 弟兄们自己上百度去查, 文章很多. 我这里只列出从网上获取的代码的实现, 我修改了一些, 可以很方便的使用到你的代码里面. AES 比DES算法的强度更强.A ...

  7. 【算法学习】贪心算法

    参考算导第三版第16章 贪心算法 文章目录 1. 活动选择问题 1.1 活动选择问题的最优子结构 1.2 贪心选择 1.3 递归贪心算法 1.4 迭代贪心算法 2. 贪心算法原理 2.1 贪心选择性质 ...

  8. k8s部署问题集锦(一) kubelet 启动报错failed to run Kubelet unable to determine runtime

    背景 在 CentOS 7.9 上使用二进制包部署 Kubernetes v1.24.1 集群,kubelet 使用 Containerd 作为 container runtime.启动kubelet ...

  9. locust===官方说明文档,关于tasks

    安装: >>> pip  install locust locust在官方simple_code中如下: from locust import HttpLocust, TaskSet ...

最新文章

  1. Wiew 像写 Android UI 一样写小游戏布局
  2. STM32 基础系列教程 42 - SDMMC+Fatfs
  3. Linux下ps -ef和ps aux的区别
  4. java 并发编程实例_Java并发编程案例解读
  5. matlab绘制蜂窝,PPT技巧:如何快速设计蜂窝表达的图形设计?
  6. Q1:spring-boot中Controller路径无法被访问的问题
  7. 发起图片请求的几种可能性(webkit内核)
  8. 键盘指示灯亮着 按键全部失效了怎么办
  9. 星空主题设计理念_「案例赏析」深邃星空理念:鲜为人知的独特标识设计
  10. 超像素学习笔记(1)——概念及判别条件
  11. IV-18(前苏联ИВ-18)荧光管电子钟【Energy Pillar.能量柱】
  12. 我的世界服务器一直没信号,我的世界:6年前突发的MC诡异事件,至今官方也说不出原因!...
  13. Jdbc结果集Map映射
  14. 软件工程(C编码实践篇)学习总结
  15. 开发手机蓝牙硬件APP如何实现蓝牙自动重连机制
  16. Ardunio开发实例-BMM150数字地磁传感器
  17. java.io.IOException: java.io.FileNotFoundException: C:\Users\26904\AppData 找不到指定的路径,自动跑到C盘里找,太离谱了。
  18. word目录生成与页码处理
  19. [Android]自定义绘制一个简易的音频条形图,附上对MP3音频波形数据的采集与展现
  20. 计算前缀表达式与后缀表达式

热门文章

  1. 论坛如何才能摆脱盈利之困?
  2. [虚幻引擎][UE5]获取当前系统的时间
  3. 重磅音视频开发资料库!!!
  4. mysql不同连接的事务_mysql中不同事务隔离级别下数据的显示效果--转载
  5. 龙芯服务器支持安卓吗,国产软硬件打通!龙芯3B4000适配UOS系统、浪潮云海OS云平台...
  6. 坚果手机c语言编程软件,PAT-B1018-锤子剪刀布(C语言实现)
  7. CSS——CSS滑动门及其应用(制作微信导航栏) ※
  8. 数字电位器TPL0102 使用方法
  9. 通过毒霸锁定/解锁IE浏览器主页
  10. vue学习 32路由精讲之二级路由和三级路由