Posted on 2007-10-06
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 84

    Accepted Solution


    Author Comment


    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

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    jquery/ajax to code behind 7 151
    C++ vs C compilers 13 152
    Detect CR LF to each line 12 117
    Grammars for C C++ and java 1 99
    An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
    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 structures in the C programming language.
    The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

    732 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

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now