Gcc Performance Testing Tool

Source: Internet
Author: User

1. gprof tests the time consumption of each function to identify performance bottlenecks

Debianerik :~ /Desktop # gcc-Wall-pg test. c
Debianerik :~ /Desktop # ls-l
Total 1883988
-Rwxr-xr-x 1 root 8737 a. out
-Rw-r -- 1 root 1267 test. c
Debianerik :~ /Desktop #./a. out
Debianerik :~ /Desktop # ls-l
Total 1883988
-Rwxr-xr-x 1 root 8737 a. out
-Rw-r -- 1 root 537 gmon. out
-Rw-r -- 1 root 1267 test. c
Debianerik :~ /Desktop # gprof a. out
Flat profile:

Each sample counts as 0.01 seconds.
% Cumulative self total
Time seconds CILS s/call name
87.05 2.42 2.42 1 2.42 2.42 cost4
4.68 2.55 0.13 1 0.13 0.13 cost3
4.32 2.67 0.12 1 0.12 0.12 cost1
3.96 2.78 0.11 1 0.11 0.11 cost2

% The percentage of the total running time of
Time program used by this function.

Cumulative a running sum of the number of seconds accounted
Seconds for by this function and those listed abve it.

Self the number of seconds accounted for by this
Seconds function alone. This is the major sort for this
Listing.

Callthe number of times this function was invoked, if
This function is profiled, else blank.

Self the average number of milliseconds spent in this
MS/call function per call, if this function is profiled,
Else blank.

Total the average number of milliseconds spent in this
MS/call function and its descendents per call, if this
Function is profiled, else blank.

Name the name of the function. This is the minor sort
For this listing. The index shows the location
The function in the gprof listing. If the index is
In parenthesis it shows where it wowould appear in
The gprof listing if it were to be printed.

Call graph (explanation follows)

Granularity: each sample hit covers 4 byte (s) for 0.36% of 2.78 seconds

Index % time self children called name
<Spontaneous>
[1] 100.0 0.00 2.78 main [1]
2.42 0.00 1/1 cost4 [2]
0.13 0.00 1/1 cost3 [3]
0.12 0.00 1/1 cost1 [4]
0.11 0.00 1/1 cost2 [5]
-----------------------------------------------
2.42 0.00 1/1 main [1]
[2] 87.1 2.42 0.00 1 cost4 [2]
-----------------------------------------------
0.13 0.00 1/1 main [1]
[3] 4.7 0.13 0.00 1 cost3 [3]
-----------------------------------------------
0.12 0.00 1/1 main [1]
[4] 4.3 0.12 0.00 1 cost1 [4]
-----------------------------------------------
0.11 0.00 1/1 main [1]
[5] 4.0 0.11 0.00 1 cost2 [5]
-----------------------------------------------

This table describes the call tree of the program, and was sorted
The total amount of time spent in each function and its children.

Each entry in this table consists of several lines. The line with
Index number at the left hand margin lists the current function.
The lines above it list the functions that called this function,
And the lines below it list the functions this one called.
This line lists:
Index A unique number given to each element of the table.
Index numbers are sorted numerically.
The index number is printed next to every function name so
It is easier to look up where the function in the table.

% Time This is the percentage of the 'total' time that was spent
In this function and its children. Note that due
Different viewpoints, functions excluded by options, etc,
These numbers will NOT add up to 100%.

Self This is the total amount of time spent in this function.

Children This is the total amount of time propagated into this
Function by its children.

Called This is the number of times the function was called.
If the function called itself recursively, the number
Only includes non-recursive cballs, and is followed
A' + 'and the number of recursive CILS.

Name The name of the current function. The index number is
Printed after it. If the function is a member of
Cycle, the cycle number is printed between
Function's name and the index number.

For the function's parents, the fields have the following meanings:

Self This is the amount of time that was propagated directly
From the function into this parent.

Children This is the amount of time that was propagated from
The function's children into this parent.

Called This is the number of times this parent called
Function '/'the total number of times the function
Was called. Recursive callto the function are not
Encoded in the number after '/'.

Name This is the name of the parent. The parent's index
Number is printed after it. If the parent is
Member of a cycle, the cycle number is printed
The name and the index number.

If the parents of the function cannot be determined, the word
'<Your taneous>' is printed in the 'name' field, and all the other
Fields are blank.

For the function's children, the fields have the following meanings:

Self This is the amount of time that was propagated directly
From the child into the function.

Children This is the amount of time that was propagated from
Child's children to the function.

Called This is the number of times the function called
This child '/'the total number of times the child
Was called. Recursive callby the child are not
Listed in the number after '/'.

Name This is the name of the child. The child's index
Number is printed after it. If the child is
Member of a cycle, the cycle number is printed
Between the name and the index number.

If there are any cycles (circles) in the call graph, there is
Entry for the cycle-as-a-whole. This entry shows who called
Cycle (as parents) and the members of the cycle (as children .)
The '+' recursive cballs entry shows the number of function CILS that
Were internal to the cycle, and the callentry for each member shows,
For that member, how many times it was called from other members
The cycle.

Index by function name

[4] cost1 [3] cost3
[5] cost2 [2] cost4
Debianerik :~ /Desktop #

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.