473,386 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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.


Jul 19 '05 #1
1 4962
In alt.comp.lang.learn.c-c++ takashi <tw******@telus.net> wrote:
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'
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Andrew Bonello | last post by:
Hi I have written a C++ program (Redhat Linux 7.2, gcc v2.96). The program makes a sequence of calls to rand() after having seeded the random number generator using srand( 0 ). Under normal...
0
by: Gumby | last post by:
Is gprof on Solaris 9 X86 not as supported as Solaris 9 Sparc? At work when we try to compile a program with -pg to use gprof to performance profile our software, the compiled app just dies...
0
by: Dave | last post by:
Hello, I would like to profile a Python program using gprof. I already rebuilt Python with CC="gcc -pg" ../configure. So, I should be able to use gprof. How do I do that? Should I first run...
2
by: AlvaroMako | last post by:
Hello: I am using g++, on linux, and i am trying profile out my program but I have problems with the calls to the symbols that are in shared library, does not leave anything these symbols. ...
3
by: Yan Yang | last post by:
Hi, I have a program and I want to test its execution time. When I run the program, I can feel it runs about 4 mins, but the gprof only says the accumlated time is 7.2 secs. Then I use the...
1
by: Pasacco | last post by:
dear I need to know the execution time of the program. Below is just an example. I used to use gprof. But in this case, the error messsage says "gprof : gmon.out file is missing call-graph...
2
by: =?iso-8859-1?q?Nicolas_Herv=E9?= | last post by:
I am using gprof, and as explain in http://www.gnu.org/software/binutils/manual/gprof-2.9.1/html_node/gprof_18.html#SEC18 I could use the "-g -pg -a" options of gcc and then use the "-l -A"...
1
by: npd | last post by:
hi all , i want to find out how accurate is the result of gprof ? i want to find the optimized version of my program takes how much time and unoptimized takes how mch? i have tried gettimeofday(),...
1
by: Congcong | last post by:
When I use gprof to profile a program, it seems never show me the profile info on c lib routines such as malloc. But sometimes, profile info on such c lib routines are also important. I use 'gcc -g...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.