CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BlockWipedAllocatorService.cc
Go to the documentation of this file.
4 
6 #include <iostream>
7 
8 
10 
11 
12 namespace {
13  struct Dumper {
14  void visit(BlockWipedAllocator const& alloc) const {
15  BlockWipedAllocator::Stat sa1 = alloc.stat();
16  std::cout << "Alloc for size " << sa1.typeSize
17  << ": " << sa1.blockSize
18  << ", " << sa1.currentOccupancy
19  << "/" << sa1.currentAvailable
20  << ", " << sa1.totalAvailable
21  << "/" << sa1.nBlocks
22  << ", " << sa1.alive
23  << std::endl;
24  }
25 
26  };
27 
28 }
29 
33 private:
34  bool m_useAlloc;
35 public:
37  edm::ActivityRegistry & iAR ) {
38 
39  m_useAlloc = iConfig.getUntrackedParameter<bool>("usePoolAllocator",false);
46  }
47 
48  // wipe the workspace before each event
50 
51  // nope event-principal deleted in source
52  void preSource() {
53  // wiper();
54  }
55 
56  void dump() {
57  std::cout << "ReferenceCounted stat"<< std::endl;
58  std::cout << "still alive/referenced "
61  << std::endl;
62 
63  std::cout << "BlockAllocator stat"<< std::endl;
64  std::cout << "still alive " << BlockWipedPoolAllocated::s_alive << std::endl;
65  Dumper dumper;
66  blockWipedPool().visit(dumper);
67  }
68 
69 
70  void wiper() {
71  dump();
72  blockWipedPool().wipe();
73  blockWipedPool().clear(); // try to crash
74  {
75  static int c=0;
76  if (20==c) {
78  c=0;
79  }
80  c++;
81  }
82 
83  }
84 
85  // wipe before each module (no, obj in event....)
86  void preModule(const edm::ModuleDescription& desc){
87  // blockWipedPool().wipe();
88  }
89 
91  dump();
92  }
93 
94  // final stat
95  void postEndJob() {
96  wiper();
97  }
98 
99 };
100 
101 
102 
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)
def visit
Retrieve data from a perf suite output (sub) directory, only examines TimeSize at the moment...
void watchPreModule(PreModule::slot_type const &iSlot)
void preEventProcessing(const edm::EventID &, const edm::Timestamp &)
void watchPreSource(PreSource::slot_type const &iSlot)
#define DEFINE_FWK_SERVICE(type)
Definition: ServiceMaker.h:117
BlockWipedPool & blockWipedPool()
void visit(Visitor &visitor) const
void postModule(const edm::ModuleDescription &desc)
BlockWipedAllocatorService(const edm::ParameterSet &iConfig, edm::ActivityRegistry &iAR)
tuple cout
Definition: gather_cfg.py:41