944,218 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 906
  • C RSS
Nov 9th, 2009
1

can any one help me about calculating the exact execution time of processor

Expand Post »
hi,

Can any one help me about clock problem..i need to calculate the exact execution time of algorithm using the processor clock speed not the wall clock time..i am getting zero by using the clock_t function in time.h.also how can i calculate the exact processor speed execution of program..reply me as soon as possible.
  1. for example
  2. #include<stdio.h>
  3. #include<time.h>
  4. int main()
  5. {
  6. clock_t start,end;
  7. start=clock();
  8. bubblesort(array,arraysize);
  9. end=clock();
  10. printf("the clock speed: %f",start-end);
  11. getch();
  12.  
  13. }
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
eswar.aspire is offline Offline
13 posts
since Nov 2009
Nov 15th, 2009
1
Re: can any one help me about calculating the exact execution time of processor
your code: " printf("the clock speed: %f",start-end); "

Hey dude, change to: end - start to obtain time in miliseconds
or (end - start) / 1000.0 for time in seconds.miliseconds

(and don't forget to declare double start, end; )
Last edited by AuSsIeStOnE; Nov 15th, 2009 at 8:36 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
AuSsIeStOnE is offline Offline
3 posts
since Nov 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC