[vox-tech] C profiling tools
Shwaine
shwaine at shwaine.com
Mon Mar 3 17:54:21 PST 2008
Any software profiling gurus out there? I've come across a wee bit of a
problem trying to streamline some code. I suspect the bottleneck for my
code is rand(), but before going to the hassle of writing a PRNG (or
finding a decent open-source one), I'd like to confirm that rand() is
indeed the bottleneck. So I fired up the profiling tools I know about:
gprof, strace and ltrace.
strace confirmed that the majority of the execution time was within the
program's primary loop (another concern I had was I/O overhead reading the
input file and writing report files after the loop, so strace eliminated
that possibility). So then I moved on to profiling the primary loop.
That's when I ran head-first into a brick wall. The first problem is that
gprof can only trace the code about 60-65% of the time due to the time
spent within library calls. Which leads to the second problem, ltrace
crashes with SIGPROF and SIGSEGV before it even finishes reading the input
file, so I can't use it to get timing on the library calls. I compiled
ltrace-0.5-3.1 which seemed to be the newest version available on Debian's
website. The system is Slackware 10.2 Pentium 4 2.4GHz, so it seems like
ltrace should support it, but no such luck. ltrace does work for small
program, e.g. "ltrace ls" worked perfectly fine, but it crashes on my
program.
Does anyone know of any other open-source profiling tools that would be
able to say how long the program is spending not only in my function calls
but also the library calls? Or alternatively, does anyone have a clue
about how to get ltrace working?
Thanks,
Melissa
More information about the vox-tech
mailing list