CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
BlockWipedAllocatorService Class Reference

Public Member Functions

 BlockWipedAllocatorService (const edm::ParameterSet &iConfig, edm::ActivityRegistry &iAR)
 
void dump ()
 
void postEndJob ()
 
void postModule (const edm::ModuleDescription &desc)
 
void preEventProcessing (const edm::EventID &, const edm::Timestamp &)
 
void preModule (const edm::ModuleDescription &desc)
 
void preSource ()
 
void wiper ()
 

Private Attributes

int m_clearFreq
 
bool m_dump
 
bool m_silent
 
bool m_useAlloc
 
BlockWipedPool pool
 

Detailed Description

manage the allocator

Definition at line 32 of file BlockWipedAllocatorService.cc.

Constructor & Destructor Documentation

BlockWipedAllocatorService::BlockWipedAllocatorService ( const edm::ParameterSet iConfig,
edm::ActivityRegistry iAR 
)
inline

Definition at line 40 of file BlockWipedAllocatorService.cc.

References blockWipedPool(), edm::ParameterSet::getUntrackedParameter(), m_clearFreq, m_dump, m_silent, m_useAlloc, max(), pool, postEndJob(), postModule(), preEventProcessing(), preModule(), preSource(), BlockWipedPoolAllocated::usePool(), edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostModule(), edm::ActivityRegistry::watchPreModule(), edm::ActivityRegistry::watchPreProcessEvent(), and edm::ActivityRegistry::watchPreSource().

41  :
42  pool( std::max(256,iConfig.getUntrackedParameter<int>("blockSize",1024)),
43  std::max(256,iConfig.getUntrackedParameter<int>("recyclerSize",4096))
44  ) {
45 
46  m_useAlloc = iConfig.getUntrackedParameter<bool>("usePoolAllocator",false);
47  m_silent = iConfig.getUntrackedParameter<bool>("silent",true);
48  m_dump = iConfig.getUntrackedParameter<bool>("dumpEachModule",false);
49  m_clearFreq = std::max(1,iConfig.getUntrackedParameter<int>("clearFrequency",20));
50 
58  }
T getUntrackedParameter(std::string const &, T const &) const
void preModule(const edm::ModuleDescription &desc)
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void watchPostModule(PostModule::slot_type const &iSlot)
void watchPreProcessEvent(PreProcessEvent::slot_type const &iSlot)
BlockWipedPool & blockWipedPool(BlockWipedPool *p=0)
void watchPreModule(PreModule::slot_type const &iSlot)
void preEventProcessing(const edm::EventID &, const edm::Timestamp &)
const T & max(const T &a, const T &b)
void watchPreSource(PreSource::slot_type const &iSlot)
void postModule(const edm::ModuleDescription &desc)

Member Function Documentation

void BlockWipedAllocatorService::dump ( void  )
inline

Definition at line 68 of file BlockWipedAllocatorService.cc.

References blockWipedPool(), gather_cfg::cout, m_silent, ReferenceCountedPoolAllocated::s_alive, BlockWipedPoolAllocated::s_alive, ReferenceCountedPoolAllocated::s_referenced, and BlockWipedPool::visit().

Referenced by postModule(), and wiper().

68  {
69  if (m_silent) return;
70  std::cout << "ReferenceCounted stat"<< std::endl;
71  std::cout << "still alive/referenced "
74  << std::endl;
75 
76  std::cout << "BlockAllocator stat"<< std::endl;
77  std::cout << "still alive " << BlockWipedPoolAllocated::s_alive << std::endl;
78  Dumper dumper;
79  blockWipedPool().visit(dumper);
80  }
BlockWipedPool & blockWipedPool(BlockWipedPool *p=0)
void visit(Visitor &visitor) const
tuple cout
Definition: gather_cfg.py:121
void BlockWipedAllocatorService::postEndJob ( )
inline

Definition at line 108 of file BlockWipedAllocatorService.cc.

References wiper().

Referenced by BlockWipedAllocatorService().

108  {
109  wiper();
110  }
void BlockWipedAllocatorService::postModule ( const edm::ModuleDescription desc)
inline

Definition at line 103 of file BlockWipedAllocatorService.cc.

References dump(), and m_dump.

Referenced by BlockWipedAllocatorService().

void BlockWipedAllocatorService::preEventProcessing ( const edm::EventID ,
const edm::Timestamp  
)
inline

Definition at line 61 of file BlockWipedAllocatorService.cc.

References wiper().

Referenced by BlockWipedAllocatorService().

void BlockWipedAllocatorService::preModule ( const edm::ModuleDescription desc)
inline

Definition at line 99 of file BlockWipedAllocatorService.cc.

References blockWipedPool(), and BlockWipedPool::wipe().

Referenced by BlockWipedAllocatorService().

99  {
100  blockWipedPool().wipe(false);
101  }
BlockWipedPool & blockWipedPool(BlockWipedPool *p=0)
void wipe(bool force=true)
void BlockWipedAllocatorService::preSource ( )
inline

Definition at line 64 of file BlockWipedAllocatorService.cc.

Referenced by BlockWipedAllocatorService().

64  {
65  // wiper();
66  }
void BlockWipedAllocatorService::wiper ( )
inline

Definition at line 83 of file BlockWipedAllocatorService.cc.

References blockWipedPool(), trackerHits::c, BlockWipedPool::clear(), dump(), m_clearFreq, and BlockWipedPool::wipe().

Referenced by postEndJob(), and preEventProcessing().

83  {
84  dump();
85  blockWipedPool().wipe();
86  // blockWipedPool().clear(); // try to crash
87  {
88  static int c=0;
89  c++;
90  if (m_clearFreq==c) {
92  c=0;
93  }
94  }
95 
96  }
BlockWipedPool & blockWipedPool(BlockWipedPool *p=0)
void wipe(bool force=true)

Member Data Documentation

int BlockWipedAllocatorService::m_clearFreq
private

Definition at line 37 of file BlockWipedAllocatorService.cc.

Referenced by BlockWipedAllocatorService(), and wiper().

bool BlockWipedAllocatorService::m_dump
private

Definition at line 36 of file BlockWipedAllocatorService.cc.

Referenced by BlockWipedAllocatorService(), and postModule().

bool BlockWipedAllocatorService::m_silent
private

Definition at line 35 of file BlockWipedAllocatorService.cc.

Referenced by BlockWipedAllocatorService(), and dump().

bool BlockWipedAllocatorService::m_useAlloc
private

Definition at line 34 of file BlockWipedAllocatorService.cc.

Referenced by BlockWipedAllocatorService().

BlockWipedPool BlockWipedAllocatorService::pool
private

Definition at line 38 of file BlockWipedAllocatorService.cc.

Referenced by BlockWipedAllocatorService().