q*d 发帖数: 20 | 1 suppose I want to compare two functions performance,
Is there any function I can use from g++ to count the time?
Thanks very much! |
k****f 发帖数: 3794 | 2 getrusage
gprof
【在 q*d 的大作中提到】 : suppose I want to compare two functions performance, : Is there any function I can use from g++ to count the time? : Thanks very much!
|
q*d 发帖数: 20 | 3 Thanks very much!
It seems to me getrusage and gprof are very fancy to me. I am wondering
whether there is any basic function like counting the time from line i
to line k:
int i ; ..... .line i
...
...
int j; ...... line k
Thanks again!
【在 k****f 的大作中提到】 : getrusage : gprof
|
k****f 发帖数: 3794 | 4 被gcc优化之后,行的顺序就不一定了
最好去统计一个函数的时间
【在 q*d 的大作中提到】 : Thanks very much! : It seems to me getrusage and gprof are very fancy to me. I am wondering : whether there is any basic function like counting the time from line i : to line k: : int i ; ..... .line i : ... : ... : int j; ...... line k : Thanks again!
|
x*****h 发帖数: 38 | 5 Try the time utility in linux
time + executable code
【在 q*d 的大作中提到】 : suppose I want to compare two functions performance, : Is there any function I can use from g++ to count the time? : Thanks very much!
|
g****c 发帖数: 299 | 6 time is just one aspect of performance factors.
performance library like PAPI or PCL will give you all statistic data of the
performance you need.
【在 q*d 的大作中提到】 : suppose I want to compare two functions performance, : Is there any function I can use from g++ to count the time? : Thanks very much!
|