分析说明 [英] Profiling instructions

查看:64
本文介绍了分析说明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的代码中计算几个 cpu 指令.例如我想知道我的代码执行了多少加法、多少乘法、多少浮点运算、多少分支.我目前在 Linux 下使用 gprof 来分析我的 c++ 代码,但它只给出了对我的函数的调用次数,我手动估计了指令的数量.有什么工具可以帮我解决问题吗?也许是一些虚拟机?

I want to count several cpu instructions in my code. e.g. I would like to know how many additions, how many multiplications, how many float operations, how many branches my code executes. I currently use gprof under Linux for profiling my c++ code but it only gives the number of calls to my functions, and I manually estimate the number of instructions. Are there any tools that might do the trick for me? Maybe some virtual machine?

推荐答案

您可以使用 Valgrind's Callgrind--dump-instr=yes标志来实现这一点

You may be able to use Valgrind's Callgrind with the --dump-instr=yes flag to achieve this

这篇关于分析说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆