47template <
typename Tp,
typename Value>
58template <
typename Tp,
typename Value>
62 if(!ptr && _typeid_hash == typeid_hash<Tp>())
63 ptr =
reinterpret_cast<void*
>(
const_cast<base_type*
>(
this));
68template <
typename Tp,
typename Value>
77template <
typename Tp,
typename Value>
84 set_is_transient(
true);
85 set_is_running(
false);
91template <
typename Tp,
typename Value>
92typename base<Tp, Value>::base_storage_type*
95 return tim::base::storage::template base_instance<Tp, Value>();
100template <
typename Tp,
typename Value>
122template <
typename Tp,
typename Value>
144template <
typename Tp,
typename Value>
145std::ios_base::fmtflags
148 static std::ios_base::fmtflags _instance = Type::format_flags;
150 auto _set_scientific = []() {
155 if(!percent_units_v &&
165template <
typename Tp,
typename Value>
174template <
typename Tp,
typename Value>
183template <
typename Tp,
typename Value>
193template <
typename Tp,
typename Value>
207template <
typename Tp,
typename Value>
212 return static_cast<Type&
>(*this);
217template <
typename Tp,
typename Value>
222 return static_cast<Type&
>(*this);
227template <
typename Tp,
typename Value>
232 return static_cast<Type&
>(*this);
237template <
typename Tp,
typename Value>
242 return static_cast<Type&
>(*this);
251template <
typename Tp,
typename Value>
256 return static_cast<Type&
>(*this);
261template <
typename Tp,
typename Value>
266 return static_cast<Type&
>(*this);
271template <
typename Tp,
typename Value>
276 return static_cast<Type&
>(*this);
281template <
typename Tp,
typename Value>
286 return static_cast<Type&
>(*this);
295template <
typename Tp,
typename Value>
299 return Tp(
static_cast<const Tp&
>(lhs)) +=
static_cast<const Tp&
>(rhs);
304template <
typename Tp,
typename Value>
308 return Tp(
static_cast<const Tp&
>(lhs)) -=
static_cast<const Tp&
>(rhs);
313template <
typename Tp,
typename Value>
316 return Tp(
static_cast<const Tp&
>(lhs)) *=
static_cast<const Tp&
>(rhs);
321template <
typename Tp,
typename Value>
325 return Tp(
static_cast<const Tp&
>(lhs)) /=
static_cast<const Tp&
>(rhs);
334template <
typename Tp>
343template <
typename Tp>
347 set_is_running(
true);
352template <
typename Tp>
357 set_is_transient(
true);
358 set_is_running(
false);
363template <
typename Tp>
367 if(!ptr && _typeid_hash == typeid_hash<Tp>())
368 ptr =
reinterpret_cast<void*
>(
const_cast<base_type*
>(
this));
373template <
typename Tp>
382template <
typename Tp>
391template <
typename Tp>
401template <
typename Tp>
425template <
typename Tp,
typename Value>
429 auto _typeid_hash = typeid_hash<Tp>();
435 _obj.m_typeid = _typeid_hash;
438 scope::config arg_scope) {
440 Tp* _result =
static_cast<Tp*
>(v_result);
443 invoke::set_prefix<TIMEMORY_API>(std::tie(*_result),
_prefix);
444 invoke::set_scope<TIMEMORY_API>(std::tie(*_result), arg_scope);
445 return (
void*) _result;
449 scope::config arg_scope) {
454 Tp* _result =
static_cast<Tp*
>(v_result);
455 invoke::push<TIMEMORY_API>(std::tie(*_result), _scope + arg_scope, _hash);
459 _obj.m_sample = [](
void* v_result) {
463 Tp* _result =
static_cast<Tp*
>(v_result);
464 invoke::invoke<operation::sample, TIMEMORY_API>(std::tie(*_result));
468 _obj.m_start = [](
void* v_result) {
472 Tp* _result =
static_cast<Tp*
>(v_result);
473 invoke::start<TIMEMORY_API>(std::tie(*_result));
477 _obj.m_stop = [](
void* v_result) {
481 Tp* _result =
static_cast<Tp*
>(v_result);
482 invoke::stop<TIMEMORY_API>(std::tie(*_result));
486 _obj.m_pop = [](
void* v_result) {
490 Tp* _result =
static_cast<Tp*
>(v_result);
491 invoke::pop<TIMEMORY_API>(std::tie(*_result));
495 _obj.m_get = [_typeid_hash](
void* v_result,
void*& _ptr,
size_t _hash) {
496 if(_hash == _typeid_hash && v_result && !_ptr)
499 Tp* _result =
static_cast<Tp*
>(v_result);
502 invoke::invoke<operation::get, TIMEMORY_API>(std::tie(*_result), _ptr, _hash);
506 _obj.m_del = [](
void* v_result) {
510 Tp* _result =
static_cast<Tp*
>(v_result);
515 _obj.m_update_stats = [](
void* v_result,
bool _v) {
519 Tp* _result =
static_cast<Tp*
>(v_result);
520 invoke::invoke<operation::add_statistics, TIMEMORY_API>(std::tie(*_result),
528template <
typename Tp>
532 auto _typeid_hash = typeid_hash<Tp>();
538 _obj.m_typeid = _typeid_hash;
541 scope::config arg_scope) {
543 Tp* _result =
static_cast<Tp*
>(v_result);
546 invoke::set_prefix<TIMEMORY_API>(std::tie(*_result),
_prefix);
547 invoke::set_scope<TIMEMORY_API>(std::tie(*_result), arg_scope);
548 return (
void*) _result;
552 scope::config arg_scope) {
557 Tp* _result =
static_cast<Tp*
>(v_result);
558 invoke::push<TIMEMORY_API>(std::tie(*_result), _scope + arg_scope, _hash);
562 _obj.m_sample = [](
void* v_result) {
566 Tp* _result =
static_cast<Tp*
>(v_result);
567 invoke::invoke<operation::sample, TIMEMORY_API>(std::tie(*_result));
571 _obj.m_start = [](
void* v_result) {
575 Tp* _result =
static_cast<Tp*
>(v_result);
576 invoke::start<TIMEMORY_API>(std::tie(*_result));
580 _obj.m_stop = [](
void* v_result) {
584 Tp* _result =
static_cast<Tp*
>(v_result);
585 invoke::stop<TIMEMORY_API>(std::tie(*_result));
589 _obj.m_pop = [](
void* v_result) {
593 Tp* _result =
static_cast<Tp*
>(v_result);
594 invoke::pop<TIMEMORY_API>(std::tie(*_result));
598 _obj.m_get = [_typeid_hash](
void* v_result,
void*& _ptr,
size_t _hash) {
599 if(_hash == _typeid_hash && v_result && !_ptr)
602 Tp* _result =
static_cast<Tp*
>(v_result);
603 invoke::invoke<operation::get, TIMEMORY_API>(std::tie(*_result), _ptr, _hash);
607 _obj.m_del = [](
void* v_result) {
611 Tp* _result =
static_cast<Tp*
>(v_result);
616 _obj.m_update_stats = [](
void* v_result,
bool _v) {
620 Tp* _result =
static_cast<Tp*
>(v_result);
621 invoke::invoke<operation::add_statistics, TIMEMORY_API>(std::tie(*_result),
Declare the base component types.
Definition for various functions for get in operations.
Tp operator*(const base< Tp, Value > &lhs, const base< Tp, Value > &rhs)
Tp operator+(const base< Tp, Value > &lhs, const base< Tp, Value > &rhs)
Tp operator/(const base< Tp, Value > &lhs, const base< Tp, Value > &rhs)
Tp operator-(const base< Tp, Value > &lhs, const base< Tp, Value > &rhs)
hash_value_t add_hash_id(hash_map_ptr_t &_hash_map, string_view_cref_t _prefix)
add an string to the given hash-map (if it doesn't already exist) and return the hash
void reset(TupleT< Tp... > &obj, Args &&... args)
Tp & plus(Tp &, const Up &)
auto divide(Tp &_lhs, Up _rhs, type_list<>,...) -> decltype(_lhs/=_rhs, void())
Tp & minus(Tp &, const Up &)
Tp & multiply(Tp &, const Up &)
char const std::string & _prefix
const std::string & string_view_cref_t
tim::mpl::apply< std::string > string
description("A generic option for any setting. Each argument MUST be passed in " "form: 'NAME=VALUE'. E.g. --timemory-args " "\"papi_events=PAPI_TOT_INS,PAPI_TOT_CYC\" text_output=off") .action([&](parser_t &p)
Declare the operations types.
Definition for various functions for sample in operations.
Declare the storage types.
static short get_precision()
Type & multiply_oper(const Type &rhs)
static base_storage_type * get_storage()
void reset()
reset the values
Type & minus_oper(const Type &rhs)
static std::string get_label()
Type & plus_oper(const Type &rhs)
void set_stopped()
store that stop has been called
static fmtflags get_format_flags()
static opaque get_opaque(scope::config)
get the opaque binding for user-bundle
static std::string label()
Type & divide_oper(const Type &rhs)
auto get() const
retrieve the current measurement value in the units for the type
void set_started()
store that start has been called
static std::string get_description()
static std::string description()
#define DEBUG_PRINT_HERE(...)