TEMU
4.4
The Terma Emulator
|
#include "temu-c/Support/Temu3Compat.h"
#include "temu-c/Support/Attributes.h"
#include "temu-c/Support/Events.h"
#include <stdint.h>
Go to the source code of this file.
TEMU_API int64_t temu_cyclesToNanos | ( | int64_t | Cycles, |
int64_t | Freq | ||
) |
Convert cycles to nanoseconds
Cycles | Cycle count to convert |
Freq | Frequency in Hz |
TEMU_API int64_t temu_cyclesToOtherFreqRoundedUp | ( | int64_t | Cycles, |
int64_t | SourceFreq, | ||
int64_t | TargetFreq | ||
) |
Convert cycles to another frequency base, rounding upwards
Cycles | Cycle count in source frequency ticks |
SourceFreq | Frequency in Hz of the source |
TargetFreq | Frequency in Hz for the converted value |
TEMU_API int64_t temu_cyclesToOtherFreqTruncated | ( | int64_t | Cycles, |
int64_t | SourceFreq, | ||
int64_t | TargetFreq | ||
) |
Convert cycles to another frequency base, with truncated result
Cycles | Cycle count in source frequency ticks |
SourceFreq | Frequency in Hz of the source |
TargetFreq | Frequency in Hz for the converted value |
TEMU_API double temu_cyclesToSecs | ( | int64_t | Cycles, |
int64_t | Freq | ||
) |
Convert cycles to seconds
Cycles | Cycle count to convert |
Freq | Frequency in Hz |
TEMU_API uint64_t temu_cyclesToSteps | ( | temu_TimeSource * | TS, |
uint64_t | Cycles | ||
) |
Convert cycles to steps
TS | Time source object |
Cycles | Cycle count to convert to steps |
TEMU_API uint64_t temu_cyclesToStepsRoundedUp | ( | temu_TimeSource * | TS, |
uint64_t | Cycles | ||
) |
Convert cycles to steps, rounding upwards
TS | Time source object |
Cycles | Cycle count to convert to steps |
TEMU_API int64_t temu_getCycles | ( | temu_TimeSource_ * | TS | ) |
Get current time in cycles.
TS | Time source object |
TEMU_API int64_t temu_getNanos | ( | temu_TimeSource_ * | TS | ) |
Get current time in nanoseconds
TS | Time source object |
TEMU_API double temu_getSecs | ( | temu_TimeSource_ * | TS | ) |
Get current time in seconds
TS | Time source object |
TEMU_API int64_t temu_getSteps | ( | temu_TimeSource * | TS | ) |
Get current step count
TS | Time source object |
TEMU_API int64_t temu_nanosToCycles | ( | int64_t | Nanos, |
int64_t | Freq | ||
) |
Convert nanoseconds to cycles
This function truncates the result in case of non-exact conversion.
Nanos | Nanoseconds to convert |
Freq | Frequency in Hz |
TEMU_API int64_t temu_nanosToCyclesRoundedUp | ( | int64_t | Nanos, |
int64_t | Freq | ||
) |
Convert nanoseconds to cycles rounded upwards
This function rounds up the result in case of non-exact conversion.
Nanos | Nanoseconds to convert |
Freq | Frequency in Hz |
TEMU_API double temu_nanosToSecs | ( | int64_t | Nanos | ) |
Convert nanoseconds to seconds
Nanos | Nanoseconds to convert |
TEMU_API int64_t temu_secsToCycles | ( | double | Secs, |
int64_t | Freq | ||
) |
Convert seconds to cycles
Secs | Seconds to convert |
Freq | Frequency in Hz |
TEMU_API int64_t temu_secsToNanos | ( | double | Secs | ) |
Convert seconds to nanoseconds
Secs | Seconds to convert |
TEMU_API uint64_t temu_stepsToCycles | ( | temu_TimeSource * | TS, |
uint64_t | Steps | ||
) |
Convert steps to cycles
TS | Time source object |
Steps | Step count to convert to cycles |
TEMU_API uint64_t temu_stepsToCyclesRoundedUp | ( | temu_TimeSource * | TS, |
uint64_t | Steps | ||
) |
Convert steps to cycles, rounding upwards
TS | Time source object |
Steps | Step count to convert to cycles |
TEMU_API uint64_t temu_timeGetCurrentSrtNanos | ( | temu_TimeSource_ * | TS | ) |
Get the current simulated real-time in nanoseconds
TS | The object in question |
TEMU_API uint64_t temu_timeGetMonotonicWct | ( | void | ) |
Get monotonic time in nanoseconds.
The monotonic time is relative since some epoch of undefined start, but it is monotonic, unaffected by adjustments due to leap seconds, setting of the system clock, etc.
This function is primarily useful for doing performance measurements since the time returned is relative to an undefined point (although that undefined point will be consistent while the program is running).
In practice, on systems with clock_gettime() implemented, this function returns the timespec converted to nanoseconds, but on systems without clock_gettime(), e.g. Darwin and Windows, the function will only ensure that some notion of monotonic nanoseconds are returned. In Darwin for example, this results in a monotonic time returned which is relative to the first call to the function.
TEMU_API uint64_t temu_timeGetThreadWct | ( | void | ) |
Returns wall clock nanoseconds of thread time
NOTE: This is how much time the thread this is called from has been scheduled.