代码性能分析工具

本文介绍了在Linux系统中进行代码性能分析的两种工具——perf和gperf。perf工具能够深入到驱动内部进行分析,详细参考链接。而gperf是Google提供的工具,依赖libunwind库,用于性能分析。另外,还提到了valgrind工具,通过特定脚本编译后,能有效发现内存泄漏问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用perf工具分析性能

 

可分析到驱动内部。请参考   https://blog.youkuaiyun.com/u014608280/article/details/80265718

 

使用gperf工具分析性能

 

这是Google工具  依赖于libunwind。需要先编译libunwind

#!/bin/bash
set -x

pushd libunwind-1.3.1

./configure --host=aarch64-linux-gnu --build=aarch64 --disable-static CFLAGS=-U_FORTRIFY_SOURCE --prefix=/my/install
if [ $? -ne 0 ]; then
    echo "configure failed"
    popd
    exit -1
fi

make -j4
if [ $? -ne 0 ]; then
    echo "make failed"
    popd
    exit -1
fi

make install
if [ $? -ne 0 ]; then
    echo "install failed"
    popd
    exit -1
fi

make clean

popd

再安装gperf

#!/bin/bash
set -x

pushd gperftools-2.7

install_path='/my/install'
./configure --host=aarch64-lin
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值