how I can use 'gprof'. I have got some problems.

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

=?iso-8859-1?Q?Andr=E9_P=F6nitz?=

In alt.comp.lang.learn.c-c++ takashi said:
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.

Usage looks ok. Have you tried it with a longer program containing a few
more functions?

Andre'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top