T
takashi
Hi, I am having trouble, using 'gnu profiler'. The problem is when I type:
gprof executable_name
I don't get any accumulated time for the execution of the program. The
detail of what I have done is the following.
1) I created a program named "prac2.cpp". Prac2.cpp is the following.
#include<iostream>
using namespace std;
int main(){
float a;
cout << "please input the number\t";
cin >> a;
cout << " \n the number you input is\t " << a << "\n";
return 0;
}
2) I compiled the program using
g++ prac2.cpp -o prac2 -g -pg
3) I run the program by typing
prac2
4) Then I typed
grof prac2
Then I got the message that
Flat profile:
Each sample counts as 0.01 seconds.
no time accumulated
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
0.00 0.00 0.00 1 0.00 0.00 _GLOBAL__I_main
0.00 0.00 0.00 1 0.00 0.00
__static_initialization_and_destruction_0(int, int)
% the percentage of the total running time of the
time program used by this function.
cumulative a running sum of the number of seconds accounted
seconds for by this function and those listed above it.
self the number of seconds accounted for by this
seconds function alone. This is the major sort for this
listing.
calls the 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.
Could anybody tell me what I should do?
Thank you very much, and have a good day.
gprof executable_name
I don't get any accumulated time for the execution of the program. The
detail of what I have done is the following.
1) I created a program named "prac2.cpp". Prac2.cpp is the following.
#include<iostream>
using namespace std;
int main(){
float a;
cout << "please input the number\t";
cin >> a;
cout << " \n the number you input is\t " << a << "\n";
return 0;
}
2) I compiled the program using
g++ prac2.cpp -o prac2 -g -pg
3) I run the program by typing
prac2
4) Then I typed
grof prac2
Then I got the message that
Flat profile:
Each sample counts as 0.01 seconds.
no time accumulated
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
0.00 0.00 0.00 1 0.00 0.00 _GLOBAL__I_main
0.00 0.00 0.00 1 0.00 0.00
__static_initialization_and_destruction_0(int, int)
% the percentage of the total running time of the
time program used by this function.
cumulative a running sum of the number of seconds accounted
seconds for by this function and those listed above it.
self the number of seconds accounted for by this
seconds function alone. This is the major sort for this
listing.
calls the 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.
Could anybody tell me what I should do?
Thank you very much, and have a good day.