l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2008 Mar 30 20:40

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] C profiling tools
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] C profiling tools

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 

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?

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.