n*********s 发帖数: 8 | 1 Using gprof to profile the running time of a program, get the total time is
about 120s. At the same time, the "time" shell command gives ~180s.
In another case, the two could be ~170s and ~400s, respectively.
Should the time provided by gprof be almost the same as that counted by
"time"?
Thanks | k*****l 发帖数: 34 | 2 time ./a.out 要给出三种时间的 real, user, system.
不只是系统时间。 | k*****l 发帖数: 34 | 3 Statistical Inaccuracy of gprof Output
Reason:
"The run-time figures that gprof gives you are based on a sampling proce
ss, so they are subject to statistical inaccuracy. "
"The sampling period that is printed at the beginning of the flat profil
e says how often samples are taken. The rule of thumb is that a run-time
figure is accurate if it is considerably bigger than the sampling perio
d. "
Solution:
"One way to get more accuracy is to give your program more (but similar)
input data so it will
【在 n*********s 的大作中提到】 : Using gprof to profile the running time of a program, get the total time is : about 120s. At the same time, the "time" shell command gives ~180s. : In another case, the two could be ~170s and ~400s, respectively. : Should the time provided by gprof be almost the same as that counted by : "time"? : Thanks
|
|