Thrill  0.1
ProfileThread Class Reference

Detailed Description

Definition at line 32 of file profile_thread.hpp.

+ Collaboration diagram for ProfileThread:

#include <profile_thread.hpp>

Classes

struct  Timer
 struct for timer callbacks More...
 

Public Types

using milliseconds = std::chrono::milliseconds
 
using steady_clock = std::chrono::steady_clock
 

Public Member Functions

 ProfileThread ()
 
 ProfileThread (const ProfileThread &)=delete
 non-copyable: delete copy-constructor More...
 
 ~ProfileThread ()
 
template<typename Period >
void Add (const Period &period, ProfileTask *task, bool own_task=false)
 Register a regularly scheduled callback. More...
 
ProfileThreadoperator= (const ProfileThread &)=delete
 non-copyable: delete assignment operator More...
 
bool Remove (ProfileTask *task)
 Unregister a regularly scheduled callback. More...
 

Private Types

using TimerPQ = BinaryHeap< Timer >
 priority queue of interval scheduled callbacks More...
 

Private Member Functions

void Worker ()
 the thread worker function More...
 

Private Attributes

std::condition_variable_any cv_
 cv/mutex pair to signal thread to terminate More...
 
std::timed_mutex mutex_
 cv/mutex pair to signal thread to terminate More...
 
TimerPQ tasks_
 priority queue of interval scheduled callbacks More...
 
std::atomic< bool > terminate_ { false }
 flag to terminate profiling thread More...
 
std::thread thread_
 thread for profiling (only run on top-level loggers) More...
 

Member Typedef Documentation

◆ milliseconds

using milliseconds = std::chrono::milliseconds

Definition at line 35 of file profile_thread.hpp.

◆ steady_clock

using steady_clock = std::chrono::steady_clock

Definition at line 36 of file profile_thread.hpp.

◆ TimerPQ

using TimerPQ = BinaryHeap<Timer>
private

priority queue of interval scheduled callbacks

Definition at line 92 of file profile_thread.hpp.

Constructor & Destructor Documentation

◆ ProfileThread() [1/2]

◆ ProfileThread() [2/2]

ProfileThread ( const ProfileThread )
delete

non-copyable: delete copy-constructor

◆ ~ProfileThread()

Member Function Documentation

◆ Add()

void Add ( const Period &  period,
ProfileTask task,
bool  own_task = false 
)
inline

◆ operator=()

ProfileThread& operator= ( const ProfileThread )
delete

non-copyable: delete assignment operator

◆ Remove()

bool Remove ( ProfileTask task)

◆ Worker()

Member Data Documentation

◆ cv_

std::condition_variable_any cv_
private

cv/mutex pair to signal thread to terminate

Definition at line 71 of file profile_thread.hpp.

Referenced by ProfileThread::Add(), ProfileThread::Worker(), and ProfileThread::~ProfileThread().

◆ mutex_

std::timed_mutex mutex_
private

cv/mutex pair to signal thread to terminate

Definition at line 68 of file profile_thread.hpp.

Referenced by ProfileThread::Add(), ProfileThread::Remove(), ProfileThread::Worker(), and ProfileThread::~ProfileThread().

◆ tasks_

TimerPQ tasks_
private

priority queue of interval scheduled callbacks

Definition at line 95 of file profile_thread.hpp.

Referenced by ProfileThread::Add(), ProfileThread::Remove(), ProfileThread::Worker(), and ProfileThread::~ProfileThread().

◆ terminate_

std::atomic<bool> terminate_ { false }
private

flag to terminate profiling thread

Definition at line 65 of file profile_thread.hpp.

Referenced by ProfileThread::Worker(), and ProfileThread::~ProfileThread().

◆ thread_

std::thread thread_
private

thread for profiling (only run on top-level loggers)

Definition at line 62 of file profile_thread.hpp.

Referenced by ProfileThread::ProfileThread(), and ProfileThread::~ProfileThread().


The documentation for this class was generated from the following files: