|
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.
|
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"
Collaboration diagram for tim::component::gotcha< Nt, BundleT, DiffT >: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 () |
| void | get () const |
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) |
| template<typename... Args> | |
| static opaque | get_opaque (Args &&...) |
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 176 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::array_t = std::array<Tp, Nt> |
Definition at line 198 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::atomic_bool_t = std::atomic<bool> |
Definition at line 206 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::base_type = base<this_type, value_type> |
Definition at line 186 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::binding_t = backend::gotcha::binding_t |
Definition at line 200 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::bundle_type = concepts::component_type_t<BundleT> |
Definition at line 189 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::config_t = void |
Definition at line 210 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::constructor_t = std::function<void()> |
Definition at line 204 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::destructor_t = std::function<void()> |
Definition at line 205 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::error_t = backend::gotcha::error_t |
Definition at line 203 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::get_initializer_t = std::function<config_t()> |
Definition at line 211 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::get_select_list_t = std::function<select_list_t()> |
Definition at line 212 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 221 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::select_list_t = std::set<std::string> |
Definition at line 208 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::storage_type = typename base_type::storage_type |
Definition at line 187 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::this_type = gotcha<Nt, BundleT, DiffT> |
Definition at line 185 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::tuple_type = concepts::tuple_type_t<BundleT> |
Definition at line 188 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::value_type = void |
Definition at line 184 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::wrappee_t = backend::gotcha::wrappee_t |
Definition at line 201 of file components.hpp.
| using tim::component::gotcha< Nt, BundleT, DiffT >::wrappid_t = backend::gotcha::string_t |
Definition at line 202 of file components.hpp.
|
inlinestatic |
add function names at runtime to suppress wrappers
Definition at line 263 of file components.hpp.
|
inlinestatic |
Definition at line 458 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 380 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::construct().
|
inlinestatic |
Definition at line 389 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::construct().
|
inlinestatic |
Definition at line 305 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::construct(), 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(), and tim::component::gotcha< Nt, BundleT, DiffT >::construct().
|
inlinestatic |
Definition at line 225 of file components.hpp.
|
inlinestatic |
Definition at line 479 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 475 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::configure().
|
inlineinherited |
Definition at line 69 of file declaration.hpp.
|
inlinestatic |
Definition at line 255 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 234 of file components.hpp.
Referenced by tim::component::gotcha< Nt, BundleT, DiffT >::configure(), and setup_pthread_gotcha().
|
inlinestatic |
Definition at line 437 of file components.hpp.
Referenced by tim::component::gotcha< Nt, BundleT, DiffT >::configure(), and tim::component::gotcha< Nt, BundleT, DiffT >::disable().
|
inlinestaticinherited |
Definition at line 72 of file declaration.hpp.
|
inlinestatic |
when a permit list is provided, only these functions are wrapped by GOTCHA
Definition at line 241 of file components.hpp.
|
inlinestatic |
get an array of whether the wrappers are filled and ready
Definition at line 270 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 248 of file components.hpp.
|
inlinestatic |
Definition at line 502 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::disable().
|
inlinestatic |
Definition at line 621 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::instrument< N, Ret, Args >::generate().
|
inlinestatic |
Definition at line 433 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 224 of file components.hpp.
|
inlinestatic |
Definition at line 230 of file components.hpp.
|
inlinestatic |
Definition at line 404 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 280 of file components.hpp.
References tim::at(), and tim::component::gotcha< Nt, BundleT, DiffT >::get_ready().
|
inlinestatic |
set filled wrappers to array of ready values
Definition at line 292 of file components.hpp.
References tim::at(), and tim::component::gotcha< Nt, BundleT, DiffT >::get_ready().
|
inline |
Definition at line 521 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 511 of file components.hpp.
References tim::component::gotcha< Nt, BundleT, DiffT >::get_default_ready().
|
friend |
Definition at line 180 of file components.hpp.
|
friend |
Definition at line 180 of file components.hpp.
|
friend |
Definition at line 180 of file components.hpp.
|
friend |
Definition at line 180 of file components.hpp.
|
friend |
Definition at line 180 of file components.hpp.
|
staticconstexpr |
Definition at line 214 of file components.hpp.
|
staticconstexpr |
Definition at line 215 of file components.hpp.
|
staticconstexpr |
Definition at line 219 of file components.hpp.