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.
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 *, string_view_cref_t, scope::config)>
 
using push_func_t = std::function< void(void *&, string_view_cref_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 *)>
 
using stats_func_t = std::function< void(void *, bool)>
 

Public Member Functions

template<typename InitF , typename StartF , typename StopF , typename GetF , typename DelF , typename SetupF , typename PushF , typename PopF , typename SampleF , typename UpdateStatsF >
 opaque (bool _valid, size_t _typeid, InitF &&_init, StartF &&_start, StopF &&_stop, GetF &&_get, DelF &&_del, SetupF &&_setup, PushF &&_push, PopF &&_pop, SampleF &&_sample, UpdateStatsF &&_stats)
 
 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 (string_view_cref_t _prefix, scope::config _scope)
 
void push (string_view_cref_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 update_statistics (bool) 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*&, string_view_cref_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*) {}
 
stats_func_t m_update_stats = [](void*, bool) {}
 

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

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

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.

◆ stats_func_t

using tim::component::opaque::stats_func_t = std::function<void(void*, bool)>

Definition at line 56 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 , typename UpdateStatsF >
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,
UpdateStatsF &&  _stats 
)

Definition at line 49 of file declaration.hpp.

52: m_valid(_valid)
53, m_typeid(_typeid)
54, m_init(std::move(_init))
55, m_setup(std::move(_setup))
56, m_push(std::move(_push))
57, m_start(std::move(_start))
58, m_stop(std::move(_stop))
59, m_pop(std::move(_pop))
60, m_get(std::move(_get))
61, m_del(std::move(_del))
62, m_sample(std::move(_sample))
63, m_update_stats(std::move(_update_stats))
64{}
init_func_t m_init
Definition: types.hpp:90
delete_func_t m_del
Definition: types.hpp:99
stats_func_t m_update_stats
Definition: types.hpp:101
sample_func_t m_sample
Definition: types.hpp:100
stop_func_t m_stop
Definition: types.hpp:96
setup_func_t m_setup
Definition: types.hpp:91
push_func_t m_push
Definition: types.hpp:94
get_func_t m_get
Definition: types.hpp:98
start_func_t m_start
Definition: types.hpp:95
pop_func_t m_pop
Definition: types.hpp:97

◆ opaque() [2/4]

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

◆ ~opaque()

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

Definition at line 68 of file declaration.hpp.

69{
70 if(m_data)
71 {
74 }
75}

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 147 of file declaration.hpp.

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

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 157 of file declaration.hpp.

158{
159 if(m_data)
160 m_get(m_data, ptr, _hash);
161}

References m_data, and m_get.

◆ init()

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

Definition at line 80 of file declaration.hpp.

81{
82 m_init();
83}

References m_init.

◆ operator bool()

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

Definition at line 72 of file types.hpp.

72{ 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 138 of file declaration.hpp.

139{
140 if(m_data)
141 m_pop(m_data);
142}

References m_data, and m_pop.

◆ push()

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

Definition at line 102 of file declaration.hpp.

103{
104 if(m_data)
105 m_push(m_data, _prefix, _scope);
106}
char const std::string & _prefix
Definition: config.cpp:55

References tim::_prefix, m_data, and m_push.

◆ sample()

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

Definition at line 111 of file declaration.hpp.

112{
113 if(m_data)
115}

References m_data, and m_sample.

◆ set_copy()

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

Definition at line 175 of file declaration.hpp.

176{
177 m_copy = val;
178}

References m_copy.

◆ setup()

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

Definition at line 88 of file declaration.hpp.

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

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

◆ start()

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

Definition at line 120 of file declaration.hpp.

121{
122 if(m_data)
124}

References m_data, and m_start.

◆ stop()

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

Definition at line 129 of file declaration.hpp.

130{
131 if(m_data)
132 m_stop(m_data);
133}

References m_data, and m_stop.

Referenced by setup().

◆ update_statistics()

void tim::component::opaque::update_statistics ( bool  _v) const
inline

Definition at line 166 of file declaration.hpp.

167{
168 if(m_data)
170}

References m_data, and m_update_stats.

Member Data Documentation

◆ m_copy

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

Definition at line 87 of file types.hpp.

Referenced by cleanup(), and set_copy().

◆ m_data

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

Definition at line 89 of file types.hpp.

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

◆ m_del

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

Definition at line 99 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 98 of file types.hpp.

Referenced by get().

◆ m_init

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

Definition at line 90 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 97 of file types.hpp.

Referenced by pop().

◆ m_push

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

Definition at line 94 of file types.hpp.

Referenced by push().

◆ m_sample

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

Definition at line 100 of file types.hpp.

Referenced by sample().

◆ m_setup

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

Definition at line 91 of file types.hpp.

Referenced by setup().

◆ m_start

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

Definition at line 95 of file types.hpp.

Referenced by start().

◆ m_stop

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

Definition at line 96 of file types.hpp.

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

◆ m_typeid

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

Definition at line 88 of file types.hpp.

◆ m_update_stats

stats_func_t tim::component::opaque::m_update_stats = [](void*, bool) {}

Definition at line 101 of file types.hpp.

Referenced by update_statistics().

◆ m_valid

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

Definition at line 86 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: