How exactly does gprof work?
问题 This is something of a bloated question, so I apologize ahead of time. I'm curious about how gprof works on a low technical level. I understand it's done by timers, but then why does the executable need to be specially compiled to be profiled? Does the compilation cause space to be allocated for statistics? Also, how is the timing done exactly? 回答1: Well, this gives a good explanation. Also this explains statistical profiling Essentially gprof will change the executable of your program (this