低负载性能采集库

功能简介

libkperf是一个轻量级linux性能采集库,它能够让开发者以API的方式执行性能采集,包括pmu采样和符号解析。libkperf把采集数据内存化,使开发者能够在内存中直接处理采集数据,避免了读写perf.data带来的开销。

环境要求

支持的CPU架构:鲲鹏

支持的OS:
  • openEuler
  • OpenCloudOS
  • TencentOS
  • KylinOS
  • CentOS

编译要求

如果编译报错提示没有numa.h文件,需要先安装对应的numactl-devel包。

如果编译链接在Found PythonInterp报CMake错误,需要先安装所需的python3-devel包。

编译生成动态库和C的API:

git clone --recurse-submodules https://gitee.com/openeuler/libkperf.git 
cd libkperf 
bash build.sh install_path=/path/to/install

如果想要编译调试版本:

bash build.sh install_path=/path/to/install buildType=debug 

如果想要编译Python包:

bash build.sh install_path=/path/to/install python=true 

安装后若需要卸载Python库,可以执行以下命令:

python3 -m pip uninstall -y libkperf 

文档