We help IT Professionals succeed at work.

gprof

zizi21
zizi21 asked
on
212 Views
Last Modified: 2010-04-15
Hi,

I am running gprof for c program 10 times, is it any option to get average of output rather than couting one by one.thanks
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Hi,

It says :

ay is to combine the data from several runs, using the `-s' option of gprof. Here is how:


Run your program once.

Issue the command `mv gmon.out gmon.sum'.

Run your program again, the same as before.

Merge the new data in `gmon.out' into `gmon.sum' with this command:

gprof -s executable-file gmon.out gmon.sum

Repeat the last two steps as often as you wish.

Analyze the cumulative data using this command:

gprof executable-file gmon.sum > output-file


I a bit confuseing..

Is it like this?


>>>

Is it  gcc - ansi ..-pg file.c file.h
./a.out
gprof a.out

i get a gmon.out file..
i rename the file to gmon.sum

then, i rerun the program again
gcc -ansi..-pg file.c file.h
./a.out
gprof -s a.out gmon.out gmon.sum


each time i do gprof -s a.out gmon.out gmon.sum , i am actually appending data to gmon.sum...


then at the end , when i do like this : gprof a.out gmon.sum > output-file, i get average.

It is just that , when i open the file, i notice, i did not get average, it is adding the values...?pls help..

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.