to find the execution time of a code

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2007
Posts: 1
Reputation: shanthu123 is an unknown quantity at this point 
Solved Threads: 0
shanthu123 shanthu123 is offline Offline
Newbie Poster

to find the execution time of a code

 
0
  #1
Jun 8th, 2007
i have to find two time stamps one at the begining of main and at the end of main and take the difference to find the time elapsed to execute the code in between.Can anybody suggest the programs or proper API s in Linux.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,868
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 755
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Senior Bitch

Re: to find the execution time of a code

 
0
  #2
Jun 8th, 2007
>Can anybody suggest the programs or proper API s in Linux.
A profiler would be best. Check your system for the existence of gprof. You can also use a number of methods inside of your code to get execution time and timestamps, something like gettimeofday or rdtsc.
Last edited by Narue; Jun 8th, 2007 at 9:49 am.
New members chased away this month: 5
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 25
Reputation: youngstorm is an unknown quantity at this point 
Solved Threads: 1
youngstorm youngstorm is offline Offline
Light Poster

Re: to find the execution time of a code

 
0
  #3
Jun 12th, 2007
man time
time does what u want.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,275
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 378
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: to find the execution time of a code

 
0
  #4
Jun 13th, 2007
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 22
Reputation: aasi007onfire is an unknown quantity at this point 
Solved Threads: 1
aasi007onfire's Avatar
aasi007onfire aasi007onfire is offline Offline
Newbie Poster

Re: to find the execution time of a code

 
0
  #5
Jun 19th, 2007
that thread had a post that the execution time varies with compiler.... is it true...... what exactly does change from compiler to compiler........
Last edited by aasi007onfire; Jun 19th, 2007 at 3:50 pm.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 539
Reputation: thekashyap will become famous soon enough thekashyap will become famous soon enough 
Solved Threads: 50
thekashyap's Avatar
thekashyap thekashyap is offline Offline
Posting Pro

Re: to find the execution time of a code

 
0
  #6
Jun 20th, 2007
There shouldn't be a "major" difference due to compilers, it's more to do with the platform (OS+H/W) then compiler.
Using same compiler you can use different optimization levels, this should make a visible difference in performance.
Are you Agile.. ?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 3483 | Replies: 5
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC