diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-03-28 23:15:05 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-03-28 23:15:05 -0500 |
commit | e70dde5eb0fddf4d47b38d9cd5af7ffcc463af4b (patch) | |
tree | f235f02b670140b8083a1725f0ce622f51322805 | |
parent | 6d4ea13bd72d10a1c3ea082dab48b9d497bc7326 (diff) |
CarpetLib: Add a fall-back dummy timer in case no system timer is found
This fall-back timer only counts how often it is called.
-rw-r--r-- | Carpet/CarpetLib/src/cycle.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/cycle.h b/Carpet/CarpetLib/src/cycle.h index e6367c3ea..5e0d332e2 100644 --- a/Carpet/CarpetLib/src/cycle.h +++ b/Carpet/CarpetLib/src/cycle.h @@ -511,3 +511,21 @@ INLINE_ELAPSED(inline) #define HAVE_TICK_COUNTER #endif #endif /* HAVE_MIPS_ZBUS_TIMER */ + +/*----------------------------------------------------------------*/ +/* Fallback -- this must be the last entry in this file */ +#if !defined(HAVE_TICK_COUNTER) + +typedef double ticks; + +static inline ticks getticks(void) +{ + static ticks counter = 0; + + return ++ counter; +} + +INLINE_ELAPSED(inline) + +#define HAVE_TICK_COUNTER +#endif |