Live data from Hacker News

Ask HN: What's your best C/C++ profiling tool, hints and best practice?

news.ycombinator.com

1–10 of 13 posts

Ask HN: What's your best C/C++ profiling tool, hints and best practice?

#1
I frequently come across wanting to profile C++ on Linux. I have used perf a lot before but do not have vtune handy. I have dabbled around with poor man's profiler but that seems to get trickier with lots and lots of threads. What are your favorite outside-the-box approaches? How do you figure out contention or IO wait issues?

Re: Ask HN: What's your best C/C++ profiling tool, hints and best practice?

#8

valgrind's got some good features along these lines: http://valgrind.org/info/tools.html

Valgrind is nice, however, especially with multi-threaded programs the virtualized execution diverges from a non-valgrind-VM run quite a bit so I am not a huge fan.

Re: Ask HN: What's your best C/C++ profiling tool, hints and best practice?

#10
Any tips on profiling windows device drivers? I've tried xperf, but it doesn't allow you (or I haven't seen how) to change the frequency of the sampling, and can only do a system-wide profile.

I've also tried vtune, but it doesn't support stack-tracing (or things like lbr) for system-wide profiling, and it doesn't have a specific option for sampling drivers. You can attach to the System process, but then you're missing a lot of the your driver code, that runs in other contexts.

I kept thinking about implementing my own sampling profiler (using LBR for stack-tracing, and hardware performance events, like linux's oprofile/ freebsd's hwpmc), but I can't see how I could only profile my driver, and not the whole system, without hooking the Windows scheduler. I guess I will just profile the whole system and check if the program counter is inside my module.

Post reply on HN