CMS 3D CMS Logo

edmScanValgrind.py
Go to the documentation of this file.
1 #!/bin/env python
2 from __future__ import print_function
3 import sys
4 
5 fileName = sys.argv[1]
6 
7 f = open(fileName,'r')
8 
9 messageToIgnore = [
10  'edm::FunctorTask'
11  ,'edm::FunctorWaitingTask'
12  ,'edm::ModuleCallingContext::setContext'
13  ,'edm::SerialTaskQueue::'
14  ,'edm::SerialTaskQueueChain::'
15  ,'edm::WaitingTaskList'
16  ,'edm::Worker::RunModuleTask<'
17  ,'edm::Worker::beginStream'
18  ,'edm::eventsetup::EventSetupRecord::getFromProxy'
19  ,'edm::GlobalSchedule::processOneGlobalAsync'
20  ,'edm::SerialTaskQueueChain::push'
21  ,'edm::Worker::doWorkNoPrefetchingAsync'
22  ,'edm::ServiceRegistry::setContext'
23  ,'edm::ServiceRegistry::presentToken()'
24  ,'edm::service::InitRootHandlers::ThreadTracker::on_scheduler_entry'
25  ,'__TBB_machine_fetchstore4'
26  ,'__TBB_machine_cmpswp4'
27  ,'__TBB_machine_fetchstore1'
28  ,'acquire (spin_rw_mutex.h:118)'
29  ,'reset_extra_state ('
30  ,'priority (scheduler_common.h:130)'
31  ,'edm::service::MessageLogger::'
32 # ,'edm::service::MessageLogger::establishModule('
33 # ,'edm::Run::Run(edm::RunPrincipal const&,'
34  ,'edm::service::MessageLogger::unEstablishModule'
35  ,'tbb::'
36  ,'edm::RunForOutput::RunForOutput('
37  ,'edm::stream::EDAnalyzerAdaptor<'
38  ,'edm::EventSetup::find('
39  ,'edm::eventsetup::EventSetupRecord::find('
40  ,'edm::eventsetup::DataKey::operator<('
41  ,'edm::eventsetup::SimpleStringTag::operator<('
42  ,'std::__shared_ptr<edm::serviceregistry::ServicesManager'
43  ,'try_acquire (spin_mutex.h:109)'
44  ,'edm::Run::Run('
45  ,'FastTimerService::preStreamBeginRun('
46  ,'decltype ({parm#1}()) edm::convertException::wrap<bool edm::Worker::runModule'
47  ,'edm::Worker::reset()'
48  ,'edm::stream::ProducingModuleAdaptorBase<edm::stream::EDProducerBase>::doStreamBeginLuminosityBlock('
49  ,'edm::stream::ProducingModuleAdaptorBase<edm::stream::EDFilterBase>::doStreamBeginLuminosityBlock('
50  ,'edm::LuminosityBlock::LuminosityBlock(edm::LuminosityBlockPrincipal'
51  ,'edm::StreamSchedule::processOneStreamAsync<'
52  ,'edm::Worker::doWorkAsync<'
53  ,'edm::StreamSchedule::processOneEventAsync('
54  ,'edm::ParentContext::moduleCallingContext()'
55  ,'edm::ModuleCallingContext::getTopModuleCallingContext'
56  ,'edm::Event::Event('
57  ,'edm::Path::workerFinished('
58  ,'edm::Path::updateCounters('
59  ,'edm::Path::recordStatus('
60  ,'FastTimerService::postPathEvent('
61  ,'edm::hash_detail::isCompactForm_('
62  ,'edm::InputProductResolver::resolveProduct_'
63  ,'edm::NoProcessProductResolver::dataValidFromResolver('
64  ,'edm::DataManagingProductResolver::productWasFetchedAndIsValid_(bool)'
65  ,'FastTimerService::postModuleEvent('
66  ,'edm::UnscheduledProductResolver::prefetchAsync_'
67 # ,'edm::NoProcessProductResolver::prefetchAsync_'
68 # ,'edm::NoProcessProductResolver::resolveProduct_('
69  ,'edm::NoProcessProductResolver::'
70  ,'reco::Jet::detectorP4'
71  ,'edm::EarlyDeleteHelper::moduleRan'
72  ,'edm::clearLoggedErrorsSummary('
73  ,'edm::ProductProvenanceRetriever::branchIDToProvenance('
74  ,'HistogramProbabilityEstimator::probability' #protected by an atomic
75  ,'edm::EventPrincipal::setLuminosityBlockPrincipal'
76  ,'edm::DataManagingProductResolver::'
77 ]
78 
79 stackToIgnore = [
80  'edm::service::MessageLogger::'
81  ,'edm::MessageSender::ErrorObjDeleter'
82  ,'edm::Run::runPrincipal() const'
83  ,'edm::WaitingTaskList::'
84  ,'edm::EventProcessor::beginJob()'
85  ,'edm::StreamSchedule::processOneEventAsync'
86  ,'edm::WorkerManager::resetAll()'
87  ,'edm::ParentageRegistry::insertMapped('
88  ,'edm::one::EDFilterBase::doEvent('
89  ,'edm::one::EDProducerBase'
90  ,'edm::EventBase::triggerNames_'
91  ,'edm::EDFilter::doEvent('
92  ,'edm::EDAnalyzer::doEvent('
93  ,'edm::one::OutputModuleBase::doEvent'
94  ,'edm::EDProducer::doEvent'
95  ,'edm::Principal::clearPrincipal'
96  ,'edm::RootOutputFile::writeOne'
97  ,'edm::PrincipalCache::deleteRun('
98  ,'edm::eventsetup::EventSetupProvider::eventSetupForInstance'
99  ,'edm::EventPrincipal::clearEventPrincipal()'
100  ,'FastTimerService::Resources::operator+='
101  ,'FastTimerService::preSourceEvent(edm::StreamID)'
102  ,'edm::EventPrincipal::fillEventPrincipal('
103  ,'edm::InputProductResolver::putProduct_('
104 ]
105 
106 addressesToIgnore = [
107 # 'edm::eventsetup::makeEventSetupProvider('
108 # ,' edm::eventsetup::DataProxy::get('
109 # ,'cond::createPayload<'
110 # ,'edm::pset::Registry::getMapped('
111  'is in a rw- anonymous segment' #not sure about this one
112 # ,'edm::RootFile::fillRunAuxiliary'
113  ,'tbb::internal::arena::arena('
114 # ,'edm::EventPrincipal::fillEventPrincipal('
115 # ,'edm::Principal::addUnscheduledProduct('
116 # ,'edm::RootDelayedReader::getProduct_'
117 # ,'TBranchElement::GetEntry('
118 # ,'edm::Event::put<'
119 # ,'edm::stream::EDProducerAdaptorBase::doEvent'
120 # ,'edm::stream::EDFilterAdaptorBase::doEvent('
121 # ,'edm::EventProcessor::init(' #this may ignore too much, but needed to ignore member data of streams
122 # ,'edm::global::EDProducerBase::doEvent'
123 # ,'FastTimerService::postBeginJob()'
124 # ,'edm::EDProducer::doEvent('
125 # ,'_ZN3pat15PackedCandidate27covarianceParameterization_E'
126 # ,'edm::RootOutputFile::writeOne'
127  ,'DQMStore::book'
128  ,'L1TdeCSCTF::L1TdeCSCTF' #legacy
129  #,'MeasurementTrackerEventProducer::produce(' #MeasurementTrackerEvent ultimately hits edmNew::DetSetVector's lazy caching of DetSet which is supposed to be thread safe (but may not be?)
130  ,'std::vector<reco::TrackExtra' #this is the cache in Ref
131  ,'std::vector<reco::Track'
132  ,'std::vector<reco::PFConversion'
133 ]
134 
135 addressesToIgnoreIfRead = [
136  'edm::eventsetup::makeEventSetupProvider('
137  ,' edm::eventsetup::DataProxy::get('
138  ,'cond::createPayload<'
139  ,'edm::pset::Registry::getMapped('
140 # ,'is in a rw- anonymous segment' #not sure about this one
141  ,'edm::RootFile::fillRunAuxiliary'
142 # ,'tbb::internal::arena::arena('
143  ,'edm::EventPrincipal::fillEventPrincipal('
144  ,'edm::Principal::addUnscheduledProduct('
145  ,'edm::RootDelayedReader::getProduct_'
146  ,'TBranchElement::GetEntry('
147  ,'edm::Event::put<'
148  ,'edm::stream::EDProducerAdaptorBase::doEvent'
149  ,'edm::stream::EDFilterAdaptorBase::doEvent('
150  ,'edm::EventProcessor::init(' #this may ignore too much, but needed to ignore member data of streams
151  ,'edm::global::EDProducerBase::doEvent'
152  ,'FastTimerService::postBeginJob()'
153  ,'edm::EDProducer::doEvent('
154  ,'_ZN3pat15PackedCandidate27covarianceParameterization_E'
155  ,'edm::RootOutputFile::writeOne'
156  ,'BSS segment'
157  ,'bytes inside data symbol' #this shows the writes but will miss the reads
158  ,'FSQ::HandlerTemplate' #some function statics
159 # ,'DQMStore::book'
160  ,'TBufferFile::'
161  ,'edm::service::MessageLogger::'
162  ,'TClass::GetClass('
163 ]
164 
165 #startOfMessage ='-------------------'
166 endOfMessage ='-------------------'
167 startOfMessage = 'Possible data race'
168 startOfMessageLength = len(startOfMessage)
169 messageStarted = False
170 lineCount = 100
171 buffer = []
172 maxCount = 20
173 lookForAddress = False
174 foundAddress = False
175 addressCount = 100
176 possibleDataRaceRead = False
177 foundStartOfMessage = False
178 for l in f.readlines():
179  if l[:2] != '==':
180  continue
181  if l.find(endOfMessage) != -1:
182  foundAddress = False
183  addressCount = 100
184  if l.find(startOfMessage) != -1:
185  lookForAddress = False
186  foundAddress = False
187  possibleDataRaceRead = (l.find('data race during read') != -1)
188  if buffer:
189  #print buffer
190  print('---------------------')
191  for b in buffer:
192  print(b[:-1])
193 
194  buffer=[l]
195  lineCount = 0
196  continue
197 # if lineCount == 2:
198 # if l.find('data race') == -1:
199 # buffer = []
200 # lineCount = 100
201 # possibleDataRaceRead = (l.find('data race during read') != -1)
202  if lineCount < maxCount:
203  skipThis = False
204  for i in stackToIgnore:
205  if l.find(i) != -1:
206  lineCount = 100
207  skipThis = True
208  buffer = []
209  break
210  if skipThis:
211  continue
212  buffer.append(l)
213  lineCount +=1
214  if ' at 0x' in l:
215  for i in messageToIgnore:
216  if l.find(i) != -1:
217  buffer = []
218  lineCount = 100
219  break
220  if lineCount == 100:
221  continue
222  if l.find('Address 0x') != -1:
223  lookForAddress = True
224  foundAddress = False
225  lineCount = 100
226  if lineCount == maxCount:
227  lookForAddress = True
228  foundAddress = False
229  lineCount = 100
230  if lookForAddress:
231  if l.find('Address 0x') != -1:
232  foundAddress = True
233  lookForAddress = False
234  addressCount = 0
235  lineCount = 100
236  if foundAddress:
237  addressCount +=1
238  if addressCount < maxCount:
239  buffer.append(l)
240  for i in addressesToIgnore:
241  if l.find(i) != -1:
242  buffer = []
243  foundAddress = False
244  addressCount = 100
245  break
246  if possibleDataRaceRead:
247  for i in addressesToIgnoreIfRead:
248  if l.find(i) != -1:
249  buffer = []
250  foundAddress = False
251  addressCount = 100
252  break
253  if l[-3:]=="== ":
254  foundAddress = False
255  addressCount = 100
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46