How do profilers work?

Started by
2 comments, last by CloudNine 19 years, 1 month ago
Lo, How do code profilers like Intel's VTune profile the code? Do they instrument the code with timers etc. automatically, and if so, how? I know GNU gprof is a good free software profiler, is it a typical example of a profiler? I've always been interested in how they work, and the detail of VTune surprises me. CloudNine
Advertisement
There essentially are 2 ways to do profiling:
a) intrusive (place timers in code)
b) statistical (every x cycles check location in code)

Usually statistical profiling is what you want to use because it shows the behaviour of the real code.
You can also do it through simulation, which VTune does as well as the above. By this I mean analysing the code for potential stalls and such like.

Skizz
Ah, interesting. Is the statistical profiling performed from outside the application, and if so, how is it possible to get the instruction pointer of the task?

This topic is closed to new replies.

Advertisement