when using gprof:
$ gprof options [executable-file [profile-data-files...]] [> outfile]
if you have options to pass to the executable like:
gprof a.out --varfred=32
then gprof assumes that I am passing an invalid option to it, instead of to the program being profiled (a.out
).
Any way to get around this?
Gprof works by automatically instrumenting your code during compilation, and then sampling the application's program counter during execution. Sampling data is saved in a file, typically named gmon. out, which can then be read by the gprof command.
gprof is a type of tool called a profiler. Profiling allows you to learn where your program spent its time and which functions called which other functions while it was executing.
gprof is the tool that reads a gmon. out file and displays information from it.
Just to double check, mingw32-make should be under the bin folder. Compile the file with gcc. The '-pg' will enable profiling. Run the program The profiling data will be written to a file called 'gmon.
You don't run your executable with gprof, so you only specify it so gprof can load symbols. You run the executable first, on its own just as normal, and it then emits profiling data.
This data is loaded, along with the executable, by gprof later.
This is all explained in the gprof manual, of course.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With