Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Which tasks are periodically taking processor time?

April 3, 2014
William Cohen
Related topics:
Linux
Related products:
Red Hat Enterprise Linux

Share:

    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 minutes*60 seconds*1,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 script will collect data until cntrl-c is pressed. Below is an example run of periodic.stp:

    $ /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 runs 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 are 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 processors 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 adjusts 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.

    If you're new to SystemTap, see my previous article Starting with SystemTap.

    Last updated: January 10, 2023

    Recent Posts

    • More Essential AI tutorials for Node.js Developers

    • How to run a fraud detection AI model on RHEL CVMs

    • How we use software provenance at Red Hat

    • Alternatives to creating bootc images from scratch

    • How to update OpenStack Services on OpenShift

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue