TEMU  2
The Terma Emulator
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Time.h File Reference
#include <stdint.h>
#include "temu-c/Support/Attributes.h"
Include dependency graph for Time.h:

Go to the source code of this file.

Functions

TEMU_API uint64_t temu_timeGetMonotonicWct (void)
 
TEMU_API uint64_t temu_timeGetThreadWct (void)
 temu_timeGetThreadWct Returns wall clock nanoseconds of thread time (i.e. how much time the thread this is called from has been scheduled) More...
 
TEMU_API uint64_t temu_timeGetCurrentSrtNanos (void *Obj)
 temu_timeGetCurrentSrtNanos More...
 
TEMU_API int64_t temu_getCycles (const void *Q)
 
TEMU_API int64_t temu_getNanos (const void *Q)
 
TEMU_API double temu_getSecs (const void *Q)
 
TEMU_API int64_t temu_cyclesToNanos (int64_t Cycles, int64_t Freq)
 
TEMU_API double temu_cyclesToSecs (int64_t Cycles, int64_t Freq)
 
TEMU_API int64_t temu_nanosToCycles (int64_t Nanos, int64_t Freq)
 
TEMU_API double temu_nanosToSecs (int64_t Nanos)
 
TEMU_API int64_t temu_secsToNanos (double Secs)
 
TEMU_API int64_t temu_secsToCycles (double Secs, int64_t Freq)
 

Function Documentation

TEMU_API int64_t temu_cyclesToNanos ( int64_t  Cycles,
int64_t  Freq 
)

Convert cycles to nanoseconds

Parameters
CyclesCycle count to convert
FreqFrequency in Hz
Returns
Cycles converted to nanoseconds
TEMU_API double temu_cyclesToSecs ( int64_t  Cycles,
int64_t  Freq 
)

Convert cycles to seconds

Parameters
CyclesCycle count to convert
FreqFrequency in Hz
Returns
Cycles converted to seconds
TEMU_API int64_t temu_getCycles ( const void *  Q)

Get current time in cycles.

Parameters
QCPU object
Returns
Current cycles as it is understood by the object.
TEMU_API int64_t temu_getNanos ( const void *  Q)

Get current time in nanoseconds

Parameters
QCPU or Machine object
Returns
Current nanoseconds as it is understood by the object.
TEMU_API double temu_getSecs ( const void *  Q)

Get current time in seconds

Parameters
QCPU or Machine object
Returns
Current seconds as it is understood by the object.
TEMU_API int64_t temu_nanosToCycles ( int64_t  Nanos,
int64_t  Freq 
)

Convert nanoseconds to cycles

Parameters
NanosNanoseconds to convert
FreqFrequency in Hz
Returns
Nanoseconds converted to cycles
TEMU_API double temu_nanosToSecs ( int64_t  Nanos)

Convert nanoseconds to seconds

Parameters
NanosNanoseconds to convert
Returns
Nanoseconds converted to seconds
TEMU_API int64_t temu_secsToCycles ( double  Secs,
int64_t  Freq 
)

Convert seconds to cycles

Parameters
SecsSeconds to convert
FreqFrequency in Hz
Returns
Seconds converted to an integral number of cycles
TEMU_API int64_t temu_secsToNanos ( double  Secs)

Convert seconds to nanoseconds

Parameters
SecsSeconds to convert
Returns
Seconds converted to an integral number of nanoseconds
TEMU_API uint64_t temu_timeGetCurrentSrtNanos ( void *  Obj)

temu_timeGetCurrentSrtNanos

Parameters
ObjThe object in question
Returns
simulated time for the given object
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.

Returns
Wall clock nanoseconds since an unspecified epoch.
TEMU_API uint64_t temu_timeGetThreadWct ( void  )

temu_timeGetThreadWct Returns wall clock nanoseconds of thread time (i.e. how much time the thread this is called from has been scheduled)

Returns
wall clock nanoseconds of thread time