Hall-D Software
alpha
|
#include <DResourcePool.h>
Public Member Functions | |
DResourcePool (void) | |
DResourcePool (size_t locGetBatchSize, size_t locNumToAllocateAtOnce, size_t locMaxLocalPoolSize) | |
DResourcePool (size_t locGetBatchSize, size_t locNumToAllocateAtOnce, size_t locMaxLocalPoolSize, size_t locMaxSharedPoolSize, size_t locDebugLevel) | |
~DResourcePool (void) | |
void | Set_ControlParams (size_t locGetBatchSize, size_t locNumToAllocateAtOnce, size_t locMaxLocalPoolSize) |
void | Set_ControlParams (size_t locGetBatchSize, size_t locNumToAllocateAtOnce, size_t locMaxLocalPoolSize, size_t locMaxSharedPoolSize, size_t locDebugLevel) |
DType * | Get_Resource (void) |
shared_ptr< DType > | Get_SharedResource (void) |
void | Recycle (const DType *locResource) |
void | Recycle (vector< const DType * > &locResources) |
void | Recycle (DType *locResource) |
void | Recycle (vector< DType * > &locResources) |
size_t | Get_SharedPoolSize (void) const |
size_t | Get_PoolSize (void) const |
size_t | Get_NumObjectsAllThreads (void) const |
Static Public Member Functions | |
static constexpr unsigned int | Get_CacheLineSize (void) |
Private Member Functions | |
template<typename RType > | |
std::enable_if < std::is_base_of< DResettable, RType >::value, void >::type | Release_Resources (DResettable *locResource) |
template<typename RType > | |
std::enable_if < std::is_base_of< DResettable, RType >::value, void >::type | Reset (DResettable *locResource) |
template<typename RType > | |
std::enable_if <!std::is_base_of< DResettable, RType >::value, void >::type | Release_Resources (RType *locResource) |
template<typename RType > | |
std::enable_if <!std::is_base_of< DResettable, RType >::value, void >::type | Reset (RType *locResource) |
void | Get_Resources_StaticPool (void) |
void | Recycle_Resources_StaticPool (vector< DType * > &locResources) |
Private Attributes | |
size_t | dDebugLevel = 0 |
size_t | dGetBatchSize = 100 |
size_t | dNumToAllocateAtOnce = 20 |
size_t | dMaxLocalPoolSize = 2000 |
vector< DType * > | dResourcePool_Local |
Static Private Attributes | |
static mutex | dSharedPoolMutex |
static vector< DType * > | dResourcePool_Shared = {} |
static size_t | dMaxSharedPoolSize |
static size_t | dPoolCounter {0} |
static atomic< size_t > | dObjectCounter {0} |
Definition at line 94 of file DResourcePool.h.
DResourcePool< DType >::DResourcePool | ( | void | ) |
Definition at line 210 of file DResourcePool.h.
DResourcePool< DType >::DResourcePool | ( | size_t | locGetBatchSize, |
size_t | locNumToAllocateAtOnce, | ||
size_t | locMaxLocalPoolSize | ||
) |
Definition at line 205 of file DResourcePool.h.
References DResourcePool< DType >::Set_ControlParams().
DResourcePool< DType >::DResourcePool | ( | size_t | locGetBatchSize, |
size_t | locNumToAllocateAtOnce, | ||
size_t | locMaxLocalPoolSize, | ||
size_t | locMaxSharedPoolSize, | ||
size_t | locDebugLevel | ||
) |
Definition at line 200 of file DResourcePool.h.
References DResourcePool< DType >::Set_ControlParams().
DResourcePool< DType >::~DResourcePool | ( | void | ) |
Definition at line 224 of file DResourcePool.h.
|
inlinestatic |
Returns the cache line size for the processor of the target platform.
The cache line size is useful for creating a buffer to make sure that a variable accessed by multiple threads does not share the cache line it is on. This is useful for variables that may be written-to by one of the threads, because the thread will acquire locked access to the entire cache line. This blocks other threads from operating on the other data stored on the cache line. Note that it is also important to align the shared data as well. See http://www.drdobbs.com/parallel/eliminate-false-sharing/217500206?pgno=4 for more details.
Definition at line 125 of file DResourcePool.h.
|
inline |
Definition at line 123 of file DResourcePool.h.
Referenced by DBeamPhoton_factory::Get_NumObjectsAllThreads(), DNeutralParticleHypothesis_factory::Get_NumObjectsAllThreads(), DHistogramAction_ObjectMemory::Perform_Action(), DAnalysis::DParticleComboCreator::Reset(), and DAnalysis::DSourceComboer::Reset_NewEvent().
|
inline |
Definition at line 122 of file DResourcePool.h.
DType * DResourcePool< DType >::Get_Resource | ( | void | ) |
Definition at line 259 of file DResourcePool.h.
Referenced by DAnalysis::DParticleComboCreator::Build_KinematicData(), DAnalysis::DParticleComboCreator::Build_ParticleCombo(), DAnalysis::DSourceComboVertexer::Construct_DecayingParticle_InvariantMass(), DAnalysis::DSourceComboVertexer::Construct_DecayingParticle_MissingMass(), DBeamPhoton_factory::Get_Resource(), and DNeutralParticleHypothesis_factory::Get_Resource().
|
private |
Definition at line 345 of file DResourcePool.h.
size_t DResourcePool< DType >::Get_SharedPoolSize | ( | void | ) | const |
Definition at line 388 of file DResourcePool.h.
shared_ptr< DType > DResourcePool< DType >::Get_SharedResource | ( | void | ) |
Definition at line 302 of file DResourcePool.h.
|
inline |
Definition at line 114 of file DResourcePool.h.
Referenced by DAnalysisResults_factory::evnt(), DChargedTrackHypothesis_factory::evnt(), DResourcePool< DChargedTrackHypothesis::DTimingInfo >::Recycle(), DNeutralParticleHypothesis_factory::Recycle_Hypotheses(), DNeutralParticleHypothesis_factory::Recycle_Hypothesis(), DBeamPhoton_factory::Recycle_Resource(), DBeamPhoton_factory::Recycle_Resources(), DAnalysis::DParticleComboCreator::Reset(), DAnalysis::DSourceComboVertexer::Reset(), and DAnalysis::DSourceComboer::Reset_NewEvent().
void DResourcePool< DType >::Recycle | ( | vector< const DType * > & | locResources | ) |
Definition at line 307 of file DResourcePool.h.
void DResourcePool< DType >::Recycle | ( | DType * | locResource | ) |
Definition at line 335 of file DResourcePool.h.
void DResourcePool< DType >::Recycle | ( | vector< DType * > & | locResources | ) |
Definition at line 319 of file DResourcePool.h.
|
private |
Definition at line 361 of file DResourcePool.h.
|
inlineprivate |
Definition at line 141 of file DResourcePool.h.
|
inlineprivate |
Definition at line 145 of file DResourcePool.h.
|
inlineprivate |
Definition at line 142 of file DResourcePool.h.
|
inlineprivate |
Definition at line 146 of file DResourcePool.h.
void DResourcePool< DType >::Set_ControlParams | ( | size_t | locGetBatchSize, |
size_t | locNumToAllocateAtOnce, | ||
size_t | locMaxLocalPoolSize | ||
) |
Definition at line 295 of file DResourcePool.h.
Referenced by DBeamPhoton_factory::DBeamPhoton_factory(), DAnalysis::DParticleComboCreator::DParticleComboCreator(), DResourcePool< DType >::DResourcePool(), DAnalysis::DSourceComboer::DSourceComboer(), DAnalysisResults_factory::init(), DChargedTrackHypothesis_factory::init(), and DNeutralParticleHypothesis_factory::init().
void DResourcePool< DType >::Set_ControlParams | ( | size_t | locGetBatchSize, |
size_t | locNumToAllocateAtOnce, | ||
size_t | locMaxLocalPoolSize, | ||
size_t | locMaxSharedPoolSize, | ||
size_t | locDebugLevel | ||
) |
Definition at line 282 of file DResourcePool.h.
|
private |
Definition at line 152 of file DResourcePool.h.
|
private |
Definition at line 153 of file DResourcePool.h.
|
private |
Definition at line 155 of file DResourcePool.h.
|
staticprivate |
Definition at line 161 of file DResourcePool.h.
|
private |
Definition at line 154 of file DResourcePool.h.
|
staticprivate |
Definition at line 163 of file DResourcePool.h.
|
staticprivate |
Definition at line 162 of file DResourcePool.h.
|
private |
Definition at line 156 of file DResourcePool.h.
|
staticprivate |
Definition at line 160 of file DResourcePool.h.
|
staticprivate |
Definition at line 159 of file DResourcePool.h.