Arax -8d09c51940345c86062e8ef2427c705ae66e5926
A Runtime Framework for Decoupling Applications from Heterogeneous Accelerators
Loading...
Searching...
No Matches
timer.h File Reference
#include <arax.h>
#include <unistd.h>
+ Include dependency graph for timer.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define utils_timer_set(NAME, WHAT)
 
#define utils_timer_get_raw(NAME, WHAT)
 
#define utils_timer_set_raw(NAME, WHAT, RAW)
 
#define UTILS_TIMER_MS   1000000
 
#define UTILS_TIMER_US   1000
 
#define UTILS_TIMER_NS   1
 
#define utils_timer_tv_time(TV, SCALE)
 
#define utils_timer_get_time_us(NAME, WHAT)
 
#define utils_timer_get_time_ns(NAME, WHAT)
 
#define utils_timer_get_duration_us(NAME)
 
#define utils_timer_get_duration_ns(NAME)
 
#define utils_timer_get_elapsed_us(NAME)
 
#define utils_timer_get_elapsed_ns(NAME)
 

Macro Definition Documentation

◆ utils_timer_get_duration_ns

#define utils_timer_get_duration_ns ( NAME)
Value:
- utils_timer_tv_time((NAME).start, UTILS_TIMER_NS)) \
#define utils_timer_tv_time(TV, SCALE)
Definition timer.h:45
#define UTILS_TIMER_NS
Definition timer.h:37

Get the duration in nanoseconds of the NAME timer.

Parameters
NAMEName of a utils_timer variable

Definition at line 82 of file timer.h.

Referenced by _arch_alloc_free(), _arch_alloc_free(), arch_alloc_allocate(), and arch_alloc_allocate().

◆ utils_timer_get_duration_us

#define utils_timer_get_duration_us ( NAME)
Value:
#define UTILS_TIMER_US
Definition timer.h:35

Get the duration in microseconds of the NAME timer.

Parameters
NAMEName of a utils_timer variable

Definition at line 73 of file timer.h.

◆ utils_timer_get_elapsed_ns

#define utils_timer_get_elapsed_ns ( NAME)
Value:
({ \
struct timespec now; \
clock_gettime(CLOCK_REALTIME, &now); \
utils_timer_tv_time(now, UTILS_TIMER_NS) \
- utils_timer_get_time_ns(NAME, start); \
})
#define utils_timer_get_time_ns(NAME, WHAT)
Definition timer.h:65

Get the current elapsed time since timer start time in nanoseconds.

Parameters
NAMEName of a utils_timer variable

Definition at line 105 of file timer.h.

◆ utils_timer_get_elapsed_us

#define utils_timer_get_elapsed_us ( NAME)
Value:
({ \
struct timespec now; \
clock_gettime(CLOCK_REALTIME, &now); \
utils_timer_tv_time(now, UTILS_TIMER_US) \
- utils_timer_get_time_us(NAME, start); \
})
#define utils_timer_get_time_us(NAME, WHAT)
Definition timer.h:55

Get the current elapsed time since timer start time in microseconds.

Parameters
NAMEName of a utils_timer variable

Definition at line 92 of file timer.h.

◆ utils_timer_get_raw

#define utils_timer_get_raw ( NAME,
WHAT )
Value:
((NAME).WHAT)

Get the raw values of start/stop time of NAME timer.

Parameters
NAMEName of a utils_timer variable
WHATCan be start or stop

Definition at line 21 of file timer.h.

◆ utils_timer_get_time_ns

#define utils_timer_get_time_ns ( NAME,
WHAT )
Value:

Get the start/stop time in nanoseconds of the NAME timer.

Parameters
NAMEName of a utils_timer variable
WHATCan be start or stop
Returns
The requested timestamp in nanoseconds

Definition at line 65 of file timer.h.

◆ utils_timer_get_time_us

#define utils_timer_get_time_us ( NAME,
WHAT )
Value:

Get the start/stop time in microseconds of the NAME timer.

Parameters
NAMEName of a utils_timer variable
WHATCan be start or stop
Returns
The requested timestamp in microseconds

Definition at line 55 of file timer.h.

◆ UTILS_TIMER_MS

#define UTILS_TIMER_MS   1000000

Use with utils_timer_tv_time() to get time in milliseconds

Definition at line 33 of file timer.h.

◆ UTILS_TIMER_NS

#define UTILS_TIMER_NS   1

Use with utils_timer_tv_time() to get time in nanoseconds

Definition at line 37 of file timer.h.

◆ utils_timer_set

#define utils_timer_set ( NAME,
WHAT )
Value:
clock_gettime(CLOCK_REALTIME, &((NAME).WHAT))

Set the start/stop time of NAME timer to the current time.

Parameters
NAMEName of a utils_timer variable
WHATCan be start or stop

Definition at line 13 of file timer.h.

Referenced by _arch_alloc_free(), _arch_alloc_free(), arax_task_submit(), arch_alloc_allocate(), and arch_alloc_allocate().

◆ utils_timer_set_raw

#define utils_timer_set_raw ( NAME,
WHAT,
RAW )
Value:
(NAME).WHAT = RAW

Set the start/stop time of NAME timer for the raw values RAW.

Parameters
NAMEName of a utils_timer variable
WHATCan be start or stop
RAWRaw value of timer as returned by utils_timer_get_raw

Definition at line 30 of file timer.h.

◆ utils_timer_tv_time

#define utils_timer_tv_time ( TV,
SCALE )
Value:
(((TV).tv_sec * (1000000000 / SCALE)) + (TV).tv_nsec / (SCALE))

Convert TV struct to time in SCALE units.

SCALE = 1000 => microseconds SCALE = 1 => nanoseconds

Definition at line 45 of file timer.h.

◆ UTILS_TIMER_US

#define UTILS_TIMER_US   1000

Use with utils_timer_tv_time() to get time in microseconds

Definition at line 35 of file timer.h.