GHOST  1.1.2
General, Hybrid, and Optimized Sparse Toolkit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Classes | Functions | Variables
timing.cpp File Reference
#include "ghost/timing.h"
#include "ghost/util.h"
#include <map>
#include <vector>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <algorithm>
Include dependency graph for timing.cpp:

Classes

struct  ghost_timing_perfFunc
 
struct  ghost_timing_region_accu
 Region timing accumulator. More...
 

Functions

void ghost_timing_tick (const char *tag)
 Save the start time for a region. More...
 
void ghost_timing_tock (const char *tag)
 Save the runtime for a region using the start time from ghost_timing_tick(). More...
 
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. More...
 
ghost_error ghost_timing_region_create (ghost_timing_region **ri, const char *tag)
 Obtain timing info about a specific region. More...
 
void ghost_timing_region_destroy (ghost_timing_region *ri)
 Destroy a timing region. More...
 
void ghost_timing_destroy ()
 Free timing data structures. More...
 
ghost_error ghost_timing_summarystring (char **str)
 Summarize all timed regions into a string. More...
 

Variables

static map< string,
ghost_timing_region_accu
timings
 
static pthread_mutex_t timingsMutex = PTHREAD_MUTEX_INITIALIZER
 

Function Documentation

void ghost_timing_destroy ( )

Free timing data structures.

ghost_error ghost_timing_region_create ( ghost_timing_region **  region,
const char *  tag 
)

Obtain timing info about a specific region.

Parameters
regionWhere to store the information.
tagThe region tag.
Returns
GHOST_SUCCESS on success or an error indicator.

Here is the call graph for this function:

void ghost_timing_region_destroy ( ghost_timing_region region)

Destroy a timing region.

Parameters
regionThe region.
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]prefixThe prefix of the region tag. Usually the variable __ghost_functag can be used here.
[in]tagThe region tag.
[in]funcThe performance callback function.
[in]argArgument to the function.
[in]sizeofargSize of the arg struct.
[in]unitThe unit of performance.

Here is the call graph for this function:

ghost_error ghost_timing_summarystring ( char **  str)

Summarize all timed regions into a string.

Parameters
strWhere to store the string.
Returns
GHOST_SUCCESS on success or an error indicator.

Here is the call graph for this function:

void ghost_timing_tick ( const char *  tag)

Save the start time for a region.

Parameters
tagThe region tag.

Here is the call graph for this function:

void ghost_timing_tock ( const char *  tag)

Save the runtime for a region using the start time from ghost_timing_tick().

Parameters
tagThe region tag.

Here is the call graph for this function:

Variable Documentation

map<string,ghost_timing_region_accu> timings
static
pthread_mutex_t timingsMutex = PTHREAD_MUTEX_INITIALIZER
static