ARGOBOTS  4dc37e16e1b227a480715ab67dae1dcfb4d2d4e0
Typedefs | Functions
Timer

This group is for Timer. More...

Typedefs

typedef struct ABT_timer_opaque * ABT_timer
 Timer handle type. More...
 

Functions

double ABT_get_wtime (void)
 Get elapsed wall clock time. More...
 
int ABT_timer_create (ABT_timer *newtimer)
 Create a new timer. More...
 
int ABT_timer_dup (ABT_timer timer, ABT_timer *newtimer)
 Duplicate a timer. More...
 
int ABT_timer_free (ABT_timer *timer)
 Free a timer. More...
 
int ABT_timer_start (ABT_timer timer)
 Start a timer. More...
 
int ABT_timer_stop (ABT_timer timer)
 Stop a timer. More...
 
int ABT_timer_read (ABT_timer timer, double *secs)
 Read the elapsed time of the timer. More...
 
int ABT_timer_stop_and_read (ABT_timer timer, double *secs)
 Stop a timer and read an elapsed time of a timer. More...
 
int ABT_timer_stop_and_add (ABT_timer timer, double *secs)
 Stop a timer and add an elapsed time of a timer. More...
 
int ABT_timer_get_overhead (double *overhead)
 Obtain an overhead time of using ABT_timer. More...
 

Detailed Description

This group is for Timer.

Typedef Documentation

◆ ABT_timer

typedef struct ABT_timer_opaque* ABT_timer

Timer handle type.

A NULL handle of this type is ABT_TIMER_NULL.

Definition at line 1036 of file abt.h.

Function Documentation

◆ ABT_get_wtime()

double ABT_get_wtime ( void  )

Get elapsed wall clock time.

ABT_get_wtime() returns the elapsed wall clock time in seconds since an arbitrary time in the past.

The resolution of elapsed time depends on the clock resolution of the system.

Execution context
This routine can be called in any execution context. Argobots does not need to be initialized. This routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.
Returns
Elapsed wall clock time in seconds

Definition at line 28 of file timer.c.

◆ ABT_timer_create()

int ABT_timer_create ( ABT_timer newtimer)

Create a new timer.

ABT_timer_create() creates a new timer and returns its handle through newtimer. The initial start time and stop time of newtimer are undefined.

The created timer must be freed by ABT_timer_free() after its use.

Changes from Argobots 1.x to Argobots 2.0 (planned)
[Argobots 1.x] newtimer is set to ABT_TIMER_NULL if an error occurs.
[Argobots 2.0] newtimer is not updated if an error occurs.
Rationale
To ensure the atomicity of the API, Argobots 2.0 guarantees that the routine has no effect when an error is returned unless otherwise noted. Argobots 2.0 does not update newtimer when an error occurs.
Execution context
This routine can be called in any execution context. Argobots does not need to be initialized. This routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.
Errors
ABT_SUCCESS is returned if this routine succeeds.
ABT_ERR_MEM is returned if memory allocation fails.
ABT_ERR_SYS is returned if an error related to system calls and standard libraries occurs.
Undefined behavior
If newtimer is NULL, the results are undefined.
Parameters
[out]newtimertimer handle
Returns
Error code

Definition at line 60 of file timer.c.

Referenced by ABT_timer_get_overhead().

◆ ABT_timer_dup()

int ABT_timer_dup ( ABT_timer  timer,
ABT_timer newtimer 
)

Duplicate a timer.

ABT_timer_dup() creates a new timer and copies the start and stop time of the timer timer to the new timer. The handle of the new timer is returned through newtimer.

The created timer must be freed by ABT_timer_free() after its use.

Changes from Argobots 1.x to Argobots 2.0 (planned)
[Argobots 1.x] newtimer is set to ABT_TIMER_NULL if an error occurs.
[Argobots 2.0] newtimer is not updated if an error occurs.
Rationale
To ensure the atomicity of the API, Argobots 2.0 guarantees that the routine has no effect when an error is returned unless otherwise noted. Argobots 2.0 does not update newtimer when an error occurs.
Execution context
This routine can be called in any execution context. Argobots does not need to be initialized. This routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.
Errors
ABT_SUCCESS is returned if this routine succeeds.
ABT_ERR_MEM is returned if memory allocation fails.
ABT_ERR_SYS is returned if an error related to system calls and standard libraries occurs.
ABT_ERR_INV_TIMER is returned if timer is ABT_TIMER_NULL.
Undefined behavior
If newtimer is NULL, the results are undefined.
Parameters
[in]timerhandle to a timer to be duplicated
[out]newtimerhandle to a new timer
Returns
Error code

Definition at line 104 of file timer.c.

◆ ABT_timer_free()

int ABT_timer_free ( ABT_timer timer)

Free a timer.

ABT_timer_free() deallocates the resource used for the timer timer and sets timer to ABT_TIMER_NULL.

Execution context
This routine can be called in any execution context. Argobots does not need to be initialized. This routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.
Errors
ABT_SUCCESS is returned if this routine succeeds.
ABT_ERR_INV_TIMER is returned if timer points to ABT_TIMER_NULL.
Undefined behavior
If timer is NULL, the results are undefined.
If timer is accessed after calling this routine, the results are undefined.
Parameters
[in,out]timertimer handle
Returns
Error code

Definition at line 144 of file timer.c.

Referenced by ABT_timer_get_overhead().

◆ ABT_timer_get_overhead()

int ABT_timer_get_overhead ( double *  overhead)

Obtain an overhead time of using ABT_timer.

ABT_timer_get_overhead() returns the overhead time when measuring the elapsed time with ABT_timer and returns the overhead time in seconds through overhead. It measures the time difference in consecutive calls of ABT_timer_start() and ABT_timer_stop().

The resolution of elapsed time depends on the clock resolution of the system.

This function is deprecated because the returned overhead is not a reliable value. The users are recommended to write their own benchmarks to measure the performance.

Execution context
This routine can be called in any execution context. Argobots does not need to be initialized. This routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.
Errors
ABT_SUCCESS is returned if this routine succeeds.
ABT_ERR_MEM is returned if memory allocation fails.
ABT_ERR_SYS is returned if an error related to system calls and standard libraries occurs.
Undefined behavior
If overhead is NULL, the results are undefined.
Parameters
[out]overheadoverhead time of ABT_timer
Returns
Error code

Definition at line 367 of file timer.c.

◆ ABT_timer_read()

int ABT_timer_read ( ABT_timer  timer,
double *  secs 
)

Read the elapsed time of the timer.

ABT_timer_read() returns the time difference in seconds between the start time and the stop time of the timer timer through secs. If either the start time or the stop time of timer has not been set, secs is set to an undefined value.

The resolution of elapsed time depends on the clock resolution of the system.

Execution context
This routine can be called in any execution context. Argobots does not need to be initialized. This routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.
Errors
ABT_SUCCESS is returned if this routine succeeds.
ABT_ERR_INV_TIMER is returned if timer is ABT_TIMER_NULL.
Undefined behavior
If secs is NULL, the results are undefined.
Parameters
[in]timertimer handle
[out]secselapsed time in seconds
Returns
Error code

Definition at line 243 of file timer.c.

Referenced by ABT_timer_get_overhead().

◆ ABT_timer_start()

int ABT_timer_start ( ABT_timer  timer)

Start a timer.

ABT_timer_start() sets the start time of the timer timer to the current time.

Execution context
This routine can be called in any execution context. Argobots does not need to be initialized. This routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.
Errors
ABT_SUCCESS is returned if this routine succeeds.
ABT_ERR_INV_TIMER is returned if timer is ABT_TIMER_NULL.
Undefined behavior
If timer is accessed concurrently, the results are undefined.
Parameters
[in]timertimer handle
Returns
Error code

Definition at line 180 of file timer.c.

Referenced by ABT_timer_get_overhead().

◆ ABT_timer_stop()

int ABT_timer_stop ( ABT_timer  timer)

Stop a timer.

ABT_timer_stop() sets the stop time of the timer timer to the current time.

Execution context
This routine can be called in any execution context. Argobots does not need to be initialized. This routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.
Errors
ABT_SUCCESS is returned if this routine succeeds.
ABT_ERR_INV_TIMER is returned if timer is ABT_TIMER_NULL.
Undefined behavior
If timer is accessed concurrently, the results are undefined.
Parameters
[in]timertimer handle
Returns
Error code

Definition at line 209 of file timer.c.

Referenced by ABT_timer_get_overhead().

◆ ABT_timer_stop_and_add()

int ABT_timer_stop_and_add ( ABT_timer  timer,
double *  secs 
)

Stop a timer and add an elapsed time of a timer.

ABT_timer_stop_and_add() sets the stop time of the timer timer to the current time and adds the time difference in seconds between the start time and the stop time of timer to secs. If the start time has not been set, the returned value is undefined.

The resolution of elapsed time depends on the clock resolution of the system.

Execution context
This routine can be called in any execution context. Argobots does not need to be initialized. This routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.
Errors
ABT_SUCCESS is returned if this routine succeeds.
ABT_ERR_INV_TIMER is returned if timer is ABT_TIMER_NULL.
Undefined behavior
If secs is NULL, the results are undefined.
If timer is accessed concurrently, the results are undefined.
Parameters
[in]timertimer handle
[in,out]secsaccumulated elapsed time in seconds
Returns
Error code

Definition at line 324 of file timer.c.

◆ ABT_timer_stop_and_read()

int ABT_timer_stop_and_read ( ABT_timer  timer,
double *  secs 
)

Stop a timer and read an elapsed time of a timer.

ABT_timer_stop_and_read() sets the stop time of the timer timer to the current time and returns the time difference in seconds between the start time and the stop time of timer through secs. If the start time of timer has not been set, secs is set to an undefined value.

The resolution of elapsed time depends on the clock resolution of the system.

Execution context
This routine can be called in any execution context. Argobots does not need to be initialized. This routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.
Errors
ABT_SUCCESS is returned if this routine succeeds.
ABT_ERR_INV_TIMER is returned if timer is ABT_TIMER_NULL.
Undefined behavior
If secs is NULL, the results are undefined.
If timer is accessed concurrently, the results are undefined.
Parameters
[in]timertimer handle
[out]secselapsed time in seconds
Returns
Error code

Definition at line 283 of file timer.c.