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::policy::instance_tracker< Tp, true > Struct Template Reference

#include "timemory/mpl/policy.hpp"

+ Collaboration diagram for tim::policy::instance_tracker< Tp, true >:

Public Types

enum  {
  global_count = 0 ,
  thread_count
}
 
using type = Tp
 
using int_type = int64_t
 
using pair_type = std::pair< int_type, int_type >
 

Static Public Member Functions

static int_type get_started_count ()
 
static int_type get_thread_started_count ()
 

Static Public Attributes

static constexpr bool thread_support = true
 

Protected Member Functions

auto start ()
 
auto stop ()
 
template<size_t Idx>
enable_if_t< Idx==global_count, int_typestart ()
 
template<size_t Idx>
enable_if_t< Idx==global_count, int_typestop ()
 
template<size_t Idx>
enable_if_t< Idx==thread_count, int_typestart ()
 
template<size_t Idx>
enable_if_t< Idx==thread_count, int_typestop ()
 
auto get_global_count ()
 
auto get_thread_count ()
 
auto global_tracker_start ()
 
auto global_tracker_stop ()
 
auto thread_tracker_start ()
 
auto thread_tracker_stop ()
 

Static Protected Member Functions

static std::atomic< int_type > & get_started ()
 
static int_typeget_thread_started ()
 

Protected Attributes

int_type m_tot = get_started_count()
 
int_type m_thr = get_thread_started_count()
 

Detailed Description

template<typename Tp>
struct tim::policy::instance_tracker< Tp, true >

Definition at line 270 of file policy.hpp.

Member Typedef Documentation

◆ int_type

template<typename Tp >
using tim::policy::instance_tracker< Tp, true >::int_type = int64_t

Definition at line 274 of file policy.hpp.

◆ pair_type

template<typename Tp >
using tim::policy::instance_tracker< Tp, true >::pair_type = std::pair<int_type, int_type>

Definition at line 275 of file policy.hpp.

◆ type

template<typename Tp >
using tim::policy::instance_tracker< Tp, true >::type = Tp

Definition at line 273 of file policy.hpp.

Member Enumeration Documentation

◆ anonymous enum

template<typename Tp >
anonymous enum
Enumerator
global_count 
thread_count 

Definition at line 280 of file policy.hpp.

Member Function Documentation

◆ get_global_count()

template<typename Tp >
auto tim::policy::instance_tracker< Tp, true >::get_global_count ( )
inlineprotected

Definition at line 364 of file policy.hpp.

◆ get_started()

template<typename Tp >
static std::atomic< int_type > & tim::policy::instance_tracker< Tp, true >::get_started ( )
inlinestaticprotected

Definition at line 298 of file policy.hpp.

299 {
300 static std::atomic<int_type> _instance(0);
301 return _instance;
302 }

◆ get_started_count()

template<typename Tp >
static int_type tim::policy::instance_tracker< Tp, true >::get_started_count ( )
inlinestatic

Definition at line 289 of file policy.hpp.

289{ return get_started().load(); }
static std::atomic< int_type > & get_started()
Definition: policy.hpp:298

◆ get_thread_count()

template<typename Tp >
auto tim::policy::instance_tracker< Tp, true >::get_thread_count ( )
inlineprotected

Definition at line 365 of file policy.hpp.

365{ return m_tot; }

◆ get_thread_started()

template<typename Tp >
static int_type & tim::policy::instance_tracker< Tp, true >::get_thread_started ( )
inlinestaticprotected

Definition at line 306 of file policy.hpp.

307 {
308 static thread_local int_type _instance = 0;
309 return _instance;
310 }

◆ get_thread_started_count()

template<typename Tp >
static int_type tim::policy::instance_tracker< Tp, true >::get_thread_started_count ( )
inlinestatic

Definition at line 293 of file policy.hpp.

293{ return get_thread_started(); }
static int_type & get_thread_started()
Definition: policy.hpp:306

◆ global_tracker_start()

template<typename Tp >
auto tim::policy::instance_tracker< Tp, true >::global_tracker_start ( )
inlineprotected

Definition at line 367 of file policy.hpp.

367{ return (start(), m_tot); }

References tim::invoke::start().

◆ global_tracker_stop()

template<typename Tp >
auto tim::policy::instance_tracker< Tp, true >::global_tracker_stop ( )
inlineprotected

Definition at line 368 of file policy.hpp.

368{ return (stop(), m_tot); }

References tim::invoke::stop().

◆ start() [1/3]

template<typename Tp >
auto tim::policy::instance_tracker< Tp, true >::start ( )
inlineprotected

Definition at line 314 of file policy.hpp.

315 {
316 m_tot = get_started()++;
318 return pair_type{ m_tot, m_thr };
319 }
std::pair< int_type, int_type > pair_type
Definition: policy.hpp:275

◆ start() [2/3]

template<typename Tp >
template<size_t Idx>
enable_if_t< Idx==global_count, int_type > tim::policy::instance_tracker< Tp, true >::start ( )
inlineprotected

Definition at line 331 of file policy.hpp.

332 {
333 m_tot = get_started()++;
335 return m_tot;
336 }

◆ start() [3/3]

template<typename Tp >
template<size_t Idx>
enable_if_t< Idx==thread_count, int_type > tim::policy::instance_tracker< Tp, true >::start ( )
inlineprotected

Definition at line 349 of file policy.hpp.

350 {
351 m_tot = get_started()++;
353 return m_thr;
354 }

◆ stop() [1/3]

template<typename Tp >
auto tim::policy::instance_tracker< Tp, true >::stop ( )
inlineprotected

Definition at line 321 of file policy.hpp.

322 {
323 m_tot = --get_started();
325 return pair_type{ m_tot, m_thr };
326 }

◆ stop() [2/3]

template<typename Tp >
template<size_t Idx>
enable_if_t< Idx==global_count, int_type > tim::policy::instance_tracker< Tp, true >::stop ( )
inlineprotected

Definition at line 339 of file policy.hpp.

340 {
341 m_tot = --get_started();
343 return m_tot;
344 }

◆ stop() [3/3]

template<typename Tp >
template<size_t Idx>
enable_if_t< Idx==thread_count, int_type > tim::policy::instance_tracker< Tp, true >::stop ( )
inlineprotected

Definition at line 357 of file policy.hpp.

358 {
359 m_tot = --get_started();
361 return m_thr;
362 }

◆ thread_tracker_start()

template<typename Tp >
auto tim::policy::instance_tracker< Tp, true >::thread_tracker_start ( )
inlineprotected

Definition at line 369 of file policy.hpp.

369{ return (start(), m_thr); }

References tim::invoke::start().

◆ thread_tracker_stop()

template<typename Tp >
auto tim::policy::instance_tracker< Tp, true >::thread_tracker_stop ( )
inlineprotected

Definition at line 370 of file policy.hpp.

370{ return (stop(), m_thr); }

References tim::invoke::stop().

Member Data Documentation

◆ m_thr

Definition at line 374 of file policy.hpp.

◆ m_tot

template<typename Tp >
int_type tim::policy::instance_tracker< Tp, true >::m_tot = get_started_count()
protected

Definition at line 373 of file policy.hpp.

◆ thread_support

template<typename Tp >
constexpr bool tim::policy::instance_tracker< Tp, true >::thread_support = true
staticconstexpr

Definition at line 276 of file policy.hpp.


The documentation for this struct was generated from the following file: