Search code examples
c++profilinginstructions

Profiling instructions


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?


Solution

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