Why gprof underestimates total time
问题 I have CPU bound process which runs for 5 hours (CPU time by using getrusage() ) I tried to profile it by gprof. The total time main() took is only about 5000s. My program is CPU bound, it has some disc IO but it is not that significant. Profile interrupts are on, and my process in not multithreaded. 回答1: It only samples in routines it knows about. You calling new ? That's going to spend time in places where gprof doesn't go. BTW, if you're looking for ways to save some time (after 5 hours I