[Ilugc] Profiling a C program.

  • From: techie2go@xxxxxxxxx (Gowthaman Basuvaraj)
  • Date: Thu Mar 13 08:34:08 2008

Hello
from what i understand, gprof is not just about timing.. its just one aspect
of it... its more about how many times a function is called and from where
is is called..[call graphs], its very useful in analysing and verifying your
program
for complete reference
The GNU Profiler by Jay Fenlason and Richard  Stallman (
http://www.cs.utah.edu/dept/old/texinfo/as/gprof_toc.html)
Gowthaman B
PS: you can run gprof with -b option it skips all the explanation...

On Thu, Mar 13, 2008 at 7:51 AM, Girish Venkatachalam <
girishvenkatachalam@xxxxxxxxx> wrote:

On 00:00:40 Mar 13, Logu wrote:
I am trying to profile a simple C program, but I am not getting correct
values under the  "cumulative seconds"  and "self seconds" column for
the
functions. I always get them as 0.00.

I compiled and linked the program with -pg option. But when I run the
gprof
I only get this output

 %   cumulative   self         self     total
time   seconds   seconds    calls   Ts/call  Ts/call  name
 0.00      0.00     0.00        5        0.00     0.00    pmesg

Could someone point me what I am missing here. I need to find the time
spent on each function calls.


I barely remember using gprof.

I have found the simple shell command time(1) to be far more easier to
use and helpful.

I remember gprof reporting huge amounts of data. How did you get just
one line?

There are plenty of profiling/monitoring tools in linux.

Why don't you try the other ones?

lsof(1), fstat(1) and so on.

I think you can simply

$ time ./a.out

for your immediate need.

As to why gprof results weird results, the answer might be far deeper
than what meets the eye.

As someone suggested you can try a few iterations.

-Girish
_______________________________________________
To unsubscribe, email ilugc-request@xxxxxxxxxxxxx with
"unsubscribe <password> <address>"
in the subject or body of the message.
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc




-- 
A samurai once asked Zen Master Hakuin where he would go after he died.
Hakuin answered 'How am I supposed to know?'
'How do you not know? You're a Zen master!' exclaimed the samurai.
'Yes, but not a dead one,' Hakuin answered.

-- Zen proverbs
??????????? ????????????
??????????? ???? ???????
????? ????? ???? ???????
??????? ??????? ??? ???????
??????? ??????? ???????? ????? ?????
-- ?????? ?????? ?????????

Other related posts: