timemory  3.2.1
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.
tim::component::opaque Struct Reference

#include "timemory/components/opaque/types.hpp"

+ Collaboration diagram for tim::component::opaque:

Public Types

using init_func_t = std::function< void()>
 
using setup_func_t = std::function< void *(void *, const string_view_t &, scope::config)>
 
using push_func_t = std::function< void(void *&, const string_view_t &, scope::config)>
 
using start_func_t = std::function< void(void *)>
 
using stop_func_t = std::function< void(void *)>
 
using pop_func_t = std::function< void(void *)>
 
using get_func_t = std::function< void(void *, void *&, size_t)>
 
using delete_func_t = std::function< void(void *)>
 
using sample_func_t = std::function< void(void *)>
 

Public Member Functions

template<typename InitF , typename StartF , typename StopF , typename GetF , typename DelF , typename SetupF , typename PushF , typename PopF , typename SampleF >
 opaque (bool _valid, size_t _typeid, InitF &&_init, StartF &&_start, StopF &&_stop, GetF &&_get, DelF &&_del, SetupF &&_setup, PushF &&_push, PopF &&_pop, SampleF &&_sample)
 
 opaque ()=default
 
 ~opaque ()
 
 opaque (const opaque &)=default
 
 opaque (opaque &&)=default
 
opaqueoperator= (const opaque &)=default
 
opaqueoperator= (opaque &&)=default
 
 operator bool () const
 
void init () const
 
void setup (const string_view_t &_prefix, scope::config _scope)
 
void push (const string_view_t &_prefix, scope::config _scope)
 
void sample () const
 
void start () const
 
void stop () const
 
void pop () const
 
void cleanup ()
 
void get (void *&ptr, size_t _hash) const
 
void set_copy (bool val)
 

Public Attributes

bool m_valid = false
 
bool m_copy = false
 
size_t m_typeid = 0
 
void * m_data = nullptr
 
init_func_t m_init = []() {}
 
setup_func_t m_setup
 
push_func_t m_push = [](void*&, const string_view_t&, scope::config) {}
 
start_func_t m_start = [](void*) {}
 
stop_func_t m_stop = [](void*) {}
 
pop_func_t m_pop = [](void*) {}
 
get_func_t m_get = [](void*, void*&, size_t) {}
 
delete_func_t m_del = [](void*) {}
 
sample_func_t m_sample = [](void*) {}
 

Detailed Description

Definition at line 45 of file types.hpp.

Member Typedef Documentation

◆ delete_func_t

using tim::component::opaque::delete_func_t = std::function<void(void*)>

Definition at line 54 of file types.hpp.

◆ get_func_t

using tim::component::opaque::get_func_t = std::function<void(void*, void*&, size_t)>

Definition at line 53 of file types.hpp.

◆ init_func_t

using tim::component::opaque::init_func_t = std::function<void()>

Definition at line 47 of file types.hpp.

◆ pop_func_t

using tim::component::opaque::pop_func_t = std::function<void(void*)>

Definition at line 52 of file types.hpp.

◆ push_func_t

using tim::component::opaque::push_func_t = std::function<void(void*&, const string_view_t&, scope::config)>

Definition at line 49 of file types.hpp.

◆ sample_func_t

using tim::component::opaque::sample_func_t = std::function<void(void*)>

Definition at line 55 of file types.hpp.

◆ setup_func_t

using tim::component::opaque::setup_func_t = std::function<void*(void*, const string_view_t&, scope::config)>

Definition at line 48 of file types.hpp.

◆ start_func_t

using tim::component::opaque::start_func_t = std::function<void(void*)>

Definition at line 50 of file types.hpp.

◆ stop_func_t

using tim::component::opaque::stop_func_t = std::function<void(void*)>

Definition at line 51 of file types.hpp.

Constructor & Destructor Documentation

◆ opaque() [1/4]

template<typename InitF , typename StartF , typename StopF , typename GetF , typename DelF , typename SetupF , typename PushF , typename PopF , typename SampleF >
tim::component::opaque::opaque ( bool  _valid,
size_t  _typeid,
InitF &&  _init,
StartF &&  _start,
StopF &&  _stop,
GetF &&  _get,
DelF &&  _del,
SetupF &&  _setup,
PushF &&  _push,
PopF &&  _pop,
SampleF &&  _sample 
)

Definition at line 48 of file declaration.hpp.

51 : m_valid(_valid)
52 , m_typeid(_typeid)
53 , m_init(std::move(_init))
54 , m_setup(std::move(_setup))
55 , m_push(std::move(_push))
56 , m_start(std::move(_start))
57 , m_stop(std::move(_stop))
58 , m_pop(std::move(_pop))
59 , m_get(std::move(_get))
60 , m_del(std::move(_del))
61 , m_sample(std::move(_sample))
62 {}
init_func_t m_init
Definition: types.hpp:88
delete_func_t m_del
Definition: types.hpp:97
sample_func_t m_sample
Definition: types.hpp:98
stop_func_t m_stop
Definition: types.hpp:94
setup_func_t m_setup
Definition: types.hpp:89
push_func_t m_push
Definition: types.hpp:92
get_func_t m_get
Definition: types.hpp:96
start_func_t m_start
Definition: types.hpp:93
pop_func_t m_pop
Definition: types.hpp:95

◆ opaque() [2/4]

tim::component::opaque::opaque ( )
default

◆ ~opaque()

tim::component::opaque::~opaque ( )
inline

Definition at line 66 of file declaration.hpp.

67 {
68  if(m_data)
69  {
70  m_stop(m_data);
71  m_del(m_data);
72  }
73 }

References m_data, m_del, and m_stop.

◆ opaque() [3/4]

tim::component::opaque::opaque ( const opaque )
default

◆ opaque() [4/4]

tim::component::opaque::opaque ( opaque &&  )
default

Member Function Documentation

◆ cleanup()

void tim::component::opaque::cleanup ( )
inline

Definition at line 145 of file declaration.hpp.

146 {
147  if(m_data && !m_copy)
148  m_del(m_data);
149  m_data = nullptr;
150 }

References m_copy, m_data, and m_del.

Referenced by setup().

◆ get()

void tim::component::opaque::get ( void *&  ptr,
size_t  _hash 
) const
inline

Definition at line 155 of file declaration.hpp.

156 {
157  if(m_data)
158  m_get(m_data, ptr, _hash);
159 }

References m_data, and m_get.

◆ init()

void tim::component::opaque::init ( ) const
inline

Definition at line 78 of file declaration.hpp.

79 {
80  m_init();
81 }

References m_init.

◆ operator bool()

tim::component::opaque::operator bool ( ) const
inline

Definition at line 71 of file types.hpp.

71 { return m_valid; }

References m_valid.

◆ operator=() [1/2]

opaque& tim::component::opaque::operator= ( const opaque )
default

◆ operator=() [2/2]

opaque& tim::component::opaque::operator= ( opaque &&  )
default

◆ pop()

void tim::component::opaque::pop ( ) const
inline

Definition at line 136 of file declaration.hpp.

137 {
138  if(m_data)
139  m_pop(m_data);
140 }

References m_data, and m_pop.

◆ push()

void tim::component::opaque::push ( const string_view_t _prefix,
scope::config  _scope 
)
inline

Definition at line 100 of file declaration.hpp.

101 {
102  if(m_data)
103  m_push(m_data, _prefix, _scope);
104 }
char const std::string & _prefix
Definition: definition.hpp:59

References tim::_prefix, m_data, and m_push.

◆ sample()

void tim::component::opaque::sample ( ) const
inline

Definition at line 109 of file declaration.hpp.

110 {
111  if(m_data)
112  m_sample(m_data);
113 }

References m_data, and m_sample.

◆ set_copy()

void tim::component::opaque::set_copy ( bool  val)
inline

Definition at line 164 of file declaration.hpp.

165 {
166  m_copy = val;
167 }

References m_copy.

◆ setup()

void tim::component::opaque::setup ( const string_view_t _prefix,
scope::config  _scope 
)
inline

Definition at line 86 of file declaration.hpp.

87 {
88  if(m_data)
89  {
90  stop();
91  cleanup();
92  }
93  m_data = m_setup(m_data, _prefix, _scope);
94  m_valid = (m_data != nullptr);
95 }

References tim::_prefix, cleanup(), m_data, m_setup, m_valid, and stop().

◆ start()

void tim::component::opaque::start ( ) const
inline

Definition at line 118 of file declaration.hpp.

119 {
120  if(m_data)
121  m_start(m_data);
122 }

References m_data, and m_start.

◆ stop()

void tim::component::opaque::stop ( ) const
inline

Definition at line 127 of file declaration.hpp.

128 {
129  if(m_data)
130  m_stop(m_data);
131 }

References m_data, and m_stop.

Referenced by setup().

Member Data Documentation

◆ m_copy

bool tim::component::opaque::m_copy = false

Definition at line 85 of file types.hpp.

Referenced by cleanup(), and set_copy().

◆ m_data

void* tim::component::opaque::m_data = nullptr

Definition at line 87 of file types.hpp.

Referenced by ~opaque(), cleanup(), get(), pop(), push(), sample(), setup(), start(), and stop().

◆ m_del

delete_func_t tim::component::opaque::m_del = [](void*) {}

Definition at line 97 of file types.hpp.

Referenced by ~opaque(), and cleanup().

◆ m_get

get_func_t tim::component::opaque::m_get = [](void*, void*&, size_t) {}

Definition at line 96 of file types.hpp.

Referenced by get().

◆ m_init

init_func_t tim::component::opaque::m_init = []() {}

Definition at line 88 of file types.hpp.

Referenced by tim::component::factory::hidden::get_opaque(), and init().

◆ m_pop

pop_func_t tim::component::opaque::m_pop = [](void*) {}

Definition at line 95 of file types.hpp.

Referenced by pop().

◆ m_push

push_func_t tim::component::opaque::m_push = [](void*&, const string_view_t&, scope::config) {}

Definition at line 92 of file types.hpp.

Referenced by push().

◆ m_sample

sample_func_t tim::component::opaque::m_sample = [](void*) {}

Definition at line 98 of file types.hpp.

Referenced by sample().

◆ m_setup

setup_func_t tim::component::opaque::m_setup
Initial value:
= [](void*, const string_view_t&, scope::config) {
return nullptr;
}
std::string string_view_t
Definition: language.hpp:100

Definition at line 89 of file types.hpp.

Referenced by setup().

◆ m_start

start_func_t tim::component::opaque::m_start = [](void*) {}

Definition at line 93 of file types.hpp.

Referenced by start().

◆ m_stop

stop_func_t tim::component::opaque::m_stop = [](void*) {}

Definition at line 94 of file types.hpp.

Referenced by ~opaque(), and stop().

◆ m_typeid

size_t tim::component::opaque::m_typeid = 0

Definition at line 86 of file types.hpp.

◆ m_valid

bool tim::component::opaque::m_valid = false

Definition at line 84 of file types.hpp.

Referenced by tim::component::factory::hidden::get_opaque(), operator bool(), and setup().


The documentation for this struct was generated from the following files: