How to compare several Gprof profiler reports?

2019-08-31 06:23发布

问题:

In multiple run of my C program with different parameter values, I get multiple profiling report files. This is too difficult to read and compare.

Is there a way I can get a comparison file, preferably with graphs to show , how the performance increased or decreased as the size (the parameter that i am passing at the run time ) is increased.

回答1:

Try perf(1) tool.

perf record ./yourbinary
perf record ./yourbinary-v2
perf diff

Having compiler options "-O0 -g -ggdb" around when making binaries is will often help when trying to understand why this vs that version have performance difference.