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.
timemory_c.c File Reference
#include "timemory/enum.h"
#include "timemory/library.h"
#include "timemory/timemory.h"
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ Include dependency graph for timemory_c.c:

Go to the source code of this file.

Functions

char * strdup (const char *s)
 
void c_timemory_init (int argc, char **argv, timemory_settings _settings)
 
void c_timemory_finalize (void)
 
int c_timemory_enabled (void)
 
void * c_timemory_create_auto_timer (const char *tag)
 
void * c_timemory_create_auto_tuple (const char *tag,...)
 
void c_timemory_delete_auto_timer (void *ctimer)
 
void c_timemory_delete_auto_tuple (void *ctuple)
 
const char * c_timemory_blank_label (const char *_extra)
 
const char * c_timemory_basic_label (const char *_func, const char *_extra)
 
const char * c_timemory_label (const char *_func, const char *_file, int _line, const char *_extra)
 

Function Documentation

◆ c_timemory_basic_label()

const char * c_timemory_basic_label ( const char *  _func,
const char *  _extra 
)

Definition at line 138 of file timemory_c.c.

139 {
140 return cxx_timemory_label(1, 0, _func, "", _extra);
141 }
const char * cxx_timemory_label(int, int, const char *, const char *, const char *)

References cxx_timemory_label().

◆ c_timemory_blank_label()

const char * c_timemory_blank_label ( const char *  _extra)

Definition at line 131 of file timemory_c.c.

132 {
133 return cxx_timemory_label(0, 0, "", "", _extra);
134 }

References cxx_timemory_label().

◆ c_timemory_create_auto_timer()

void * c_timemory_create_auto_timer ( const char *  tag)

Definition at line 73 of file timemory_c.c.

74 {
75 void* _ret = NULL;
78 return _ret;
79 }
int cxx_timemory_enabled(void)
void * cxx_timemory_create_auto_timer(const char *)
const hash_alias_ptr_t hash_value_t std::string *& _ret
Definition: definition.hpp:300

References cxx_timemory_create_auto_timer(), and cxx_timemory_enabled().

◆ c_timemory_create_auto_tuple()

void * c_timemory_create_auto_tuple ( const char *  tag,
  ... 
)

Definition at line 83 of file timemory_c.c.

84 {
86 return NULL;
87
88 const int max_size = (int) TIMEMORY_COMPONENTS_END;
89 int num_components = 0;
90 int* components = (int*) malloc(max_size * sizeof(int));
91 if(!components)
92 return NULL;
93 va_list args;
94 va_start(args, tag);
95 for(int i = 0; i < max_size; ++i)
96 {
97 int comp = va_arg(args, int);
98 if(comp >= TIMEMORY_COMPONENTS_END)
99 break;
100 ++num_components;
101 components[i] = comp;
102 }
103 va_end(args);
104
105 void* ptr = NULL;
106 if(num_components > 0)
107 ptr = cxx_timemory_create_auto_tuple(tag, num_components, components);
108 free(components);
109
110 return ptr;
111 }
void * cxx_timemory_create_auto_tuple(const char *, int, const int *)
#define TIMEMORY_COMPONENTS_END
Definition: enum.h:155
components
Definition: settings.cpp:1700

References tim::components, cxx_timemory_create_auto_tuple(), cxx_timemory_enabled(), and TIMEMORY_COMPONENTS_END.

◆ c_timemory_delete_auto_timer()

void c_timemory_delete_auto_timer ( void *  ctimer)

Definition at line 115 of file timemory_c.c.

116 {
117 ctimer = cxx_timemory_delete_auto_timer(ctimer);
118 assert(ctimer == NULL);
119 }
void * cxx_timemory_delete_auto_timer(void *)

References cxx_timemory_delete_auto_timer().

◆ c_timemory_delete_auto_tuple()

void c_timemory_delete_auto_tuple ( void *  ctuple)

Definition at line 123 of file timemory_c.c.

124 {
125 ctuple = cxx_timemory_delete_auto_tuple(ctuple);
126 assert(ctuple == NULL);
127 }
void * cxx_timemory_delete_auto_tuple(void *)

References cxx_timemory_delete_auto_tuple().

◆ c_timemory_enabled()

int c_timemory_enabled ( void  )

Definition at line 69 of file timemory_c.c.

69{ return cxx_timemory_enabled(); }

References cxx_timemory_enabled().

◆ c_timemory_finalize()

void c_timemory_finalize ( void  )

Definition at line 65 of file timemory_c.c.

void timemory_finalize_library(void)
Finalizes timemory. Output will be generated. Any attempt to store data within timemory storage is un...
Definition: library.cpp:253

References timemory_finalize_library().

◆ c_timemory_init()

void c_timemory_init ( int  argc,
char **  argv,
timemory_settings  _settings 
)

Definition at line 57 of file timemory_c.c.

58 {
61 }
void cxx_timemory_init(int, char **, timemory_settings)
void timemory_init_library(int argc, char **argv)
Initializes timemory. Not strictly necessary but highly recommended.
Definition: library.cpp:212
char ** argv
Definition: config.cpp:55
char argparse::argument_parser tim::settings * _settings
Definition: config.cpp:255

References tim::_settings, tim::argv, cxx_timemory_init(), and timemory_init_library().

◆ c_timemory_label()

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.

147 {
148 return cxx_timemory_label(2, _line, _func, _file, _extra);
149 }
const auto & _file
Definition: definition.hpp:72

References tim::plotting::_file, and cxx_timemory_label().

◆ strdup()

char * strdup ( const char *  s)

Definition at line 41 of file timemory_c.c.

42 {
43 size_t slen = strlen(s);
44 char* result = malloc(slen + 1);
45 if(result == NULL)
46 {
47 return NULL;
48 }
49
50 memcpy(result, s, slen + 1);
51 return result;
52 }

Referenced by tim::argparse::argument_vector::get_execv(), kokkosp_init_library(), and tim::argparse::argument_parser::parse_known_args().