Functions and types related to time measurement.
More...
#include <float.h>
#include "error.h"
Go to the source code of this file.
|
#define | MIN(x, y) ((x)<(y)?(x):(y)) |
|
#define | MAX(x, y) ((x)<(y)?(y):(x)) |
|
#define | GHOST_TIME(nIter, func,...) |
| Measure the execution time of a function with a given numbe of iterations. More...
|
|
Functions and types related to time measurement.
- Author
- Moritz Kreutzer morit.nosp@m.z.kr.nosp@m.eutze.nosp@m.r@fa.nosp@m.u.de
#define GHOST_TIME |
( |
|
nIter, |
|
|
|
func, |
|
|
|
... |
|
) |
| |
Value:double func ## _start, func ## _end, func ## _tstart, func ## _tend;\
double func ## _tmin = DBL_MAX;\
double func ## _tmax = 0.;\
double func ## _tavg = 0.;\
for (func ## _it=0; func ## _it<nIter; func ## _it++) {
\
func ## _tmin =
MIN(func ## _end-func ## _start,func ## _tmin);\
func ## _tmax =
MAX(func ## _end-func ## _start,func ## _tmax);\
func ## _tavg = (func ## _tend - func ## _tstart)/((double)nIter);\
#define MAX(x, y)
Definition: timing.h:17
ghost_error ghost_timing_wc(double *time)
Get the wallclock time in seconds.
Definition: timing.c:25
#define MIN(x, y)
Definition: timing.h:14
Measure the execution time of a function with a given numbe of iterations.
- Parameters
-
nIter | The number of iterations. |
func | The function. |
... | The function's arguments. |
This macro creates the variables <func>_tmin/_tmax/_tavg of type double holding the minimal, maximal and average execution time.
#define MAX |
( |
|
x, |
|
|
|
y |
|
) |
| ((x)<(y)?(y):(x)) |
#define MIN |
( |
|
x, |
|
|
|
y |
|
) |
| ((x)<(y)?(x):(y)) |
typedef int(* ghost_compute_performance_func)(double *perf, double time, void *arg) |
void ghost_timing_destroy |
( |
| ) |
|
Free timing data structures.
Obtain timing info about a specific region.
- Parameters
-
region | Where to store the information. |
tag | The region tag. |
- Returns
- GHOST_SUCCESS on success or an error indicator.
Destroy a timing region.
- Parameters
-
void ghost_timing_set_perfFunc |
( |
const char * |
prefix, |
|
|
const char * |
tag, |
|
|
ghost_compute_performance_func |
func, |
|
|
void * |
arg, |
|
|
size_t |
sizeofarg, |
|
|
const char * |
unit |
|
) |
| |
Set a performance computation function to a given tag.
- Parameters
-
[in] | prefix | The prefix of the region tag. Usually the variable __ghost_functag can be used here. |
[in] | tag | The region tag. |
[in] | func | The performance callback function. |
[in] | arg | Argument to the function. |
[in] | sizeofarg | Size of the arg struct. |
[in] | unit | The unit of performance. |
Summarize all timed regions into a string.
- Parameters
-
str | Where to store the string. |
- Returns
- GHOST_SUCCESS on success or an error indicator.
void ghost_timing_tick |
( |
const char * |
tag | ) |
|
Save the start time for a region.
- Parameters
-
void ghost_timing_tock |
( |
const char * |
tag | ) |
|
Get the wallclock time in seconds.
- Parameters
-
time | Where to store the time. |
- Returns
- GHOST_SUCCESS on success or an error indicator.
Get the wallclock time in milliseconds.
- Parameters
-
time | Where to store the time. |
- Returns
- GHOST_SUCCESS on success or an error indicator.