5 ms·
Time to stop guessing where the speed problems were, and start instrumenting. Time to trot out gprof, the Gnu profiler. I fired it up on the slow example, and w
by nkurz 13y ago
Time to stop guessing where the speed problems were, and start instrumenting. Time to trot out gprof, the Gnu profiler. I fired it up on the slow example, and waited. And waited, and waited, and waited. I waited overnight. It pole-axed my Ubuntu box, I had to cold boot it. The test case was so big that it plus gprof was too much. gprof slows things down a lot, so I had to cut things way down to get it to work.
It's been a long time since I've used gprof. I switched to Valgrind and OProfile about 10 years ago, and more recently to 'perf' and 'likwid'. If the goal is finding hot-spots, these last might be more convenient since they run with minimal overhead --- a couple percent rather than 100x.
Are there benefits to gprof that I've forgotten?
Are there newer and better profiling tools I don't know about?
- WalterBright 13y agoAs I mentioned elsewhere, I like gprof because it reports on fan-in and fan-out. This gives a picture of how the tree is executing, rather than just the functions.
- nkurz 13y agoMaybe I misunderstand what you need, but generating a call graph and showing what percentage of time is spent in a function by caller is possible with all of these. Example for perf: http://lwn.net/Articles/340010/ http://lwn.net/Articles/340010/
- WalterBright 13y agoI didn't know it could do that. Thanks for the info.
- haberman 13y agoIf your software runs on OS X, try Instruments! It's free (comes with XCode) and has an Apple-quality UI.
- mrich 13y agoVtune and Zoom need to be mentioned, although they are not free. Vtune is even able to do power consumption analysis these days.
- gngeal 13y agoVtune is even able to do power consumption analysis these days. ...on AMD machines, too? (Not to mention mobile development on ARM.)
- mcpherrinm 13y agoAs far as I understand, having not used VTune, some basic features work on both, but the interesting stuff relies on Intel-specific counters in the CPU. This doesn't mean it's worthless, though: Finding your performance bottlenecks on Intel will surely be at least a first-order approximation of the performance on AMD, too. ARM is a little bit of a different story since the memory model is different, and you might be getting killed by something like unaligned accesses, but that doesn't mean the information is worthless; it just means you should probably use more than one tool. After all, not everything is a nail, but hammers are still good tools.
- nkurz 13y agoIf appropriate for your use, VTune for Linux (and the rest of the Intel Compiler Suite) is available for free under a "Non-Commercial Software Development" license. http://software.intel.com/en-us/non-commercial-software-development http://software.intel.com/en-us/non-commercial-software-deve...