Re: [LIP] gprof problem
Linux India has been formed for Foster the growth of Linux in India
Brought to you by:
manojmishra,
raju
From: <arv...@ya...> - 2001-06-29 05:36:21
|
hi nabendu, i am not sure why, but, it worked for me. Attached: prog.c and profile info. Compile this with: cc -p prog.c -o prog execute this as : ./prog Profile it with : gprof prog > profinfo. ( you can use gprof -b prog > profinfo to get brief info) you'll get the profile info (attached at the end) My test program: prog.c #include <stdio.h> int main(void) { int i; void func1(); void func2(); for (i=0; i<3; i++) func1(); func2(); return 0; } void func1() { int i; printf("func1()\n"); /* Spend some time */ for (i=0; i<10000; i++); return; } void func2() { int i; printf("func2()\n"); /* Spend some time */ for (i=0; i<50000; i++); return; } Profiled result: 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 3 0.00 0.00 func1 0.00 0.00 0.00 1 0.00 0.00 func2 Call graph granularity: each sample hit covers 4 byte(s) no time propagated index % time self children called name 0.00 0.00 3/3 main [10] [1] 0.0 0.00 0.00 3 func1 [1] ----------------------------------------------- 0.00 0.00 1/1 main [10] [2] 0.0 0.00 0.00 1 func2 [2] ----------------------------------------------- Index by function name [1] func1 [2] func2 regards, arvind. --- nabendu das <das...@ya...> wrote: > i have tried as u have suggested > but it is now giving message as > > gprof : gmon.out file is missing call-graph data > > suggest > > --- Arvind D Sankruthi <arv...@ya...> wrote: > > hi nabendu, > > i guess i got your problem. you should not use > > gmon.out for profiling directly. here's an example > > of > > how you can use it: > > > > * You want the profiling info for a program "prog" > > * You compile prog.c with -pg option, get > executable > > "prog" > > * Execute "prog" and you get gmon.out. > > * Use gprof as: > > > > gprof prog > profinfo (NOT gprof gmon.out ! ) > > > > * you'll get profiling info in profinfo > > > > By the way, just typing "gprof > profinfo" will > get > > profiling info from a.out (after you run a.out). > > > > hope this helps. > > > > regards, > > arvind. > > > > --- nabendu das <das...@ya...> wrote: > > > after > > compiling a program with -gp i m getting the > > > file > > > gmon.out. but when i m trying to see the profile > > > info > > > using gprof a.out gmon.out> out it is giving > > > message > > > as > > > > > > gmon.out : not in a.out format. > > > then how to view the profile info > > > plz suggest me . > > > > > > reagards > > > nab > > > > > > > __________________________________________________ > > > Do You Yahoo!? > > > Get personalized email addresses from Yahoo! > Mail > > > http://personal.mail.yahoo.com/ > > > > > > _______________________________________________ > > > linux-india-programmers mailing list > > > lin...@li... > > > > > > http://lists.sourceforge.net/lists/listinfo/linux-india-programmers > > > > > > ===== > > << Arvind D Sankruthi >> > > << Bangalore, India >> > > << ICQ - 119614569 >> > > > > > ____________________________________________________________ > > Do You Yahoo!? > > For regular News updates go to > > http://in.news.yahoo.com > > > > _______________________________________________ > > linux-india-programmers mailing list > > lin...@li... > > > http://lists.sourceforge.net/lists/listinfo/linux-india-programmers > > > __________________________________________________ > Do You Yahoo!? > Get personalized email addresses from Yahoo! Mail > http://personal.mail.yahoo.com/ > > _______________________________________________ > linux-india-programmers mailing list > lin...@li... > http://lists.sourceforge.net/lists/listinfo/linux-india-programmers ===== << Arvind D Sankruthi >> << Bangalore, India >> << ICQ - 119614569 >> ____________________________________________________________ Do You Yahoo!? For regular News updates go to http://in.news.yahoo.com |