Tutorial :gprof and arguments to executable



Question:

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?


Solution:1

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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »