OpenHarmony性能分析工具之hiperf 原创 精华
民之码农
 发布于 2022-3-17 17:32
 浏览
 6收藏
@[toc](hiperf
一、hiperf使用
代码位置 https://gitee.com/openharmony/developtools_hiperf
1.主命令参数
| 参数 | 功能说明 | 
|---|---|
| –help [command] | 显示指定功能的帮助信息 | 
| –debug | 打开 DEBUG 级别的调试日志 | 
| –verbose | 打开 VERBOSE 级别的调试日志 | 
| –much | 打开 MUCH 级别的调试日志 | 
| –mixlog | 混合调试日志输出到屏幕上(stdout) | 
| –logtag <tagA [,tagB] [,tagC]> | 打开指定模块的MUCH级别的调试日志 | 
| –hilog | 日志打印到Hilog中 | 
| –logpath | 指定日志保存的路径 | 
| –nodebug | 停止打印任何日志 | 
2.list 命令
列出设备上支持的所有事件名称
事件名称用于 stat 和 record 的 -e 和 -g 参数
Usage: hiperf list [event type name]
下面列出了设备支持的HW事件,并且会提示哪些事件此设备不支持
./hiperf list hw
3.stat 命令
监听指定目标程序,周期性打印性能计数器的值
Usage: hiperf stat [options] [command [command-args]]
       Collect performance counter information of running [command].
下面展示了一个 stats 监听本进程 在 CPU 0 上 3 秒的性能计数器命令
 ./hiperf stat -d 3 -c 0
4.record 命令
采样指定目标程序,并且将采样数据保存到指定的文件中(默认为perf.data)
Usage: hiperf record [options] [command [command-args]]
       Collect performance sampling information of running [command].
对全系统所有进程采样3秒,并且显示详细的信息
./hiperf record -d 3 -a --verbose
二、hiperf使用示例
1.hiperf命令
hiperf record -d 10 -a 
默认生成perf.data文件路径:
/data/local/tmp
2.hdc导出perf.data文件
hdc file recv /data/local/tmp/perf.data  %cd%
3.生成符号表
1>将lib库:
Z:\OpenHarmony\master\out\rk3568\mingw_x86_64\developtools\hiperf
libhiperf_report.dll
libhiperf_report.lib
拷贝到脚本recv_binary_cache.py的当前目录的bin\windows\x86_64目录下
2> 将hdc_std.exe文件添加到PATH路径下
3>板子连接电脑,hdc_std shell可以正常使用
4> perf.data文件在 recv_binary_cache.py脚本的目录下
5>收集perf.data 里面记录的相关文件和库的符号表
python recv_binary_cache.py -l Z:\OpenHarmony\master\out\rk3568\lib.unstripped  Z:\OpenHarmony\master\out\rk3568\exe.unstripped
路径根据实际使用修改
4.生成html文件
产生HTML文件,默认的文件名是 hiperf_report.html
python make_report.py
5.html文件
Chart Statistics界面

Sample Table界面

Flame Graph界面

©著作权归作者所有,如需转载,请注明出处,否则将追究法律责任
    已于2022-3-23 14:21:00修改
 
        赞
        10
 
        收藏 6
      
 回复
  相关推荐
 




















666