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:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 FastTimerServiceClient (edm::ParameterSet const &)
 
 ~FastTimerServiceClient ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- 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
 
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::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup) override
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) override
 
void fillPathSummaryPlots (double events, std::string const &path)
 
void fillProcessSummaryPlots (std::string const &path)
 
void fillSummaryPlots ()
 

Private Attributes

std::string m_dqm_path
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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 47 of file FastTimerServiceClient.cc.

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

Definition at line 52 of file FastTimerServiceClient.cc.

53 {
54 }

Member Function Documentation

void FastTimerServiceClient::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 57 of file FastTimerServiceClient.cc.

58 {
59 }
void FastTimerServiceClient::endLuminosityBlock ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  setup 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 68 of file FastTimerServiceClient.cc.

References fillSummaryPlots().

69 {
71 }
void FastTimerServiceClient::endRun ( edm::Run const &  run,
edm::EventSetup const &  setup 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 62 of file FastTimerServiceClient.cc.

References fillSummaryPlots().

63 {
65 }
void FastTimerServiceClient::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 198 of file FastTimerServiceClient.cc.

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

198  {
199  // The following says we do not know what parameters are allowed so do no validation
200  // Please change this to state exactly what you do use, even if it is no parameters
202  desc.addUntracked<std::string>( "dqmPath", "HLT/TimerService");
203  descriptions.add("fastTimerServiceClient", desc);
204 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void FastTimerServiceClient::fillPathSummaryPlots ( double  events,
std::string const &  path 
)
private

Definition at line 129 of file FastTimerServiceClient.cc.

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

Referenced by fillProcessSummaryPlots().

129  {
131 
132  // note: the following checks need to be kept separate, as any of these histograms might be missing
133  // 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
134  MonitorElement * me;
135  TProfile const * paths = nullptr;
136  uint32_t size = 0;
137 
138  // extract the list of Paths and EndPaths from the summary plots
139  if (( me = dqm->get(current_path + "/paths_active_time") )) {
140  paths = me->getTProfile();
141  size = paths->GetXaxis()->GetNbins();
142  } else
143  if (( me = dqm->get(current_path + "/paths_total_time") )) {
144  paths = me->getTProfile();
145  size = paths->GetXaxis()->GetNbins();
146  } else
147  if (( me = dqm->get(current_path + "/paths_exclusive_time") )) {
148  paths = me->getTProfile();
149  size = paths->GetXaxis()->GetNbins();
150  }
151 
152  if (paths == nullptr)
153  return;
154 
155  // for each path, fill histograms with
156  // - the average time spent in each module (total time spent in that module, averaged over all events)
157  // - the running time spent in each module (total time spent in that module, averaged over the events where that module actually ran)
158  // - the "efficiency" of each module (number of time a module succeded divided by the number of times the has run)
159  dqm->setCurrentFolder(current_path + "/Paths");
160  for (uint32_t p = 1; p <= size; ++p) {
161  // extract the list of Paths and EndPaths from the bin labels of one of the summary plots
162  std::string label = paths->GetXaxis()->GetBinLabel(p);
163  MonitorElement * me_counter = dqm->get( current_path + "/Paths/" + label + "_module_counter" );
164  MonitorElement * me_total = dqm->get( current_path + "/Paths/" + label + "_module_total" );
165  if (me_counter == 0 or me_total == 0)
166  continue;
167  TH1F * counter = me_counter->getTH1F();
168  TH1F * total = me_total ->getTH1F();
169  uint32_t bins = counter->GetXaxis()->GetNbins();
170  double min = counter->GetXaxis()->GetXmin();
171  double max = counter->GetXaxis()->GetXmax();
172  TH1F * average = dqm->book1D(label + "_module_average", label + " module average", bins, min, max)->getTH1F();
173  average ->SetYTitle("processing time [ms]");
174  TH1F * running = dqm->book1D(label + "_module_running", label + " module running", bins, min, max)->getTH1F();
175  running ->SetYTitle("processing time [ms]");
176  TH1F * efficiency = dqm->book1D(label + "_module_efficiency", label + " module efficiency", bins, min, max)->getTH1F();
177  efficiency->SetYTitle("filter efficiency");
178  efficiency->SetMaximum(1.05);
179  for (uint32_t i = 1; i <= bins; ++i) {
180  const char * module = counter->GetXaxis()->GetBinLabel(i);
181  average ->GetXaxis()->SetBinLabel(i, module);
182  running ->GetXaxis()->SetBinLabel(i, module);
183  efficiency->GetXaxis()->SetBinLabel(i, module);
184  double t = total ->GetBinContent(i);
185  double n = counter->GetBinContent(i);
186  double p = counter->GetBinContent(i+1);
187  average ->SetBinContent(i, t / events);
188  if (n) {
189  running ->SetBinContent(i, t / n);
190  efficiency->SetBinContent(i, p / n);
191  }
192  }
193  }
194 
195 }
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
const T & max(const T &a, const T &b)
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 ( std::string const &  path)
private

Definition at line 101 of file FastTimerServiceClient.cc.

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

Referenced by fillSummaryPlots().

101  {
103 
104  MonitorElement * me = dqm->get(current_path + "/event");
105  if (me == 0)
106  // no FastTimerService DQM information
107  return;
108 
109  double events = me->getTH1F()->GetEntries();
110 
111  // look for per-process directories
112  static const boost::regex process_name(".*/process .*");
113  dqm->setCurrentFolder(current_path);
114  std::vector<std::string> subdirs = dqm->getSubdirs();
115  for (auto const & subdir: subdirs) {
116  if (boost::regex_match(subdir, process_name)) {
117  // look for per-path plots inside each per-process directory
118  if (dqm->dirExists(subdir + "/Paths"))
119  fillPathSummaryPlots(events, subdir);
120  }
121  }
122 
123  // look for per-path plots inside the current directory
124  if (dqm->dirExists(current_path + "/Paths"))
125  fillPathSummaryPlots(events, current_path);
126 }
TH1F * getTH1F(void) const
tuple events
Definition: patZpeak.py:19
void fillPathSummaryPlots(double events, std::string const &path)
void FastTimerServiceClient::fillSummaryPlots ( void  )
private

Definition at line 74 of file FastTimerServiceClient.cc.

References fillProcessSummaryPlots(), DQMStore::get(), DQMStore::getSubdirs(), m_dqm_path, cppFunctionSkipper::operator, and DQMStore::setCurrentFolder().

Referenced by endLuminosityBlock(), and endRun().

75 {
77  if (dqm == 0)
78  // cannot access the DQM store
79  return;
80 
81  if (dqm->get(m_dqm_path + "/event")) {
82  // the plots are directly in the configured folder
84  } else {
85  static const boost::regex running_n_processes(".*/Running [0-9]+ processes");
86  dqm->setCurrentFolder(m_dqm_path);
87  std::vector<std::string> subdirs = dqm->getSubdirs();
88  for (auto const & subdir: subdirs) {
89  if (boost::regex_match(subdir, running_n_processes)) {
90  // the plots are in a per-number-of-processes folder
91  if (dqm->get(subdir + "/event"))
93  }
94  }
95  }
96 }
void fillProcessSummaryPlots(std::string const &path)

Member Data Documentation

std::string FastTimerServiceClient::m_dqm_path
private

Definition at line 34 of file FastTimerServiceClient.cc.

Referenced by fillSummaryPlots().