[Date Prev][Date Next] [Chronological] [Thread] [Top]

[rtl] gettimeofday() bug, get_cycles(), etc.



RT Linux folks,

I notice that the Linux gettimeofday() function occassionally returns
times earlier than previous calls. This may have been referred to as the
non-monotonic problem with gettimeofday(), or something like that. I
notice the problem when running a simple Linux process that calls
gettimeofday() repeatedly, while an RT process (like the frank example)
is running.

There is also a function, get_cycles(), that returns an unsigned long
that is incremented by the Pentium each CPU cycle. On a 400 MHz PC this
rolls over in about 11 seconds. This would be a great substitute for
gettimeofday(), but it's very non-portable. If one could read the actual
processor speed you could divide and get seconds.

Questions:

1. is there a fix for the problem with gettimeofday()? If not, does
anyone know the source of the problem so that I could look into fixing
it?

2. How can one read the CPU speed off the Pentium chip?

--Fred
--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.cs.nmt.edu OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.cs.nmt.edu
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/