Re: Anybody may help to explain the issue of the source code , next "try-throw-catch" will cost more cpu time than previous one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Happy New Year! Haley,

Thanks for your help!

In your result , there isn't any variation in the time taken.

My test code can be like this :

while(1){
 try_throw_catch_block(0); // it takes about 133xxxxx every time
 try_throw_catch_block(1); // it takes about 148xxxxx every time
 try_throw_catch_block(2); // it takes about 158xxxxx every time
 try_throw_catch_block(3); // it takes about 172xxxxx every time 
}

In my opinion , next "try_throw_catch" in writing order will takes more cpu time than the previous one.

Then , I will use oprofile to check it. 


--- 09年1月1日,周四, Andrew Haley <aph@xxxxxxxxxx> 写道:

> 发件人: Andrew Haley <aph@xxxxxxxxxx>
> 主题: Re: Anybody may help to explain the issue of the source code , next "try-throw-catch" will cost more cpu time than previous one
> 收件人: "f z" <zhangjiakouzf@xxxxxxxxxxxx>
> 抄送: gcc-help@xxxxxxxxxxx
> 日期: 2009,11,周四,7:44下午
> f z wrote:
> > Hi everyone,
> > I test some code and I found that "next
> 'try-throw-catch' will cost more cpu time than
> previous one". Could you help to explain this case !! 
> 
> Try using clock(3) instead of gettimeofday(2).
> 
> I see quite a lot of variation in the time taken: sometimes
> slower, sometimes faster.  I'm not sure what causes
> this
> variation, and you'd have to use oprofile or something
> similar to find out.  Some variation is inevitable, due
> to the OS process scheduling.
> 
> Andrew.
> 
> 
> start0:0
> end  0:13320000
> totle0:13320000
> ******************
> start1:13320000
> end  1:28000000
> totle1:14680000
> ******************
> start2:28000000
> end  2:43870000
> totle2:15870000
> ******************
> start3:43870000
> end  3:61100000
> totle3:17230000
> ******************
> start0:61100000
> end  0:74440000
> totle0:13340000
> ******************
> start1:74440000
> end  1:89120000
> totle1:14680000
> ******************
> start2:89120000
> end  2:104980000
> totle2:15860000
> ******************
> start3:104980000
> end  3:122200000
> totle3:17220000
> ******************
> start0:122200000
> end  0:135560000
> totle0:13360000
> ******************
> start1:135560000
> end  1:150250000
> totle1:14690000
> ******************
> start2:150250000


      ___________________________________________________________ 
  好玩贺卡等你发,邮箱贺卡全新上线! 
http://card.mail.cn.yahoo.com/


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux