Posted on 2007-10-06
Medium Priority
Last Modified: 2010-04-15

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
Question by:zizi21
LVL 85

Accepted Solution

ozo earned 1500 total points
ID: 20029324

Author Comment

ID: 20029879

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
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
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..

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question