TEMU  2
The Terma Emulator
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Time.h
Go to the documentation of this file.
1 //===-- temu-c/Support/Time.h - Portable Timers -----------------*- C++ -*-===//
2 //
3 // T-EMU: The Terma Emulator
4 // (c) Terma 2015
5 // Authors: Mattias Holm <maho (at) terma.com>
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef TEMU_SUPPORT_TIME
10 #define TEMU_SUPPORT_TIME
11 
12 #include <stdint.h>
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
39 TEMU_API uint64_t temu_timeGetMonotonicWct(void);
40 
47 TEMU_API uint64_t temu_timeGetThreadWct(void);
48 
54 TEMU_API uint64_t temu_timeGetCurrentSrtNanos(void *Obj);
55 
61 TEMU_API int64_t temu_getCycles(const void *Q);
62 
68 TEMU_API int64_t temu_getNanos(const void *Q);
69 
75 TEMU_API double temu_getSecs(const void *Q);
76 
77 /*
78  * Time conversion, note that this isn't super-trivial due to
79  * overflows. So use these functions, they are well tested and
80  * hardened against overflow. Note that due to rounding, there is no
81  * strict guarantee that the inverse functions are strictly inverse
82  * e.g. WE DO NOT GUARANTEE that:
83  * (cyclesToNanos(nanosToCycles(N, F), F)) == N
84  */
85 
92 TEMU_API int64_t temu_cyclesToNanos(int64_t Cycles, int64_t Freq);
93 
100 TEMU_API double temu_cyclesToSecs(int64_t Cycles, int64_t Freq);
101 
108 TEMU_API int64_t temu_nanosToCycles(int64_t Nanos, int64_t Freq);
109 
115 TEMU_API double temu_nanosToSecs(int64_t Nanos);
116 
122 TEMU_API int64_t temu_secsToNanos(double Secs);
123 
130 TEMU_API int64_t temu_secsToCycles(double Secs, int64_t Freq);
131 
132 #ifdef __cplusplus
133 }
134 #endif
135 
136 #endif /* ! TEMU_SUPPORT_TIME */
TEMU_API int64_t temu_getCycles(const void *Q)
TEMU_API uint64_t temu_timeGetThreadWct(void)
temu_timeGetThreadWct Returns wall clock nanoseconds of thread time (i.e. how much time the thread th...
TEMU_API double temu_nanosToSecs(int64_t Nanos)
TEMU_API double temu_getSecs(const void *Q)
TEMU_API int64_t temu_cyclesToNanos(int64_t Cycles, int64_t Freq)
TEMU_API int64_t temu_secsToCycles(double Secs, int64_t Freq)
TEMU_API int64_t temu_secsToNanos(double Secs)
TEMU_API int64_t temu_nanosToCycles(int64_t Nanos, int64_t Freq)
TEMU_API int64_t temu_getNanos(const void *Q)
TEMU_API uint64_t temu_timeGetCurrentSrtNanos(void *Obj)
temu_timeGetCurrentSrtNanos
TEMU_API double temu_cyclesToSecs(int64_t Cycles, int64_t Freq)
TEMU_API uint64_t temu_timeGetMonotonicWct(void)
#define TEMU_API
Definition: Attributes.h:53