Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to parse the swapper process in perf report

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Today, the editor will show you how to analyze the swapper process in the perf report. The knowledge points in the article are introduced in great detail. Friends who feel helpful can browse the content of the article with the editor, hoping to help more friends who want to solve this problem find the answer to the problem. Follow the editor to learn more about "how to analyze the swapper process in the perf report".

In-depth understanding of the swapper process in the perf report I. preface

1. When perf monitors the system calls of processes, a large number of swapper processes will appear.

2. The official description of the process is that swapper will be executed when no other tasks are running on the CPU. In other words, swapper means that CPU didn't do anything and went to rest.

3. Let's take a look at the performance of swapper on cpu

Second, the environment preparation component version OSUbuntu 16.04.4 LTSsystemtapversion 4.2 LTSsystemtapversion 0.165, commit release-4.1-41-g9cde541d4464 III, prepare the script

To present our powerful tool systemtap, it is important to note that there are some differences between the versions of systemtap.

Root@wilson-ubuntu:/opt/stap# stap-VSystemtap translator/driver (version 4.2 Red Hat 0.165, commit release-4.1-41-g9cde541d4464) Copyright (C) 2005-2019 Red Hat, Inc. And othersThis is free software; see the source for copying conditions.tested kernel versions: 2.6.18... 5.1-rc2enabled features: PYTHON3 NLS

Once you have decided on the version, write a script that mainly uses probe::scheduler.cpu_off, https://sourceware.org/systemtap/tapsets/API-scheduler-cpu-off.html

The script is as follows:

Probe scheduler.cpu_off {printf ("% 20s (% 5d)% 5s% 20s (% 5d), is idle:%d\ n", task_execname (task_prev), task_pid (task_prev), "= = >", task_execname (task_next), task_pid (task_next), idle)}

The script is very simple, and scheduler.cpu_off mainly describes the state of the process leaving the CPU:

Task_prev: the process that is leaving CPU

Task_next: about to enter the process of CPU

Whether idle:cpu is idle or not is the focus of our attention. If idle is 1, it proves that CPU is not running the task.

Run the script

Due to the large amount of data, we sift through some of them:

Root@wilson-ubuntu:/opt/stap# stap switch.stp... Swapper/0 (0) = > stapio (29159), is idle:1 stapio (29159) = > swapper/0 (0), is idle:0 swapper/0 (0) = > rcu_sched (7), is idle:1 rcu_sched (7) = = > swapper/0 (0) Is idle:0 swapper/2 (0) = > irq/31-iwlwifi (542), is idle:1 irq/31-iwlwifi (542) = > swapper/2 (0), is idle:0 swapper/2 (0) = > irq/31-iwlwifi (542), is idle:1 irq/31-iwlwifi (542) = = > swapper/2 (0) Is idle:0 swapper/2 (0) = > irq/31-iwlwifi (542), is idle:1 irq/31-iwlwifi (542) = > swapper/2 (0), is idle:0 swapper/2 (0) = > irq/31-iwlwifi (542), is idle:1 irq/31-iwlwifi (542) = = > swapper/2 (0) Is idle:0 swapper/0 (0) = > rcu_sched (7), is idle:1 rcu_sched (7) = > swapper/0 (0), is idle:0 swapper/2 (0) = > irq/31-iwlwifi (542) Is idle:1 irq/31-iwlwifi (542) = > swapper/2 (0), is idle:0 swapper/2 (0) = > irq/31-iwlwifi (542), is idle:1 irq/31-iwlwifi (542) = = > swapper/2 (0) Is idle:0 swapper/0 (0) = > rcu_sched (7), is idle:1 swapper/1 (0) = > stapio (29159), is idle:1...

1. Because it is a 4-core cpu, there are 4 swapper,swapper/n

2. The process number of swapper is 0. The init process is created during system initialization, and then it becomes a lowest priority idle task.

3. When swapper appears on the left (the process that is about to leave cpu), the last field idle is 1, which proves that the swapper process running on cpu (CPU has gone idle)

4. It is verified that when cpu runs the swapper process, cpu is actually in an idle state, and there is no real task running on it, which is in the idle state.

Thank you for your reading. The above is the whole content of "how to analyze the swapper process in the perf report". Friends who learn it, hurry up and do it. I believe that the editor will certainly bring you better quality articles. Thank you for your support to the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report