Advertisement

which profiler?

Started by July 13, 2005 06:46 PM
4 comments, last by eXXXile 19 years, 2 months ago
I recently learned about the concept of a profiler and its benefits.... I also found some tutorials for simple "hand-made" profilers My question: which profiler do you use? Is there any good and complete profiler for c++ (and opengl maybe) with gui, menus, settings and everything and maybe integration with visual studio?
As a general rule of thumb, only profile if you believe 2x the performance is possible for a *known* performance problem, or you have the time to completly rewrite everything twice. Both situations arn't very likly.

However, that rule applies mostly to software design in the paid real world. Where deadlines and things like deadlines exist. In the hobby world, it's a completly different story [wink]

so.

Probably the best code analyzer out there is intel V-Tune. It's not free (it has a trial though). In fact, it's quite expensive. But it is good.

However, on top of that, one of the primary limitations of profiling C++ is that you generally cannot profile a fully optimized release compile. Needless to say, this is something of a contradiction and may mean that half the problems that the profiler picks up are things like time spent in (often empty) constructors for frequently used simple structures (say, vectors) which a fully optimized release compile would remove.

And, on top of that, using a profiler does require some knowlege of the inner workings of how the code is actually going to be executed on the CPU.

Basically, unless you are doing something rediculously stupid (I mean no offence here, I've done enough things to make me feel impossibly dumb before...) a profiler will not help you. It will be interesting, yes, but generally, the speed of a cpu today pretty much makes counting cycles pointless.
Speed now days pretty much comes down to two things:
The algorithms you choose, and in some cases the way you use memory (cache misses and page faults - these cost upwards of 3 million cycles each). But mostly the former. I gave a lecture once showing the that right choice of algorithm in a raytracer means the difference between rendering the frame in 3 months and rendering it in 3 seconds. (ie, octree/kd tree/brute force etc)

Fun have.
Advertisement
I once tried AMD's (I guess it's called codeanalyst) but it didn't work on my app. I possibly did something wrong, I'm not sure.
I must say I'm not yet interested in profiling. Premature optimization is the root of all evil. I need to have the whole thing running before worring about something.

Previously "Krohm"

Quote: Original post by Krohm
... Premature optimization is the root of all evil...

Sure think mr Knuth ;). Well, actually I wanted to check the thing out of curiosity, and maybe to see if I spend a lot of time making fast code that will rarelly be used. I mean, the answer that a profiler gives you is "to optimize or not?". But that is , as RipTorn said veru subjective.
Ok, you got it, its all about fun mostly, I will try V-Tune and see...... thaks a lot

when you do use vtune, I recommend you make a half-way build between debug and release. When I do this, surprise surprise, I call it a profile build... Basically, turn on every optimization you can (including inlining especially) as long as the optimization does not interfere with the debug options mostly enabled. The profile needs an .exe with line numbers/code etc.
makes sense, I will

This topic is closed to new replies.

Advertisement