CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
evf::ConcurrencyTracker Class Reference
Inheritance diagram for evf::ConcurrencyTracker:

Public Member Functions

void activate ()
 
 ConcurrencyTracker (unsigned num_expected)
 
int get_concurrency ()
 
bool isThreadActive (unsigned index)
 
void on_scheduler_entry (bool) override
 
void on_scheduler_exit (bool) override
 

Private Attributes

unsigned max_threads
 
std::atomic< int > num_threads
 
std::vector< ContainableAtomic< unsigned int > > threadactive_
 

Detailed Description

Definition at line 171 of file FastMonitoringService.cc.

Constructor & Destructor Documentation

◆ ConcurrencyTracker()

evf::ConcurrencyTracker::ConcurrencyTracker ( unsigned  num_expected)
inline

Definition at line 177 of file FastMonitoringService.cc.

178  : num_threads(), max_threads(num_expected), threadactive_(num_expected, 0) {
179  //set array to if it will not be used
180  //for (unsigned i=0;i<num_expected;i++) threadactive_.push_back(0);
181  }
std::vector< ContainableAtomic< unsigned int > > threadactive_

Member Function Documentation

◆ activate()

void evf::ConcurrencyTracker::activate ( )
inline

Definition at line 182 of file FastMonitoringService.cc.

182 { observe(true); }

◆ get_concurrency()

int evf::ConcurrencyTracker::get_concurrency ( )
inline

Definition at line 194 of file FastMonitoringService.cc.

194 { return num_threads; }

◆ isThreadActive()

bool evf::ConcurrencyTracker::isThreadActive ( unsigned  index)
inline

Definition at line 193 of file FastMonitoringService.cc.

193 { return threadactive_[index] == 1; }
std::vector< ContainableAtomic< unsigned int > > threadactive_

◆ on_scheduler_entry()

void evf::ConcurrencyTracker::on_scheduler_entry ( bool  )
inlineoverride

Definition at line 183 of file FastMonitoringService.cc.

183  {
184  ++num_threads;
185  threadactive_[tbb::this_task_arena::current_thread_index()] = 1;
186  }
std::vector< ContainableAtomic< unsigned int > > threadactive_

◆ on_scheduler_exit()

void evf::ConcurrencyTracker::on_scheduler_exit ( bool  )
inlineoverride

Definition at line 188 of file FastMonitoringService.cc.

188  {
189  --num_threads;
190  threadactive_[tbb::this_task_arena::current_thread_index()] = 0;
191  }
std::vector< ContainableAtomic< unsigned int > > threadactive_

Member Data Documentation

◆ max_threads

unsigned evf::ConcurrencyTracker::max_threads
private

Definition at line 173 of file FastMonitoringService.cc.

◆ num_threads

std::atomic<int> evf::ConcurrencyTracker::num_threads
private

Definition at line 172 of file FastMonitoringService.cc.

◆ threadactive_

std::vector<ContainableAtomic<unsigned int> > evf::ConcurrencyTracker::threadactive_
private

Definition at line 174 of file FastMonitoringService.cc.