5 ms·
This is how common profiling tools (such as gprof) actually work. "Profiling also involves watching your program as it runs, and keeping a histogram of where t
by saurik 15y ago
This is how common profiling tools (such as gprof) actually work.
"Profiling also involves watching your program as it runs, and keeping a histogram of where the program counter happens to be every now and then."
"The run-time figures that gprof gives you are based on a sampling process, so they are subject to statistical inaccuracy."
-- http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html#SEC11 http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html#SEC11
- CountHackulus 15y agoThis is also (roughly) how profiling JIT compilers (like most JVMs) work. The method that needs the more expensive optimizations applied to it is the one that gets the most samples.
- thwest 15y agoYeah this is how Intel describes VTune's operation as well. The trick is that you can't make the measurements from inside your own code, you have to have an external process doing the interrupting. As a newbie I didn't know this. I took an internal framework meant for very coarse level profiling and applied it at an absurdly fine level. The result was spending much, much too long trying to make sense of the numbers.