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.
|
The gotcha component rewrites the global offset table such that calling the wrapped function actually invokes either a function which is wrapped by timemory instrumentation or is replaced by a timemory component with an function call operator (operator()
) whose return value and arguments exactly match the original function. This component is only available on Linux and can only by applied to external, dynamically-linked functions (i.e. functions defined in a shared library). If the BundleT
template parameter is a non-empty component bundle, this component will surround the original function call with:
More...
#include "timemory/components/gotcha/components.hpp"
Classes | |
struct | instrument |
Public Types | |
using | value_type = void |
using | this_type = gotcha< Nt, BundleT, DiffT > |
using | base_type = base< this_type, value_type > |
using | storage_type = typename base_type::storage_type |
using | tuple_type = concepts::tuple_type_t< BundleT > |
using | bundle_type = concepts::component_type_t< BundleT > |
template<typename Tp > | |
using | array_t = std::array< Tp, Nt > |
using | binding_t = backend::gotcha::binding_t |
using | wrappee_t = backend::gotcha::wrappee_t |
using | wrappid_t = backend::gotcha::string_t |
using | error_t = backend::gotcha::error_t |
using | constructor_t = std::function< void()> |
using | destructor_t = std::function< void()> |
using | atomic_bool_t = std::atomic< bool > |
using | select_list_t = std::set< std::string > |
using | config_t = void |
using | get_initializer_t = std::function< config_t()> |
using | get_select_list_t = std::function< select_list_t()> |
using | operator_type = typename std::conditional< differ_is_component, DiffT, void >::type |
Public Member Functions | |
void | start () |
void | stop () |
Static Public Member Functions | |
static std::string | label () |
static std::string | description () |
static value_type | record () |
static get_initializer_t & | get_initializer () |
static get_select_list_t & | get_permit_list () |
when a permit list is provided, only these functions are wrapped by GOTCHA More... | |
static get_select_list_t & | get_reject_list () |
reject listed functions are never wrapped by GOTCHA More... | |
static bool & | get_default_ready () |
static void | add_global_suppression (const std::string &func) |
add function names at runtime to suppress wrappers More... | |
static auto | get_ready () |
get an array of whether the wrappers are filled and ready More... | |
static auto | set_ready (bool val) |
set filled wrappers to array of ready values More... | |
static auto | set_ready (const std::array< bool, Nt > &values) |
set filled wrappers to array of ready values More... | |
template<size_t N, typename Ret , typename... Args> | |
static bool | construct (const std::string &_func, int _priority=0, const std::string &_tool="") |
template<size_t N, typename Ret , typename... Args> | |
static auto | configure (const std::string &_func, int _priority=0, const std::string &_tool="") |
template<size_t N, typename Ret , typename... Args> | |
static auto | configure (const std::vector< std::string > &_funcs, int _priority=0, const std::string &_tool="") |
template<size_t N> | |
static bool | revert () |
static bool & | is_configured () |
static std::mutex & | get_mutex () |
static auto | get_info () |
static void | configure () |
static void | enable () |
static void | disable () |
static void | global_finalize () |
static void | thread_init () |
template<size_t N, typename Ret , typename... Args> | |
static void | gotcha_factory (const std::string &_func, const std::string &_tool="", int _priority=0) |
Static Public Attributes | |
static constexpr size_t | components_size = mpl::get_tuple_size<tuple_type>::value |
static constexpr bool | differ_is_component |
static constexpr bool | differentiator_is_component = differ_is_component |
Friends | |
struct | operation::record< this_type > |
struct | operation::start< this_type > |
struct | operation::stop< this_type > |
struct | operation::set_started< this_type > |
struct | operation::set_stopped< this_type > |
The gotcha component rewrites the global offset table such that calling the wrapped function actually invokes either a function which is wrapped by timemory instrumentation or is replaced by a timemory component with an function call operator (operator()
) whose return value and arguments exactly match the original function. This component is only available on Linux and can only by applied to external, dynamically-linked functions (i.e. functions defined in a shared library). If the BundleT
template parameter is a non-empty component bundle, this component will surround the original function call with:
Nt | Max number of functions which will wrapped by this component |
BundleT | Component bundle to wrap around the function(s) |
DiffT | Differentiator type to distinguish different sets of wrappers with identical values of Nt and BundleT (or provide function call operator if replacing functions instead of wrapping functions) |
If the BundleT
template parameter is an empty variadic class, e.g. std::tuple<>
, tim::component_tuple<>
, etc., and the DiffT
template parameter is a timemory component, the assumption is that the DiffT
component has a function call operator which should replace the original function call, e.g. void* malloc(size_t)
can be replaced with a component with void* operator()(size_t)
, e.g.:
Example usage:
Definition at line 175 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::array_t = std::array<Tp, Nt> |
Definition at line 197 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::atomic_bool_t = std::atomic<bool> |
Definition at line 205 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::base_type = base<this_type, value_type> |
Definition at line 185 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::binding_t = backend::gotcha::binding_t |
Definition at line 199 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::bundle_type = concepts::component_type_t<BundleT> |
Definition at line 188 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::config_t = void |
Definition at line 209 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::constructor_t = std::function<void()> |
Definition at line 203 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::destructor_t = std::function<void()> |
Definition at line 204 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::error_t = backend::gotcha::error_t |
Definition at line 202 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::get_initializer_t = std::function<config_t()> |
Definition at line 210 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::get_select_list_t = std::function<select_list_t()> |
Definition at line 211 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::operator_type = typename std::conditional<differ_is_component, DiffT, void>::type |
Definition at line 220 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::select_list_t = std::set<std::string> |
Definition at line 207 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::storage_type = typename base_type::storage_type |
Definition at line 186 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::this_type = gotcha<Nt, BundleT, DiffT> |
Definition at line 184 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::tuple_type = concepts::tuple_type_t<BundleT> |
Definition at line 187 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::value_type = void |
Definition at line 183 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::wrappee_t = backend::gotcha::wrappee_t |
Definition at line 200 of file components.hpp.
using tim::component::gotcha< Nt, BundleT, DiffT >::wrappid_t = backend::gotcha::string_t |
Definition at line 201 of file components.hpp.
|
inlinestatic |
add function names at runtime to suppress wrappers
Definition at line 262 of file components.hpp.
|
inlinestatic |
Definition at line 449 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::get_initializer(), tim::component::gotcha< Nt, BundleT, DiffT >::get_mutex(), and tim::component::gotcha< Nt, BundleT, DiffT >::is_configured().
Referenced by tim::component::gotcha< Nt, BundleT, DiffT >::enable(), tim::component::gotcha< Nt, BundleT, DiffT >::instrument< N, Ret, Args >::generate(), and tim::component::gotcha< Nt, BundleT, DiffT >::start().
|
inlinestatic |
Definition at line 371 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::construct().
|
inlinestatic |
Definition at line 380 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::construct().
|
inlinestatic |
Definition at line 304 of file components.hpp.
References tim::debug, tim::demangle(), tim::get(), and tim::component::gotcha< Nt, BundleT, DiffT >::get_default_ready().
Referenced by tim::component::gotcha< Nt, BundleT, DiffT >::configure().
|
inlinestatic |
Definition at line 224 of file components.hpp.
|
inlinestatic |
Definition at line 470 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::get_mutex(), and tim::component::gotcha< Nt, BundleT, DiffT >::is_configured().
Referenced by tim::component::gotcha< Nt, BundleT, DiffT >::global_finalize().
|
inlinestatic |
Definition at line 466 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::configure().
|
inlinestatic |
Definition at line 254 of file components.hpp.
Referenced by tim::component::gotcha< Nt, BundleT, DiffT >::construct(), tim::component::gotcha< Nt, BundleT, DiffT >::revert(), and tim::component::gotcha< Nt, BundleT, DiffT >::thread_init().
|
inlinestatic |
|
inlinestatic |
Definition at line 233 of file components.hpp.
Referenced by tim::component::gotcha< Nt, BundleT, DiffT >::configure(), and setup_pthread_gotcha().
|
inlinestatic |
Definition at line 428 of file components.hpp.
Referenced by tim::component::gotcha< Nt, BundleT, DiffT >::configure(), and tim::component::gotcha< Nt, BundleT, DiffT >::disable().
|
inlinestatic |
when a permit list is provided, only these functions are wrapped by GOTCHA
Definition at line 240 of file components.hpp.
|
inlinestatic |
get an array of whether the wrappers are filled and ready
Definition at line 269 of file components.hpp.
Referenced by tim::component::gotcha< Nt, BundleT, DiffT >::set_ready().
|
inlinestatic |
reject listed functions are never wrapped by GOTCHA
Definition at line 247 of file components.hpp.
|
inlinestatic |
Definition at line 493 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::disable().
|
inlinestatic |
Definition at line 610 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::instrument< N, Ret, Args >::generate().
|
inlinestatic |
Definition at line 424 of file components.hpp.
Referenced by tim::component::gotcha< Nt, BundleT, DiffT >::configure(), tim::component::gotcha< Nt, BundleT, DiffT >::disable(), and tim::component::gotcha< Nt, BundleT, DiffT >::start().
|
inlinestatic |
Definition at line 223 of file components.hpp.
|
inlinestatic |
Definition at line 229 of file components.hpp.
|
inlinestatic |
Definition at line 395 of file components.hpp.
References tim::get(), and tim::component::gotcha< Nt, BundleT, DiffT >::get_default_ready().
|
inlinestatic |
set filled wrappers to array of ready values
Definition at line 279 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::get_ready().
|
inlinestatic |
set filled wrappers to array of ready values
Definition at line 291 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::get_ready().
|
inline |
Definition at line 512 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::configure(), tim::debug, and tim::component::gotcha< Nt, BundleT, DiffT >::is_configured().
|
inline |
|
inlinestatic |
Definition at line 502 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::get_default_ready().
|
friend |
Definition at line 179 of file components.hpp.
|
friend |
Definition at line 179 of file components.hpp.
|
friend |
Definition at line 179 of file components.hpp.
|
friend |
Definition at line 179 of file components.hpp.
|
friend |
Definition at line 179 of file components.hpp.
|
staticconstexpr |
Definition at line 213 of file components.hpp.
|
staticconstexpr |
Definition at line 214 of file components.hpp.
|
staticconstexpr |
Definition at line 218 of file components.hpp.