Quote:
Originally Posted by migurus
Jim,
I never tried profiling before, so I ran into some problem here:
$ gcc -pg -o tstloop tstloop.c
$ tstloop
128205.13 semop/s [0,0]
$ gprof tstloop
gprof: gmon.out file is missing call-graph data
|
That's strange. Any chance you're running a different program that's elsewhere in the path? Try for instance running "./tstloop".
Also, for gprof, use the -l option (small L). I get:
Code:
$ gprof -l ./semget
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
57.10 0.13 0.13 main (semget.c:21 @ 80485f0)
25.12 0.18 0.06 main (semget.c:18 @ 804861f)
9.14 0.20 0.02 main (semget.c:17 @ 8048614)
6.85 0.22 0.02 main (semget.c:16 @ 80485e4)
Line 21 is the semctl() function. Line 18 is the semget() call.
Now that we have concrete results, I'd cross-post this on the Linuxquestions.org com site.
The next step would be to use the debug/profiling version of libc (which I don't have floating around) and see if we can use gprof to find the bottleneck therein. Or, look at the source. It would seem to be of great benefit to have this improved.