Execution time

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

Join Date: Feb 2006
Posts: 50
Reputation: ultra vires is an unknown quantity at this point 
Solved Threads: 5
ultra vires ultra vires is offline Offline
Junior Poster in Training

Execution time

 
0
  #1
Feb 18th, 2006
I wanted to calcualte the execution time of Bubble sort or for that matter any loop . i tried using the clock funtion in c but it gives me 0 seconds for even 10000 elemnts being in the list .
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 490
Reputation: Bench has a spectacular aura about Bench has a spectacular aura about Bench has a spectacular aura about 
Solved Threads: 49
Bench's Avatar
Bench Bench is offline Offline
Posting Pro in Training

Re: Execution time

 
0
  #2
Feb 18th, 2006
unless you're running a prehistoric computer, 10000 is nothing you want to be thinking in terms of millions if you wish to obtain a calculatable time difference.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 50
Reputation: ultra vires is an unknown quantity at this point 
Solved Threads: 5
ultra vires ultra vires is offline Offline
Junior Poster in Training

Re: Execution time

 
0
  #3
Feb 18th, 2006
Originally Posted by Bench
unless you're running a prehistoric computer, 10000 is nothing you want to be thinking in terms of millions if you wish to obtain a calculatable time difference.
But when i include a printf statement in the code the execution time inc to like .4 sec and i guess printf doest take a lot of processing
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,771
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: 743
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Execution time

 
0
  #4
Feb 18th, 2006
>i guess printf doest take a lot of processing
printf doesn't do much internal processing, despite the length of the code for it. The performance hits come from writing to an external device, which is extremely slow when compared to the simple internal data movement of a sort.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 50
Reputation: ultra vires is an unknown quantity at this point 
Solved Threads: 5
ultra vires ultra vires is offline Offline
Junior Poster in Training

Re: Execution time

 
0
  #5
Feb 18th, 2006
but isnt the clock is supposed to be processor clock and i think it doesnt take into account the interupts for other device into account

correct me if i am wrong ..... i am new to this

ooppss... almost forgot to say thnx to all those who replied :cheesy:
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,771
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: 743
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Execution time

 
0
  #6
Feb 18th, 2006
>but isnt the clock is supposed to be processor clock and i think
>it doesnt take into account the interupts for other device into account
The processor doesn't stop ticking just because you call an interrupt for a device.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 50
Reputation: ultra vires is an unknown quantity at this point 
Solved Threads: 5
ultra vires ultra vires is offline Offline
Junior Poster in Training

Re: Execution time

 
0
  #7
Feb 18th, 2006
i meant that clock function only count processor clocks
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,771
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: 743
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Execution time

 
0
  #8
Feb 18th, 2006
>i meant that clock function only count processor clocks
And what do you think the processor is doing while the device is doing its thing?
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 1,221
Reputation: bumsfeld will become famous soon enough bumsfeld will become famous soon enough 
Solved Threads: 137
bumsfeld's Avatar
bumsfeld bumsfeld is offline Offline
Nearly a Posting Virtuoso

Re: Execution time

 
0
  #9
Feb 18th, 2006
There is something like in a C code snippet here:
http://www.daniweb.com/code/snippet377.html
Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC