Is timing reproducible ? (Re: times vs clock) 
Author Message
 Is timing reproducible ? (Re: times vs clock)

I found that I can use times() (or getrusage() for SUN) in the same
way as using clock(). But I found that the result of this timing
is not always the same.

clock() is mixing the user and system time, so it's understandable that
it will give some different results depend on the load of the system.
But, times() and getrusage() can give user's cpu time, which I think
should be always the same as long as you running the same program with
the same input in the same machine.

Anybody knows whether actually times() and getrusage() are reproducible
or not ? Any help or pointers will be appreciated.
Thanks

--
Kunta  



Sun, 23 Nov 1997 03:00:00 GMT  
 Is timing reproducible ? (Re: times vs clock)

Quote:

>I found that I can use times() (or getrusage() for SUN) in the same
>way as using clock(). But I found that the result of this timing
>is not always the same.

If you are running on a Sun the answer to your problem is trivial.  The Sun
runs UNIX (a version of it anyway) which is a mutlitasking OS/2.  Your CPU
time and your run time is dictated by the number of processes running
concurrently on your system.

On a simple system like DOS you may get timing problems if you are running
a disk cache.  If you do a lot of disk I/O on a highly fragmented drive
then your timing will be different.

In general you won't get the same timing on every run.  What's important
is the time differences.  Are you off by several seconds, micro seconds,
and if you could accurately count them, pico seconds.  Several seconds is
bad, micro seconds depends on the system, and don't worry about picos.

Hope I helped,
==============================================



Mon, 24 Nov 1997 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Get Real Time Clock (RTC) time/date

2. times vs clock

3. Q: update system clock with real time clock

4. clock() function and CPU/wall clock time

5. real-time vs. user-time

6. Design-time vs Run-time mode

7. How to convert local time with specific time zone to UTC time in Win32 API

8. Real Time Clock on Red Hat Linux Hangs on Read (from /dev/rtc)

9. Real Time Clock (RTC) in C/C++

10. Using C's built in Timing/Clock Functions

11. clock() function from time.h library

12. real time clock

 

 
Powered by phpBB® Forum Software