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

What are the BPF tools for CPU analysis?

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

For the BPF tools available for CPU analysis, see these commands annotated in the following figure

Some of the tools in the table below belong to BCC or bpftrace, or were created for this book. Some tools appear in both BCC and bpftrace. The following table shows the sources of the tools described in this section (BT is an abbreviation for bpftrace.)

Tool

Tool name

Source

Source

Target

Efficacy / goal

Description

Description

Execsnoop

BCC/BT

Sched

Lists new process execution

List the execution of the new process

Exitsnoop

BCC

Sched

Shows process lifespan and exit reason

Show process lifespan and exit reason

Runqlat

BCC/BT

Sched

Summarizes CPU run queue latency

Summary of CPU runtime queue latency

Runqlen

BCC/BT

Sched

Summarizes CPU run queue length

Summary CPU run queue length

Runqslower

BCC

Sched

Prints run queue waits slower than a threshold

Print run queues with wait times slower than the threshold (in us)

Cpudist

BCC

Sched

Summarizes on-CPU time

Summarize the time of the on-CPU

Cpufreq

Book

CPUs

Samples CPU frequency by process

Sampling CPU frequency by process

Profile

BCC

CPUs

Samples CPU stack traces

Sampled CPU stack trace

Offcputime

BCC/book

Sched

Summarizes off-CPU stack traces and times

Summarize off-CPU stack trace and time

Syscount

BCC/BT

Syscalls

Counts system calls by type and process

Statistics of syscall system calls by type and procedure

Argdist

BCC

Syscalls

Can be used for syscall analysis

Can be used for system call analysis

Trace

BCC

Syscalls

Can be used for syscall analysis

Can be used for system call analysis

Funccount

BCC

Software

Counts function calls

Calculate function call

Softirqs

BCC

Interrupts

Summarizes soft interrupt time

Summary soft interrupt time

Hardirqs

BCC

Interrupts

Summarizes hard interrupt time

Summary hard outage time

Smpcalls

Book

Kernel

Times SMP remote CPU calls

Count the time of SMP remote CPU calls

Llcstat

BCC

PMCs

Summarizes LLC hit ratio by process

Summarize LLC hit rates by process

Execsnoop

Trace the new process through the exec () syscall system call.

You can find problems with short processes that consume CPU resources, and can also be used to debug the execution of software, including application startup scripts.

This tool captures the moment when a user logs in to the system using SSH and starts processes including sshd, groups, and mesg. It also shows the process from the system activity logger sar, including writing metrics to its log, including sa1 and sadc.

We can use execsnoop to find high-speed short-term processes that consume resources, which can usually be short and difficult to find through things like top, but it's easy to find it with execsnoop.

Execsnoop has been used to debug many production problems, such as interference from background jobs, slow or failed application startup, slow or failed container startup, and so on.

How execsnoop works:

Trace the execve system call (the commonly used exec (2) variant) and display the details of the execve (2) parameter and return value. This will capture new processes that follow the order of fork (2) / clone (2)-> exec (2), as well as processes of re-exec (2).

There is a special case: some applications create new processes without calling exec (2), for example, when creating a worker process pool using fork (2) or separate clones (2). Because they do not call execve (2), these are not included in the execsnoop output. This should be unusual: the application should create a worker thread pool, not a process. [example: execsnoop cannot fetch other commands that we execute after we log in to redis-cli]

Because the process execution rate is expected to be relatively low

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

Servers

Wechat

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

12
Report