CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
FastTimerServiceClient Class Reference
Inheritance diagram for FastTimerServiceClient:
DQMEDHarvester edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 FastTimerServiceClient (edm::ParameterSet const &)
 
 ~FastTimerServiceClient ()
 
- Public Member Functions inherited from DQMEDHarvester
virtual void analyze (edm::Event const &, edm::EventSetup const &) final
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDHarvester (void)
 
virtual void endJob () final
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void dqmEndJob (DQMStore::IBooker &booker, DQMStore::IGetter &getter) override
 
void dqmEndLuminosityBlock (DQMStore::IBooker &booker, DQMStore::IGetter &getter, edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void fillPathSummaryPlots (DQMStore::IBooker &booker, DQMStore::IGetter &getter, double events, std::string const &path)
 
void fillProcessSummaryPlots (DQMStore::IBooker &booker, DQMStore::IGetter &getter, std::string const &path)
 
void fillSummaryPlots (DQMStore::IBooker &booker, DQMStore::IGetter &getter)
 

Private Attributes

std::string m_dqm_path
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Protected Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 26 of file FastTimerServiceClient.cc.

Constructor & Destructor Documentation

FastTimerServiceClient::FastTimerServiceClient ( edm::ParameterSet const &  config)
explicit

Definition at line 45 of file FastTimerServiceClient.cc.

45  :
46  m_dqm_path( config.getUntrackedParameter<std::string>( "dqmPath" ) )
47 {
48 }
FastTimerServiceClient::~FastTimerServiceClient ( )

Definition at line 50 of file FastTimerServiceClient.cc.

51 {
52 }

Member Function Documentation

void FastTimerServiceClient::dqmEndJob ( DQMStore::IBooker booker,
DQMStore::IGetter getter 
)
overrideprivatevirtual

Implements DQMEDHarvester.

Definition at line 55 of file FastTimerServiceClient.cc.

References fillSummaryPlots().

56 {
57  fillSummaryPlots(booker, getter);
58 }
void fillSummaryPlots(DQMStore::IBooker &booker, DQMStore::IGetter &getter)
void FastTimerServiceClient::dqmEndLuminosityBlock ( DQMStore::IBooker booker,
DQMStore::IGetter getter,
edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  setup 
)
overrideprivatevirtual

Reimplemented from DQMEDHarvester.

Definition at line 61 of file FastTimerServiceClient.cc.

References fillSummaryPlots().

62 {
63  fillSummaryPlots(booker, getter);
64 }
void fillSummaryPlots(DQMStore::IBooker &booker, DQMStore::IGetter &getter)
void FastTimerServiceClient::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 227 of file FastTimerServiceClient.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), and AlCaHLTBitMon_QueryRunRegistry::string.

227  {
228  // The following says we do not know what parameters are allowed so do no validation
229  // Please change this to state exactly what you do use, even if it is no parameters
231  desc.addUntracked<std::string>( "dqmPath", "HLT/TimerService");
232  descriptions.add("fastTimerServiceClient", desc);
233 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void FastTimerServiceClient::fillPathSummaryPlots ( DQMStore::IBooker booker,
DQMStore::IGetter getter,
double  events,
std::string const &  path 
)
private

Definition at line 115 of file FastTimerServiceClient.cc.

References PDRates::average, DQMStore::IBooker::book1D(), counter, postValidation_cfi::efficiency, DQMStore::IGetter::get(), MonitorElement::getTH1F(), MonitorElement::getTProfile(), i, diffTwoXMLs::label, bookConverter::max, min(), n, or, AlCaHLTBitMon_ParallelJobs::p, mergeAndRegister::paths, DQMStore::IBooker::setCurrentFolder(), findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, edmStreamStallGrapher::t, and pileupDistInMC::total.

Referenced by fillProcessSummaryPlots().

115  {
116  // note: the following checks need to be kept separate, as any of these histograms might be missing
117  // if any of them is filled, size will have the total number of paths, and "paths" can be used to extract the list of labels
118  MonitorElement * me;
119  TProfile const * paths = nullptr;
120  uint32_t size = 0;
121 
122  // extract the list of Paths and EndPaths from the summary plots
123  if (( me = getter.get(current_path + "/paths_active_time") )) {
124  paths = me->getTProfile();
125  size = paths->GetXaxis()->GetNbins();
126  } else
127  if (( me = getter.get(current_path + "/paths_total_time") )) {
128  paths = me->getTProfile();
129  size = paths->GetXaxis()->GetNbins();
130  } else
131  if (( me = getter.get(current_path + "/paths_exclusive_time") )) {
132  paths = me->getTProfile();
133  size = paths->GetXaxis()->GetNbins();
134  }
135 
136  if (paths == nullptr)
137  return;
138 
139  // for each path, fill histograms with
140  // - the average time spent in each module (total time spent in that module, averaged over all events)
141  // - the running time spent in each module (total time spent in that module, averaged over the events where that module actually ran)
142  // - the "efficiency" of each module (number of time a module succeded divided by the number of times the has run)
143  booker.setCurrentFolder(current_path + "/Paths");
144  for (uint32_t p = 1; p <= size; ++p) {
145  // extract the list of Paths and EndPaths from the bin labels of one of the summary plots
146  std::string label = paths->GetXaxis()->GetBinLabel(p);
147  MonitorElement * me_counter = getter.get( current_path + "/Paths/" + label + "_module_counter" );
148  MonitorElement * me_total = getter.get( current_path + "/Paths/" + label + "_module_total" );
149  if (me_counter == 0 or me_total == 0)
150  continue;
151  TH1F * counter = me_counter->getTH1F();
152  TH1F * total = me_total ->getTH1F();
153  uint32_t bins = counter->GetXaxis()->GetNbins();
154  double min = counter->GetXaxis()->GetXmin();
155  double max = counter->GetXaxis()->GetXmax();
156  booker.setCurrentFolder(current_path + "/Paths");
157 
158  TH1F * average;
159  TH1F * running;
160  TH1F * efficiency;
161  MonitorElement * me;
162 
163  me = getter.get( current_path + "/Paths/" + label + "_module_average" );
164  if (me) {
165  average = me->getTH1F();
166  assert( me->getTH1F()->GetXaxis()->GetNbins() == (int) bins );
167  assert( me->getTH1F()->GetXaxis()->GetXmin() == min );
168  assert( me->getTH1F()->GetXaxis()->GetXmax() == max );
169  average->Reset();
170  } else {
171  average = booker.book1D(label + "_module_average", label + " module average", bins, min, max)->getTH1F();
172  average->SetYTitle("processing time [ms]");
173  for (uint32_t i = 1; i <= bins; ++i) {
174  const char * module = counter->GetXaxis()->GetBinLabel(i);
175  average->GetXaxis()->SetBinLabel(i, module);
176  }
177  }
178 
179  me = getter.get( current_path + "/Paths/" + label + "_module_running" );
180  if (me) {
181  running = me->getTH1F();
182  assert( me->getTH1F()->GetXaxis()->GetNbins() == (int) bins );
183  assert( me->getTH1F()->GetXaxis()->GetXmin() == min );
184  assert( me->getTH1F()->GetXaxis()->GetXmax() == max );
185  running->Reset();
186  } else {
187  running = booker.book1D(label + "_module_running", label + " module running", bins, min, max)->getTH1F();
188  running->SetYTitle("processing time [ms]");
189  for (uint32_t i = 1; i <= bins; ++i) {
190  const char * module = counter->GetXaxis()->GetBinLabel(i);
191  running->GetXaxis()->SetBinLabel(i, module);
192  }
193  }
194 
195  me = getter.get( current_path + "/Paths/" + label + "_module_efficiency" );
196  if (me) {
197  efficiency = me->getTH1F();
198  assert( me->getTH1F()->GetXaxis()->GetNbins() == (int) bins );
199  assert( me->getTH1F()->GetXaxis()->GetXmin() == min );
200  assert( me->getTH1F()->GetXaxis()->GetXmax() == max );
201  efficiency->Reset();
202  } else {
203  efficiency = booker.book1D(label + "_module_efficiency", label + " module efficiency", bins, min, max)->getTH1F();
204  efficiency->SetYTitle("filter efficiency");
205  efficiency->SetMaximum(1.05);
206  for (uint32_t i = 1; i <= bins; ++i) {
207  const char * module = counter->GetXaxis()->GetBinLabel(i);
208  efficiency->GetXaxis()->SetBinLabel(i, module);
209  }
210  }
211 
212  for (uint32_t i = 1; i <= bins; ++i) {
213  double t = total ->GetBinContent(i);
214  double n = counter->GetBinContent(i);
215  double p = counter->GetBinContent(i+1);
216  average ->SetBinContent(i, t / events);
217  if (n) {
218  running ->SetBinContent(i, t / n);
219  efficiency->SetBinContent(i, p / n);
220  }
221  }
222  }
223 
224 }
int i
Definition: DBlmapReader.cc:9
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:298
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
T min(T a, T b)
Definition: MathUtil.h:58
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
TH1F * getTH1F(void) const
int average
Definition: PDRates.py:137
tuple events
Definition: patZpeak.py:19
static std::atomic< unsigned int > counter
TProfile * getTProfile(void) const
Definition: vlib.h:208
tuple size
Write out results.
void FastTimerServiceClient::fillProcessSummaryPlots ( DQMStore::IBooker booker,
DQMStore::IGetter getter,
std::string const &  path 
)
private

Definition at line 89 of file FastTimerServiceClient.cc.

References DQMStore::IGetter::dirExists(), patZpeak::events, fillPathSummaryPlots(), DQMStore::IGetter::get(), DQMStore::IGetter::getSubdirs(), MonitorElement::getTH1F(), relval_parameters_module::process_name, and DQMStore::IBooker::setCurrentFolder().

Referenced by fillSummaryPlots().

89  {
90  MonitorElement * me = getter.get(current_path + "/event");
91  if (me == 0)
92  // no FastTimerService DQM information
93  return;
94 
95  double events = me->getTH1F()->GetEntries();
96 
97  // look for per-process directories
98  static const boost::regex process_name(".*/process .*");
99  booker.setCurrentFolder(current_path);
100  std::vector<std::string> subdirs = getter.getSubdirs();
101  for (auto const & subdir: subdirs) {
102  if (boost::regex_match(subdir, process_name)) {
103  // look for per-path plots inside each per-process directory
104  if (getter.dirExists(subdir + "/Paths"))
105  fillPathSummaryPlots(booker, getter, events, subdir);
106  }
107  }
108 
109  // look for per-path plots inside the current directory
110  if (getter.dirExists(current_path + "/Paths"))
111  fillPathSummaryPlots(booker, getter, events, current_path);
112 }
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:298
void fillPathSummaryPlots(DQMStore::IBooker &booker, DQMStore::IGetter &getter, double events, std::string const &path)
bool dirExists(const std::string &path)
Definition: DQMStore.cc:314
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
TH1F * getTH1F(void) const
std::vector< std::string > getSubdirs(void)
Definition: DQMStore.cc:302
tuple events
Definition: patZpeak.py:19
void FastTimerServiceClient::fillSummaryPlots ( DQMStore::IBooker booker,
DQMStore::IGetter getter 
)
private

Definition at line 67 of file FastTimerServiceClient.cc.

References fillProcessSummaryPlots(), DQMStore::IGetter::get(), DQMStore::IGetter::getSubdirs(), m_dqm_path, and DQMStore::IBooker::setCurrentFolder().

Referenced by dqmEndJob(), and dqmEndLuminosityBlock().

68 {
69  if (getter.get(m_dqm_path + "/event")) {
70  // the plots are directly in the configured folder
71  fillProcessSummaryPlots(booker, getter, m_dqm_path);
72  } else {
73  static const boost::regex running_n_processes(".*/Running [0-9]+ processes");
75  std::vector<std::string> subdirs = getter.getSubdirs();
76  for (auto const & subdir: subdirs) {
77  if (boost::regex_match(subdir, running_n_processes)) {
78  // the plots are in a per-number-of-processes folder
79  if (getter.get(subdir + "/event"))
80  fillProcessSummaryPlots(booker, getter, subdir);
81  }
82  }
83  }
84 }
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:298
void fillProcessSummaryPlots(DQMStore::IBooker &booker, DQMStore::IGetter &getter, std::string const &path)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
std::vector< std::string > getSubdirs(void)
Definition: DQMStore.cc:302

Member Data Documentation

std::string FastTimerServiceClient::m_dqm_path
private

Definition at line 34 of file FastTimerServiceClient.cc.

Referenced by fillSummaryPlots().