Linux内核之tracepoint介绍

概述

Tracepoint 是一种在 Linux 内核中插入的静态探测点,用于跟踪和调试内核行为。它允许开发者在特定位置插入代码,收集运行时信息,而不会显著影响性能。

原理

特性

  • 静态探测点: 在内核预定义, 自定义的函数可以插入在这里
  • 动态启用: 默认不启用, 减少性能开销
  • 低开销
阅读更多

性能优化工具-perf

概述

perf 是一个强大的 Linux 性能分析工具,它可以用来收集和分析性能数据。

perf的命令有很多,下文将就其中常用的几条进行阐述


usage: perf [--version] [--help] [OPTIONS] COMMAND [ARGS]

The most commonly used perf commands are:
annotate Read perf.data (created by perf record) and display annotated code
archive Create archive with object files with build-ids found in perf.data file
bench General framework for benchmark suites
buildid-cache Manage build-id cache.
buildid-list List the buildids in a perf.data file
c2c Shared Data C2C/HITM Analyzer.
config Get and set variables in a configuration file.
daemon Run record sessions on background
data Data file related processing
diff Read perf.data files and display the differential profile
evlist List the event names in a perf.data file
ftrace simple wrapper for kernel's ftrace functionality
inject Filter to augment the events stream with additional information
iostat Show I/O performance metrics
kallsyms Searches running kernel for symbols
kvm Tool to trace/measure kvm guest os
list List all symbolic event types
mem Profile memory accesses
record Run a command and record its profile into perf.data
report Read perf.data (created by perf record) and display the profile
script Read perf.data (created by perf record) and display trace output
stat Run a command and gather performance counter statistics
test Runs sanity tests.
top System profiling tool.
version display the version of perf binary
probe Define new dynamic tracepoints
trace strace inspired tool
kmem Tool to trace/measure kernel memory properties
kwork Tool to trace/measure kernel work properties (latencies)
lock Analyze lock events
sched Tool to trace/measure scheduler properties (latencies)
timechart Tool to visualize total system behavior during a workload

See 'perf help COMMAND' for more information on a specific command.

安装

阅读更多