If you're on a Linux system, sysprof is your best friend. First, make sure you've got the kernel development headers, and debugging information for the things you're trying to profile. On a Fedora system, that looks like: