Weird output from Gprof

This is a discussion on Weird output from Gprof within the C Programming forums, part of the General Programming Boards category; Hi, My program's Gprof output is a little weird! Code: Call graph (explanation follows) granularity: each sample hit covers 4 ...

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    11

    Weird output from Gprof

    Hi,
    My program's Gprof output is a little weird!

    Code:
    Call graph (explanation follows)
    
    
    granularity: each sample hit covers 4 byte(s) for 50.00% of 0.02 seconds
    
    index % time    self  children    called     name
                    0.01    0.01      10/10          main [2]
    [1]    100.0    0.01    0.01      10         route_aggregation_main [1]
                    0.00    0.01      10/10          route_to_file [4]
                    0.00    0.00      10/10          access_file_insert_data [19]
                    0.00    0.00      10/10          route_processing [25]
                    0.00    0.00      10/10          route_aggregate [24]
                    0.00    0.00      10/10          display [22]
    -----------------------------------------------
                                                     <spontaneous>
    [2]    100.0    0.00    0.02                 main [2]
                    0.01    0.01      10/10          route_aggregation_main [1]
                    0.00    0.00      10/10          append_to_file [20]
                    0.00    0.00      10/10          map_notify_packet_initialization [23]
                    0.00    0.00       1/1           recved_map_register_packet_initialization [32]
    -----------------------------------------------
                    0.01    0.00      10/10          route_to_file [4]
    [3]     50.0    0.01    0.00      10         delegation_aggregation_main [3]
                    0.00    0.00      20/20          is_virtual_ip [16]
                    0.00    0.00      10/10          Delegation_select_query [18]
    -----------------------------------------------
                    0.00    0.01      10/10          route_aggregation_main [1]
    [4]     50.0    0.00    0.01      10         route_to_file [4]
                    0.01    0.00      10/10          delegation_aggregation_main [3]
                    0.00    0.00      10/10          db_access_main [21]
                    0.00    0.00      10/10          vtysh_input [28]
    -----------------------------------------------
    Now, as far as I know, "%time" column shows the percentage of the `total' time that was spent in this function and its children. Then how can both index 1 and 2 show 100. What does this mean? Note that, this profile has 32 indexes. I have omitted those because they show 0 in their %time column.

    Bye.

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,279
    GNU gprof - Interpreting gprof's Output

    Perhaps you're not quite understanding what the call graph shows. It's the time of that function plus all it's children. I would guess that main calls route_aggregation_main and does little or nothing else. Thus you're seeing 100% of your time in main, and a number so close to 100% in route_aggregation_main that gprof just displays 100%.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. weird stack output
    By vidioholic in forum C Programming
    Replies: 27
    Last Post: 10-22-2008, 03:43 PM
  2. weird output
    By kantze in forum C++ Programming
    Replies: 2
    Last Post: 12-16-2006, 11:05 AM
  3. my output is weird
    By panfilero in forum C Programming
    Replies: 1
    Last Post: 11-10-2005, 01:11 PM
  4. getopt() and weird output
    By kristy in forum C Programming
    Replies: 2
    Last Post: 06-28-2003, 04:39 PM
  5. weird output using cos
    By Jan79 in forum C++ Programming
    Replies: 1
    Last Post: 06-23-2003, 07:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21