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.
|
#include "timemory/sampling/sampler.hpp"
Public Types | |
using | this_type = sampler< CompT< Types... >, N, SigIds... > |
using | base_type = component::base< this_type, void > |
using | components_t = CompT< Types... > |
using | signal_set_t = std::set< int > |
using | pid_cb_t = std::function< bool(pid_t, int, int)> |
using | array_t = conditional_t< fixed_size_t< N >::value, std::array< components_t, N >, std::vector< components_t > > |
using | array_type = array_t |
using | tracker_type = policy::instance_tracker< this_type, false > |
using | storage_type = empty_storage |
Public Member Functions | |
template<typename Tp = fixed_size_t<N>, enable_if_t< Tp::value > = 0> | |
sampler (const std::string &_label, signal_set_t _good, signal_set_t _bad=signal_set_t{}) | |
template<typename Tp = fixed_size_t<N>, enable_if_t<!Tp::value > = 0> | |
sampler (const std::string &_label, signal_set_t _good, signal_set_t _bad=signal_set_t{}) | |
~sampler () | |
template<typename Tp = fixed_size_t<N>, enable_if_t< Tp::value > = 0> | |
void | sample () |
template<typename Tp = fixed_size_t<N>, enable_if_t<!Tp::value > = 0> | |
void | sample () |
template<typename Tp = fixed_sig_t<SigIds...>, enable_if_t< Tp::value > = 0> | |
void | start () |
template<typename Tp = fixed_sig_t<SigIds...>, enable_if_t< Tp::value > = 0> | |
void | stop () |
template<typename Tp = fixed_sig_t<SigIds...>, enable_if_t<!Tp::value > = 0> | |
void | start () |
template<typename Tp = fixed_sig_t<SigIds...>, enable_if_t<!Tp::value > = 0> | |
void | stop () |
bool | is_good (int v) const |
bool | is_bad (int v) const |
auto | good_count () const |
auto | bad_count () const |
auto | count () const |
auto & | get_good () |
auto & | get_bad () |
const auto & | get_good () const |
const auto & | get_bad () const |
auto | backtrace_enabled () const |
void | enable_backtrace (bool val) |
components_t *& | get_last () |
components_t * | get_last () const |
components_t *& | get_latest () |
components_t * | get_latest () const |
template<typename Tp = fixed_size_t<N>, enable_if_t< Tp::value > = 0> | |
components_t & | get (size_t idx) |
template<typename Tp = fixed_size_t<N>, enable_if_t<!Tp::value > = 0> | |
components_t & | get (size_t idx) |
template<typename Tp = fixed_size_t<N>, enable_if_t< Tp::value > = 0> | |
const components_t & | get (size_t idx) const |
template<typename Tp = fixed_size_t<N>, enable_if_t<!Tp::value > = 0> | |
const components_t & | get (size_t idx) const |
array_t & | get_data () |
const array_t & | get_data () const |
template<typename Tp , enable_if_t< Tp::value > > | |
sampler< CompT< Types... >, N, SigIds... >::components_t & | get (size_t idx) |
template<typename Tp , enable_if_t< Tp::value > > | |
const sampler< CompT< Types... >, N, SigIds... >::components_t & | get (size_t idx) const |
void | get () const |
Static Public Member Functions | |
static void | execute (int signum) |
static void | execute (int signum, siginfo_t *, void *) |
static auto & | get_samplers () |
static auto | get_latest_samples () |
static void | configure (std::set< int > _signals, int _verbose=1) |
Set up the sampler. More... | |
static void | configure (int _signal=SIGALRM, int _verbose=1) |
static void | ignore (const std::set< int > &_signals) |
Ignore the signals. More... | |
static void | clear () |
Clear all signals. Recommended to call ignore() prior to clearing all the signals. More... | |
static void | pause () |
Pause until a signal is delivered. More... | |
template<typename Func = pid_cb_t> | |
static int | wait (pid_t _pid, int _verbose, bool _debug, Func &&_callback=pid_callback()) |
Wait function with an optional user callback of type: More... | |
template<typename Func = pid_cb_t> | |
static int | wait (int _verbose=settings::verbose(), bool _debug=settings::debug(), Func &&_callback=pid_callback()) |
template<typename Func , enable_if_t< std::is_function< Func >::value > = 0> | |
static int | wait (pid_t _pid, Func &&_callback, int _verbose=settings::verbose(), bool _debug=settings::debug()) |
template<typename Func , enable_if_t< std::is_function< Func >::value > = 0> | |
static int | wait (Func &&_callback, int _verbose=settings::verbose(), bool _debug=settings::debug()) |
static void | set_flags (int _flags) |
Set the sigaction flags, e.g. SA_RESTART | SA_SIGINFO. More... | |
static void | set_delay (double fdelay) |
Value, expressed in seconds, that sets the length of time the sampler waits before starting sampling of the relevant measurements. More... | |
static void | set_frequency (double ffreq) |
static void | set_rate (double frate) |
Value, expressed in number of interupts per second, that configures the frequency that the sampler samples the relevant measurements. More... | |
static int64_t | get_delay (int64_t units=units::usec) |
Get the delay of the sampler. More... | |
static int64_t | get_frequency (int64_t units=units::usec) |
Get the frequency of the sampler. More... | |
static int | get_itimer (int _signal) |
Returns the itimer value associated with the given signal. More... | |
static bool | check_itimer (int _stat, bool _throw_exception=false) |
Checks to see if there was an error setting or getting itimer val. More... | |
template<typename... Args> | |
static opaque | get_opaque (Args &&...) |
Protected Attributes | |
bool | m_backtrace = false |
size_t | m_idx = 0 |
components_t * | m_last = nullptr |
signal_set_t | m_good = {} |
signal_set_t | m_bad = {} |
array_t | m_data = {} |
Definition at line 157 of file sampler.hpp.
using tim::sampling::sampler< CompT< Types... >, N, SigIds... >::array_t = conditional_t<fixed_size_t<N>::value, std::array<components_t, N>, std::vector<components_t> > |
Definition at line 166 of file sampler.hpp.
using tim::sampling::sampler< CompT< Types... >, N, SigIds... >::array_type = array_t |
Definition at line 169 of file sampler.hpp.
using tim::sampling::sampler< CompT< Types... >, N, SigIds... >::base_type = component::base<this_type, void> |
Definition at line 162 of file sampler.hpp.
using tim::sampling::sampler< CompT< Types... >, N, SigIds... >::components_t = CompT<Types...> |
Definition at line 163 of file sampler.hpp.
using tim::sampling::sampler< CompT< Types... >, N, SigIds... >::pid_cb_t = std::function<bool(pid_t, int, int)> |
Definition at line 165 of file sampler.hpp.
using tim::sampling::sampler< CompT< Types... >, N, SigIds... >::signal_set_t = std::set<int> |
Definition at line 164 of file sampler.hpp.
|
inherited |
Definition at line 66 of file declaration.hpp.
using tim::sampling::sampler< CompT< Types... >, N, SigIds... >::this_type = sampler<CompT<Types...>, N, SigIds...> |
Definition at line 161 of file sampler.hpp.
using tim::sampling::sampler< CompT< Types... >, N, SigIds... >::tracker_type = policy::instance_tracker<this_type, false> |
Definition at line 170 of file sampler.hpp.
tim::sampling::sampler< CompT< Types... >, N, SigIds... >::sampler | ( | const std::string & | _label, |
signal_set_t | _good, | ||
signal_set_t | _bad = signal_set_t{} |
||
) |
Definition at line 406 of file sampler.hpp.
References TIMEMORY_FOLD_EXPRESSION.
tim::sampling::sampler< CompT< Types... >, N, SigIds... >::sampler | ( | const std::string & | _label, |
signal_set_t | _good, | ||
signal_set_t | _bad = signal_set_t{} |
||
) |
tim::sampling::sampler< CompT< Types... >, N, SigIds... >::~sampler |
Definition at line 439 of file sampler.hpp.
|
inline |
Definition at line 218 of file sampler.hpp.
|
inline |
Definition at line 209 of file sampler.hpp.
|
static |
Checks to see if there was an error setting or getting itimer val.
Definition at line 1002 of file sampler.hpp.
References TIMEMORY_EXCEPTION, and TIMEMORY_JOIN.
|
inlinestatic |
Clear all signals. Recommended to call ignore() prior to clearing all the signals.
Definition at line 261 of file sampler.hpp.
|
inlinestatic |
Definition at line 247 of file sampler.hpp.
References tim::configure().
|
static |
Set up the sampler.
[in] | _signals | A set of signals to catch |
[in] | _verb | Logging Verbosity |
Definition at line 649 of file sampler.hpp.
References tim::ert::execute(), TIMEMORY_EXCEPTION, TIMEMORY_FOLD_EXPRESSION, and TIMEMORY_JOIN.
|
inline |
Definition at line 210 of file sampler.hpp.
|
inline |
Definition at line 219 of file sampler.hpp.
|
static |
|
static |
|
inlineinherited |
Definition at line 69 of file declaration.hpp.
components_t & tim::sampling::sampler< CompT< Types... >, N, SigIds... >::get | ( | size_t | idx | ) |
components_t & tim::sampling::sampler< CompT< Types... >, N, SigIds... >::get | ( | size_t | idx | ) |
sampler< CompT< Types... >, N, SigIds... >::components_t & tim::sampling::sampler< CompT< Types... >, N, SigIds... >::get | ( | size_t | idx | ) |
Definition at line 550 of file sampler.hpp.
const components_t & tim::sampling::sampler< CompT< Types... >, N, SigIds... >::get | ( | size_t | idx | ) | const |
const components_t & tim::sampling::sampler< CompT< Types... >, N, SigIds... >::get | ( | size_t | idx | ) | const |
const sampler< CompT< Types... >, N, SigIds... >::components_t & tim::sampling::sampler< CompT< Types... >, N, SigIds... >::get | ( | size_t | idx | ) | const |
Definition at line 560 of file sampler.hpp.
|
inline |
Definition at line 213 of file sampler.hpp.
|
inline |
Definition at line 216 of file sampler.hpp.
|
inline |
Definition at line 237 of file sampler.hpp.
|
inline |
Definition at line 238 of file sampler.hpp.
|
inlinestatic |
Get the delay of the sampler.
Definition at line 960 of file sampler.hpp.
|
inlinestatic |
Get the frequency of the sampler.
Definition at line 973 of file sampler.hpp.
|
inline |
Definition at line 212 of file sampler.hpp.
|
inline |
Definition at line 215 of file sampler.hpp.
|
static |
Returns the itimer value associated with the given signal.
Definition at line 986 of file sampler.hpp.
|
inline |
Definition at line 221 of file sampler.hpp.
|
inline |
Definition at line 222 of file sampler.hpp.
|
inline |
Definition at line 224 of file sampler.hpp.
|
inline |
Definition at line 225 of file sampler.hpp.
|
inlinestatic |
Definition at line 392 of file sampler.hpp.
|
inlinestaticinherited |
Definition at line 72 of file declaration.hpp.
|
inlinestatic |
Definition at line 174 of file sampler.hpp.
|
inline |
Definition at line 208 of file sampler.hpp.
|
inlinestatic |
Ignore the signals.
[in] | _signals | Set of signals |
Definition at line 730 of file sampler.hpp.
|
inline |
Definition at line 206 of file sampler.hpp.
|
inline |
Definition at line 205 of file sampler.hpp.
|
inlinestatic |
Pause until a signal is delivered.
Definition at line 265 of file sampler.hpp.
void tim::sampling::sampler< CompT< Types... >, N, SigIds... >::sample |
Definition at line 453 of file sampler.hpp.
void tim::sampling::sampler< CompT< Types... >, N, SigIds... >::sample | ( | ) |
|
static |
Value, expressed in seconds, that sets the length of time the sampler waits before starting sampling of the relevant measurements.
Definition at line 922 of file sampler.hpp.
References tim::debug, and tim::verbose.
|
inlinestatic |
Set the sigaction flags, e.g. SA_RESTART | SA_SIGINFO.
flags[in] | the sigaction flags to use |
Definition at line 315 of file sampler.hpp.
|
static |
|
inlinestatic |
Value, expressed in number of interupts per second, that configures the frequency that the sampler samples the relevant measurements.
Definition at line 330 of file sampler.hpp.
void tim::sampling::sampler< CompT< Types... >, N, SigIds... >::start |
void tim::sampling::sampler< CompT< Types... >, N, SigIds... >::start | ( | ) |
void tim::sampling::sampler< CompT< Types... >, N, SigIds... >::stop |
Definition at line 511 of file sampler.hpp.
References tim::invoke::stop().
void tim::sampling::sampler< CompT< Types... >, N, SigIds... >::stop | ( | ) |
|
inlinestatic |
Definition at line 304 of file sampler.hpp.
|
inlinestatic |
Definition at line 289 of file sampler.hpp.
|
inlinestatic |
Definition at line 297 of file sampler.hpp.
|
static |
Wait function with an optional user callback of type:
[in] | _pid | Process id to wait on |
[in] | _verb | Logging verbosity |
[in] | _debug | Enable debug logging |
[in] | _cb | Callback for checking whether to exit |
where 'a' is the status, 'b' is the error value, and returns true if waiting should continue
Definition at line 757 of file sampler.hpp.
|
protected |
Definition at line 349 of file sampler.hpp.
|
protected |
Definition at line 353 of file sampler.hpp.
|
protected |
Definition at line 354 of file sampler.hpp.
|
protected |
Definition at line 352 of file sampler.hpp.
|
protected |
Definition at line 350 of file sampler.hpp.
|
protected |
Definition at line 351 of file sampler.hpp.