timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
|
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "timemory/compat/macros.h"
#include "timemory/enum.h"
Go to the source code of this file.
Typedefs | |
typedef void(* | timemory_create_func_t) (const char *, uint64_t *, int, int *) |
typedef void(* | timemory_delete_func_t) (uint64_t) |
function pointer type for timemory_delete_function More... | |
Functions | |
uint64_t | timemory_get_unique_id (void) |
Returns a unique integer for a thread. More... | |
void | timemory_create_record (const char *name, uint64_t *id, int n, int *ct) |
void | timemory_delete_record (uint64_t nid) |
Deletes the record created by timemory_create_record. More... | |
bool | timemory_library_is_initialized (void) |
Returns whether the library is initialized or not. More... | |
void | timemory_named_init_library (char *name) |
void | timemory_init_library (int argc, char **argv) |
Initializes timemory. Not strictly necessary but highly recommended. More... | |
void | timemory_finalize_library (void) |
Finalizes timemory. Output will be generated. Any attempt to store data within timemory storage is undefined after this point and will likely cause errors. More... | |
void | timemory_pause (void) |
Turn off timemory collection. More... | |
void | timemory_resume (void) |
Turn on timemory collection. More... | |
void | timemory_set_default (const char *components) |
Pass in a default set of components to use. Will be overridden by TIMEMORY_COMPONENTS environment variable. More... | |
void | timemory_set_environ (const char *evar, const char *eval, int ovr, int up) |
void | timemory_add_components (const char *components) |
Add some components to the current set of components being collected Any components which are currently being collected are ignored. More... | |
void | timemory_remove_components (const char *components) |
Remove some components to the current set of components being collected. Any components which are not currently being collected are ignored. More... | |
void | timemory_push_components (const char *components) |
Replace the current set of components with a new set of components. More... | |
void | timemory_push_components_enum (int args,...) |
Replace the current set of components with a new set of components with the set of enumerations provided to the function. First argument should be the number of new components. More... | |
void | timemory_pop_components (void) |
Inverse of the last timemory_push_components or timemory_push_components_enum call. Popping all components will restore to set the configured as the default. More... | |
void | timemory_begin_record (const char *name, uint64_t *id) |
void | timemory_begin_record_enum (const char *name, uint64_t *,...) |
Similar to timemory_begin_record but accepts a specific enumerated set of components, which is terminated by TIMEMORY_COMPONENTS_END. More... | |
void | timemory_begin_record_types (const char *name, uint64_t *, const char *) |
Similar to timemory_begin_record but accepts a specific set of components as a string. More... | |
uint64_t | timemory_get_begin_record (const char *name) |
Variant to timemory_begin_record which returns a unique integer. More... | |
uint64_t | timemory_get_begin_record_enum (const char *name,...) |
Variant to timemory_begin_record_enum which returns a unique integer. More... | |
uint64_t | timemory_get_begin_record_types (const char *name, const char *ctypes) |
Variant to timemory_begin_record_types which returns a unique integer. More... | |
void | timemory_end_record (uint64_t id) |
void | timemory_push_region (const char *name) |
void | timemory_pop_region (const char *name) |
void | c_timemory_init (int argc, char **argv, timemory_settings) |
void | c_timemory_finalize (void) |
int | c_timemory_enabled (void) |
void * | c_timemory_create_auto_timer (const char *) |
void | c_timemory_delete_auto_timer (void *) |
void * | c_timemory_create_auto_tuple (const char *,...) |
void | c_timemory_delete_auto_tuple (void *) |
const char * | c_timemory_blank_label (const char *) |
const char * | c_timemory_basic_label (const char *, const char *) |
const char * | c_timemory_label (const char *, const char *, int, const char *) |
int | cxx_timemory_enabled (void) |
void | cxx_timemory_init (int, char **, timemory_settings) |
void * | cxx_timemory_create_auto_timer (const char *) |
void * | cxx_timemory_create_auto_tuple (const char *, int, const int *) |
void * | cxx_timemory_delete_auto_timer (void *) |
void * | cxx_timemory_delete_auto_tuple (void *) |
const char * | cxx_timemory_label (int, int, const char *, const char *, const char *) |
bool | timemory_trace_is_initialized (void) |
void | timemory_reset_throttle (const char *name) |
bool | timemory_is_throttled (const char *name) |
void | timemory_add_hash_id (uint64_t id, const char *name) |
void | timemory_add_hash_ids (uint64_t nentries, uint64_t *ids, const char **names) |
void | timemory_push_trace_hash (uint64_t id) |
void | timemory_pop_trace_hash (uint64_t id) |
void | timemory_push_trace (const char *name) |
void | timemory_pop_trace (const char *name) |
void | timemory_trace_init (const char *, bool, const char *) |
void | timemory_trace_finalize (void) |
void | timemory_trace_set_env (const char *, const char *) |
Variables | |
timemory_create_func_t | timemory_create_function |
The function pointer to set to customize which components are used by library interface. More... | |
timemory_delete_func_t | timemory_delete_function |
The function pointer to set which deletes an entry created by timemory_create_function. More... | |
typedef void(* timemory_create_func_t) (const char *, uint64_t *, int, int *) |
void(* timemory_delete_func_t)(uint64_t) |
function pointer type for timemory_delete_function
const char * c_timemory_basic_label | ( | const char * | _func, |
const char * | _extra | ||
) |
Definition at line 138 of file timemory_c.c.
References cxx_timemory_label().
const char * c_timemory_blank_label | ( | const char * | _extra | ) |
Definition at line 131 of file timemory_c.c.
References cxx_timemory_label().
void * c_timemory_create_auto_timer | ( | const char * | tag | ) |
Definition at line 73 of file timemory_c.c.
References cxx_timemory_create_auto_timer(), and cxx_timemory_enabled().
void * c_timemory_create_auto_tuple | ( | const char * | tag, |
... | |||
) |
Definition at line 83 of file timemory_c.c.
References tim::components, cxx_timemory_create_auto_tuple(), cxx_timemory_enabled(), and TIMEMORY_COMPONENTS_END.
void c_timemory_delete_auto_timer | ( | void * | ctimer | ) |
Definition at line 115 of file timemory_c.c.
References cxx_timemory_delete_auto_timer().
void c_timemory_delete_auto_tuple | ( | void * | ctuple | ) |
Definition at line 123 of file timemory_c.c.
References cxx_timemory_delete_auto_tuple().
int c_timemory_enabled | ( | void | ) |
void c_timemory_finalize | ( | void | ) |
Definition at line 65 of file timemory_c.c.
References timemory_finalize_library().
void c_timemory_init | ( | int | argc, |
char ** | argv, | ||
timemory_settings | _settings | ||
) |
Definition at line 57 of file timemory_c.c.
References tim::_settings, tim::argv, cxx_timemory_init(), and timemory_init_library().
const char * c_timemory_label | ( | const char * | _func, |
const char * | _file, | ||
int | _line, | ||
const char * | _extra | ||
) |
Definition at line 145 of file timemory_c.c.
References tim::plotting::_file, and cxx_timemory_label().
void * cxx_timemory_create_auto_timer | ( | const char * | ) |
Referenced by c_timemory_create_auto_timer().
void * cxx_timemory_create_auto_tuple | ( | const char * | , |
int | , | ||
const int * | |||
) |
Referenced by c_timemory_create_auto_tuple().
void * cxx_timemory_delete_auto_timer | ( | void * | ) |
Referenced by c_timemory_delete_auto_timer().
void * cxx_timemory_delete_auto_tuple | ( | void * | ) |
Referenced by c_timemory_delete_auto_tuple().
int cxx_timemory_enabled | ( | void | ) |
Referenced by c_timemory_create_auto_timer(), c_timemory_create_auto_tuple(), and c_timemory_enabled().
void cxx_timemory_init | ( | int | , |
char ** | , | ||
timemory_settings | |||
) |
Referenced by c_timemory_init().
const char * cxx_timemory_label | ( | int | , |
int | , | ||
const char * | , | ||
const char * | , | ||
const char * | |||
) |
Referenced by c_timemory_basic_label(), c_timemory_blank_label(), and c_timemory_label().
void timemory_add_components | ( | const char * | _component_string | ) |
Add some components to the current set of components being collected Any components which are currently being collected are ignored.
Definition at line 348 of file library.cpp.
References tim::enumerate_components(), and get_current_components().
void timemory_add_hash_id | ( | uint64_t | id, |
const char * | name | ||
) |
Definition at line 392 of file trace.cpp.
References tim::debug.
Referenced by timemory_add_hash_ids().
void timemory_add_hash_ids | ( | uint64_t | nentries, |
uint64_t * | ids, | ||
const char ** | names | ||
) |
Definition at line 420 of file trace.cpp.
References tim::debug, and timemory_add_hash_id().
void timemory_begin_record | ( | const char * | name, |
uint64_t * | id | ||
) |
[in] | name | Label for the record |
[in,out] | id | identifier passed back to timemory_end_record |
Definition at line 409 of file library.cpp.
References tim::enabled, get_current_components(), std::max(), timemory_create_record(), and tim::verbose.
Referenced by timemory_begin_record_().
void timemory_begin_record_enum | ( | const char * | name, |
uint64_t * | id, | ||
... | |||
) |
Similar to timemory_begin_record but accepts a specific enumerated set of components, which is terminated by TIMEMORY_COMPONENTS_END.
Definition at line 450 of file library.cpp.
References tim::enabled, std::max(), TIMEMORY_COMPONENTS_END, timemory_create_record(), and tim::verbose.
void timemory_begin_record_types | ( | const char * | name, |
uint64_t * | id, | ||
const char * | ctypes | ||
) |
Similar to timemory_begin_record but accepts a specific set of components as a string.
Definition at line 429 of file library.cpp.
References tim::enabled, tim::enumerate_components(), std::max(), timemory_create_record(), and tim::verbose.
Referenced by timemory_begin_record_types_().
void timemory_create_record | ( | const char * | name, |
uint64_t * | id, | ||
int | n, | ||
int * | ctypes | ||
) |
[in] | name | label for the record |
[in,out] | id | assigned a unique identifier for the record |
[in] | n | number of components |
[in] | ct | array of enumeration identifiers of size n |
Function called by timemory_begin_record, timemory_begin_record_enum, timemory_begin_record_types, timemory_get_begin_record, timemory_get_begin_record_enum, timemory_get_begin_record_types, timemory_push_region for creating and starting the current collection of components.
Definition at line 156 of file library.cpp.
References timemory_create_function.
Referenced by timemory_begin_record(), timemory_begin_record_enum(), timemory_begin_record_types(), timemory_create_record_(), timemory_get_begin_record(), timemory_get_begin_record_enum(), and timemory_get_begin_record_types().
void timemory_delete_record | ( | uint64_t | nid | ) |
Deletes the record created by timemory_create_record.
Definition at line 177 of file library.cpp.
References timemory_delete_function.
Referenced by timemory_delete_record_(), and timemory_end_record().
void timemory_end_record | ( | uint64_t | id | ) |
[in] | id | Identifier for the recording entry |
Definition at line 557 of file library.cpp.
References std::max(), timemory_delete_record(), and tim::verbose.
Referenced by timemory_end_record_().
void timemory_finalize_library | ( | void | ) |
Finalizes timemory. Output will be generated. Any attempt to store data within timemory storage is undefined after this point and will likely cause errors.
Definition at line 253 of file library.cpp.
References get_library_state().
Referenced by c_timemory_finalize(), and timemory_finalize_library_().
uint64_t timemory_get_begin_record | ( | const char * | name | ) |
Variant to timemory_begin_record which returns a unique integer.
Definition at line 482 of file library.cpp.
References tim::enabled, get_current_components(), std::max(), timemory_create_record(), and tim::verbose.
Referenced by timemory_get_begin_record_().
uint64_t timemory_get_begin_record_enum | ( | const char * | name, |
... | |||
) |
Variant to timemory_begin_record_enum which returns a unique integer.
Definition at line 524 of file library.cpp.
References tim::enabled, std::max(), TIMEMORY_COMPONENTS_END, timemory_create_record(), and tim::verbose.
uint64_t timemory_get_begin_record_types | ( | const char * | name, |
const char * | ctypes | ||
) |
Variant to timemory_begin_record_types which returns a unique integer.
Definition at line 503 of file library.cpp.
References tim::enabled, tim::enumerate_components(), std::max(), timemory_create_record(), and tim::verbose.
Referenced by timemory_get_begin_record_types_().
uint64_t timemory_get_unique_id | ( | void | ) |
Returns a unique integer for a thread.
Definition at line 144 of file library.cpp.
void timemory_init_library | ( | int | argc, |
char ** | argv | ||
) |
Initializes timemory. Not strictly necessary but highly recommended.
Definition at line 212 of file library.cpp.
References tim::argv, get_library_state(), and tim::verbose.
Referenced by c_timemory_init(), timemory_init_library_(), timemory_named_init_library(), and timemory_trace_init().
bool timemory_library_is_initialized | ( | void | ) |
Returns whether the library is initialized or not.
Definition at line 195 of file library.cpp.
References get_library_state().
void timemory_named_init_library | ( | char * | name | ) |
void timemory_pause | ( | void | ) |
void timemory_pop_components | ( | void | ) |
Inverse of the last timemory_push_components or timemory_push_components_enum call. Popping all components will restore to set the configured as the default.
Definition at line 399 of file library.cpp.
Referenced by timemory_pop_components_().
void timemory_pop_region | ( | const char * | name | ) |
[in] | name | label for region |
Stops collection of components with label.
Definition at line 587 of file library.cpp.
Referenced by timemory_pop_region_().
void timemory_pop_trace | ( | const char * | name | ) |
Definition at line 632 of file trace.cpp.
References get_library_state(), std::max(), and timemory_pop_trace_hash().
void timemory_pop_trace_hash | ( | uint64_t | id | ) |
Definition at line 514 of file trace.cpp.
References get_library_state().
Referenced by timemory_pop_trace().
void timemory_push_components | ( | const char * | _component_string | ) |
Replace the current set of components with a new set of components.
Definition at line 368 of file library.cpp.
Referenced by timemory_push_components_().
void timemory_push_components_enum | ( | int | types, |
... | |||
) |
Replace the current set of components with a new set of components with the set of enumerations provided to the function. First argument should be the number of new components.
Definition at line 377 of file library.cpp.
void timemory_push_region | ( | const char * | name | ) |
[in] | name | label for region |
Starts collection of components with label.
Definition at line 573 of file library.cpp.
Referenced by timemory_push_region_().
void timemory_push_trace | ( | const char * | name | ) |
Definition at line 608 of file trace.cpp.
References tim::debug, tim::enabled, get_library_state(), std::max(), PRINT_HERE, timemory_push_trace_hash(), timemory_trace_init(), and timemory_trace_is_initialized().
void timemory_push_trace_hash | ( | uint64_t | id | ) |
Definition at line 448 of file trace.cpp.
References tim::consume_parameters(), tim::debug, tim::enabled, get_library_state(), PRINT_HERE, timemory_copy_hash_ids(), timemory_trace_init(), and timemory_trace_is_initialized().
Referenced by timemory_push_trace().
void timemory_remove_components | ( | const char * | _component_string | ) |
Remove some components to the current set of components being collected. Any components which are not currently being collected are ignored.
Definition at line 358 of file library.cpp.
References tim::enumerate_components(), and get_current_components().
void timemory_resume | ( | void | ) |
void timemory_set_default | ( | const char * | _component_string | ) |
Pass in a default set of components to use. Will be overridden by TIMEMORY_COMPONENTS environment variable.
Definition at line 322 of file library.cpp.
References get_default_components().
Referenced by timemory_set_default_().
void timemory_set_environ | ( | const char * | evar, |
const char * | eval, | ||
int | over, | ||
int | parse | ||
) |
[in] | evar | Environment variable name |
[in] | eval | Environment variable value |
[in] | ovr | Overwrite existing environment variable when > 0 |
[in] | up | Update settings when > 0 |
Set an environment variable and (potentially) update settings with new value.
Definition at line 335 of file library.cpp.
References tim::settings::parse(), and tim::set_env().
void timemory_trace_finalize | ( | void | ) |
Definition at line 808 of file trace.cpp.
void timemory_trace_init | ( | const char * | comps, |
bool | read_command_line, | ||
const char * | cmd | ||
) |
Definition at line 671 of file trace.cpp.
References tim::plotting::cmd, tim::exe_name, tim::manager::instance(), tim::output_path, tim::config::read_command_line(), and timemory_init_library().
Referenced by timemory_push_trace(), and timemory_push_trace_hash().
bool timemory_trace_is_initialized | ( | void | ) |
Definition at line 366 of file trace.cpp.
References get_library_state().
Referenced by timemory_push_trace(), and timemory_push_trace_hash().
void timemory_trace_set_env | ( | const char * | env_var, |
const char * | env_val | ||
) |
Definition at line 658 of file trace.cpp.
References get_library_state(), and tim::settings::parse().
|
extern |
The function pointer to set to customize which components are used by library interface.
Definition at line 51 of file library.cpp.
Referenced by timemory_create_record().
|
extern |
The function pointer to set which deletes an entry created by timemory_create_function.
Definition at line 52 of file library.cpp.
Referenced by timemory_delete_record().