Thread: Timming algorithm

  1. #1
    Mario
    Guest

    Unhappy Timming algorithm

    I need help timing an Algorithm

    I'm using unformated time not in seconds
    using the function clock()
    I need to run this program 10 times and get an average time for it I do this by having a big for loop that will run it 10 times
    and the problem is that when i run it for sometimes it gives zero time

    Ex:
    0
    0
    0
    0
    0
    10
    0
    0
    0
    0

    Of course the average is 1

    Is there any particular reason why it gives 0 time
    Does the hardware affects the time(processor Memory etc,)

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    241
    it may run so fast that it can't determine a time. You may want try a loop that does the calculation a few hundred or thousand times to find that out. If that doesn't work, you will probably want to look over the part that checks the time because that might be off. Hope that helps

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Implement of a Fast Time Series Evaluation Algorithm
    By BiGreat in forum C Programming
    Replies: 7
    Last Post: 12-04-2007, 02:30 AM
  2. Replies: 4
    Last Post: 12-10-2006, 07:08 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM