[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

RE: [LI] function/instruction taking more time??



Let me remind you here, gprof is a graphical profiling. It can
be used generating graphs of execution times. Each profiler uses different
algorithms. The exact option you use is -pg for gprof and -p for prof. In
gprof The profile data is taken from the call graph profile file
(gmon.out). Let me quote the man page for you guys

" 	  Gprof calculates the amount of time spent in each routine.
          Next, these times are propagated along the edges of the call
          graph.  Cycles are discovered, and calls into a cycle are
          made to share the time of the cycle.  The first listing
          shows the functions sorted according to the time they
          represent including the time of their call graph
          descendents.  Below each function entry is shown its
          (direct) call graph children, and how their times are
          propagated to this function.  A similar display above the
          function shows how this function's time and the time of its
          descendents is propagated to its (direct) call graph
          parents.

          Cycles are also shown, with an entry for the cycle as a
          whole and a listing of the members of the cycle and their
          contributions to the time and call counts of the cycle.

          Second, a flat profile is given, similar to that provided by
          prof(1).  This listing gives the total execution times, the
          call counts, the time in milleseconds the call spent in the
          routine itself, and the time in milleseconds the call spent
          in the routine itself including its descendents.
	  Finally, an index of the function names is provided
"

These profiling algorithms are still not very accurate and do not account
for the time spent in/by the c library or any lib for that matter. Thats
why Linux has the glibc with profiling turned on as an add on feature.

There are some good papers on ACM, if your interested.

Regards,
Balbir Singh.





On Mon, 4 Oct 1999, Vikram K wrote:

> that's what profiling is exactly for. 'gprof' is meant for this purpose.
> while compiling your code with gcc, you specify some option (-g, i think,
> but i'm not sure. you can do a 'man gcc'). this generates a file called
> gmon.out. then you run 'gprof' and you can get a profile of your program.
> but still i'm not sure if you can get the exact time info.
> 
> vikram
> 
> -----Original Message-----
> From: Guruprasad, Mahendrakar V (IE10)
> [mailto:GuruprasadM@xxxxxxxxxxxxxxxxxxxxxxxxxxxx]
> Sent: Monday, October 04, 1999 12:09 PM
> To: Linux User Group
> Subject: [LI] function/instruction taking more time??
> 
> 
> Hi,
> 	Is there anyway to find out which function/instruction is consuming
> more time?
> 	If yes , how much time (Millisec/microsec) its taking?? 
> regards
> 
> GURUPRASAD V.M.
> Honeywell India Software Operations
> 
> 
> 
> 
> --------------------------------------------------------------------
> For more information on Linux in India visit http://www.linux-india.org/
> The Linux India mailing list does not accept postings in HTML format.
> --------------------------------------------------------------------
> For more information on Linux in India visit http://www.linux-india.org/
> The Linux India mailing list does not accept postings in HTML format.
> 

--------------------------------------------------------------------
For more information on Linux in India visit http://www.linux-india.org/
The Linux India mailing list does not accept postings in HTML format.