CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SMPSWebPageHelper.cc
Go to the documentation of this file.
1 // $Id: SMPSWebPageHelper.cc,v 1.3 2011/05/09 11:03:34 mommsen Exp $
3 
8 #include "EventFilter/StorageManager/src/ConsumerWebPageHelper.icc"
9 
10 #include <boost/pointer_cast.hpp>
11 
12 
13 namespace smproxy
14 {
16  (
17  xdaq::ApplicationDescriptor* appDesc,
18  StateMachinePtr stateMachine
19  ) :
20  stor::WebPageHelper<SMPSWebPageHelper>(appDesc, "$Name: CMSSW_5_3_11_patch3 $", this, &smproxy::SMPSWebPageHelper::addDOMforHyperLinks),
21  stateMachine_(stateMachine),
22  consumerWebPageHelper_(appDesc, "$Name: CMSSW_5_3_11_patch3 $", this, &smproxy::SMPSWebPageHelper::addDOMforHyperLinks)
23  { }
24 
25 
27  {
28  stor::XHTMLMonitor theMonitor;
30 
32  "Main",
33  stateMachine_->getExternallyVisibleStateName(),
34  stateMachine_->getStateName(),
35  stateMachine_->getReasonForFailed()
36  );
37 
39  stateMachine_->getStatisticsReporter()->
40  getDataRetrieverMonitorCollection().getSummaryStats(summaryStats);
41 
42  addDOMforConnectionInfo(maker, body, summaryStats);
43 
44  maker.addNode("br", body);
45 
46  addDOMforThroughputPerEventType(maker, body, summaryStats);
47 
48  addDOMforHyperLinks(maker, body);
49 
50  // Dump the webpage to the output stream
51  maker.out(*out);
52  }
53 
54 
56  {
57  stor::XHTMLMonitor theMonitor;
59 
61  "Data Retrieval",
62  stateMachine_->getExternallyVisibleStateName(),
63  stateMachine_->getStateName(),
64  stateMachine_->getReasonForFailed()
65  );
66 
67  addDOMforEventServers(maker, body);
68 
69  maker.addNode("hr", body);
70 
71  addDOMforDQMEventServers(maker, body);
72 
73  addDOMforHyperLinks(maker, body);
74 
75  // Dump the webpage to the output stream
76  maker.out(*out);
77  }
78 
79 
81  {
83  stateMachine_->getExternallyVisibleStateName(),
84  stateMachine_->getStateName(),
85  stateMachine_->getReasonForFailed(),
86  stateMachine_->getStatisticsReporter(),
87  stateMachine_->getRegistrationCollection(),
88  stateMachine_->getEventQueueCollection(),
89  stateMachine_->getDQMEventQueueCollection()
90  );
91  }
92 
93 
95  {
96  stor::XHTMLMonitor theMonitor;
98 
100  "DQM Event Processor",
101  stateMachine_->getExternallyVisibleStateName(),
102  stateMachine_->getStateName(),
103  stateMachine_->getReasonForFailed()
104  );
105 
106  const stor::DQMEventMonitorCollection& demc =
107  stateMachine_->getStatisticsReporter()->getDQMEventMonitorCollection();
108  addDOMforProcessedDQMEvents(maker, body, demc);
109  addDOMforDQMEventStatistics(maker, body, demc);
110 
111  addDOMforHyperLinks(maker, body);
112 
113  // Dump the webpage to the output stream
114  maker.out(*out);
115  }
116 
117 
119  (
122  ) const
123  {
124  std::string url = appDescriptor_->getContextDescriptor()->getURL()
125  + "/" + appDescriptor_->getURN();
126 
127  stor::XHTMLMaker::AttrMap linkAttr;
129 
130  maker.addNode("hr", parent);
131 
132  linkAttr[ "href" ] = url;
133  link = maker.addNode("a", parent, linkAttr);
134  maker.addText(link, "Main web page");
135 
136  maker.addNode("hr", parent);
137 
138  linkAttr[ "href" ] = url + "/dataRetriever";
139  link = maker.addNode("a", parent, linkAttr);
140  maker.addText(link, "Data retriever web page");
141 
142  maker.addNode("hr", parent);
143 
144  linkAttr[ "href" ] = url + "/dqmEventStatistics";
145  link = maker.addNode("a", parent, linkAttr);
146  maker.addText(link, "DQM event processor statistics");
147 
148  maker.addNode("hr", parent);
149 
150  linkAttr[ "href" ] = url + "/consumerStatistics";
151  link = maker.addNode("a", parent, linkAttr);
152  maker.addText(link, "Consumer Statistics");
153 
154  maker.addNode("hr", parent);
155  }
156 
157 
159  (
160  stor::XHTMLMaker& maker,
161  stor::XHTMLMaker::Node* parent,
163  ) const
164  {
165  stor::XHTMLMaker::AttrMap colspanAttr;
166  colspanAttr[ "colspan" ] = "2";
167 
168  stor::XHTMLMaker::AttrMap tableAttr = tableAttr_;
169  tableAttr[ "width" ] = "50%";
170 
171  stor::XHTMLMaker::AttrMap widthAttr;
172  widthAttr[ "width" ] = "70%";
173 
174  stor::XHTMLMaker::Node* table = maker.addNode("table", parent, tableAttr);
175 
176  stor::XHTMLMaker::Node* tableRow = maker.addNode("tr", table, rowAttr_);
177  stor::XHTMLMaker::Node* tableDiv = maker.addNode("th", tableRow, colspanAttr);
178  maker.addText(tableDiv, "Connection Information");
179 
180  // # of configured SMs
181  tableRow = maker.addNode("tr", table, rowAttr_);
182  tableDiv = maker.addNode("td", tableRow, widthAttr);
183  maker.addText(tableDiv, "# of configured StorageManagers");
184  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
185  const size_t configuredSMs = stateMachine_->getConfiguration()->
186  getDataRetrieverParams().smRegistrationList_.size();
187  maker.addInt(tableDiv, configuredSMs);
188 
189  // # of requested SMs connections
190  tableRow = maker.addNode("tr", table, rowAttr_);
191  tableDiv = maker.addNode("td", tableRow, widthAttr);
192  maker.addText(tableDiv, "# of requested SM connections");
193  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
194  maker.addInt(tableDiv, summaryStats.registeredSMs);
195 
196  // # of active SMs connections
197  tableRow = maker.addNode("tr", table, rowAttr_);
198  tableDiv = maker.addNode("td", tableRow, widthAttr);
199  maker.addText(tableDiv, "# of active SM connections");
200  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
201  maker.addInt(tableDiv, summaryStats.activeSMs);
202 
203  // # of connected event consumers
204  tableRow = maker.addNode("tr", table, rowAttr_);
205  tableDiv = maker.addNode("td", tableRow, widthAttr);
206  maker.addText(tableDiv, "# of connected event consumers");
207  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
209  stateMachine_->getRegistrationCollection()->
210  getEventConsumers(consumers);
211  maker.addInt(tableDiv, consumers.size());
212 
213  // # of connected DQM event (histogram) consumers
214  tableRow = maker.addNode("tr", table, rowAttr_);
215  tableDiv = maker.addNode("td", tableRow, widthAttr);
216  maker.addText(tableDiv, "# of connected histogram consumers");
217  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
219  stateMachine_->getRegistrationCollection()->
220  getDQMEventConsumers(dqmConsumers);
221  maker.addInt(tableDiv, dqmConsumers.size());
222  }
223 
224 
226  (
227  stor::XHTMLMaker& maker,
228  stor::XHTMLMaker::Node* parent,
230  ) const
231  {
232  stor::XHTMLMaker::AttrMap colspanAttr;
233  colspanAttr[ "colspan" ] = "13";
234 
235  stor::XHTMLMaker::AttrMap subColspanAttr;
236 
237  stor::XHTMLMaker::AttrMap rowspanAttr;
238  rowspanAttr[ "rowspan" ] = "3";
239  rowspanAttr[ "width" ] = "30%";
240 
241  stor::XHTMLMaker::AttrMap noWrapAttr;
242  noWrapAttr[ "style" ] = "white-space: nowrap;";
243 
244  stor::XHTMLMaker::Node* table = maker.addNode("table", parent, tableAttr_);
245  stor::XHTMLMaker::Node* tableRow = maker.addNode("tr", table, rowAttr_);
246  stor::XHTMLMaker::Node* tableDiv = maker.addNode("th", tableRow, colspanAttr);
247  maker.addText(tableDiv, "Throughput");
248 
249  tableRow = maker.addNode("tr", table, rowAttr_);
250  tableDiv = maker.addNode("th", tableRow, rowspanAttr);
251  maker.addText(tableDiv, "Requested Event Type");
252  subColspanAttr[ "colspan" ] = "2";
253  tableDiv = maker.addNode("th", tableRow, subColspanAttr);
254  maker.addText(tableDiv, "");
255  subColspanAttr[ "colspan" ] = "6";
256  tableDiv = maker.addNode("th", tableRow, subColspanAttr);
257  maker.addText(tableDiv, "Input");
258  tableDiv = maker.addNode("th", tableRow, subColspanAttr);
259  maker.addText(tableDiv, "Output");
260 
261  subColspanAttr[ "colspan" ] = "2";
262  tableRow = maker.addNode("tr", table, rowAttr_);
263  tableDiv = maker.addNode("th", tableRow, subColspanAttr);
264  maker.addText(tableDiv, "Average Event Size (kB)");
265  tableDiv = maker.addNode("th", tableRow, subColspanAttr);
266  maker.addText(tableDiv, "Event Rate (Hz)");
267  tableDiv = maker.addNode("th", tableRow, subColspanAttr);
268  maker.addText(tableDiv, "Bandwidth (kB/s)");
269  tableDiv = maker.addNode("th", tableRow, subColspanAttr);
270  maker.addText(tableDiv, "Corrupted Event Rate (Hz)");
271  tableDiv = maker.addNode("th", tableRow, subColspanAttr);
272  maker.addText(tableDiv, "Event Rate (Hz)");
273  tableDiv = maker.addNode("th", tableRow, subColspanAttr);
274  maker.addText(tableDiv, "Bandwidth (kB/s)");
275 
276  tableRow = maker.addNode("tr", table, rowAttr_);
277  tableDiv = maker.addNode("th", tableRow);
278  maker.addText(tableDiv, "overall");
279  tableDiv = maker.addNode("th", tableRow, noWrapAttr);
280  maker.addText(tableDiv, "last 60 s");
281  tableDiv = maker.addNode("th", tableRow);
282  maker.addText(tableDiv, "overall");
283  tableDiv = maker.addNode("th", tableRow, noWrapAttr);
284  maker.addText(tableDiv, "last 60 s");
285  tableDiv = maker.addNode("th", tableRow);
286  maker.addText(tableDiv, "overall");
287  tableDiv = maker.addNode("th", tableRow, noWrapAttr);
288  maker.addText(tableDiv, "last 60 s");
289  tableDiv = maker.addNode("th", tableRow);
290  maker.addText(tableDiv, "overall");
291  tableDiv = maker.addNode("th", tableRow, noWrapAttr);
292  maker.addText(tableDiv, "last 60 s");
293  tableDiv = maker.addNode("th", tableRow);
294  maker.addText(tableDiv, "overall");
295  tableDiv = maker.addNode("th", tableRow, noWrapAttr);
296  maker.addText(tableDiv, "last 60 s");
297  tableDiv = maker.addNode("th", tableRow);
298  maker.addText(tableDiv, "overall");
299  tableDiv = maker.addNode("th", tableRow, noWrapAttr);
300  maker.addText(tableDiv, "last 60 s");
301 
302  if ( summaryStats.eventTypeStats.empty() )
303  {
304  stor::XHTMLMaker::AttrMap messageAttr = colspanAttr;
305  messageAttr[ "align" ] = "center";
306 
307  stor::XHTMLMaker::Node* tableRow = maker.addNode("tr", table, rowAttr_);
308  stor::XHTMLMaker::Node* tableDiv = maker.addNode("td", tableRow, messageAttr);
309  maker.addText(tableDiv, "No data flowing, yet.");
310  return;
311  }
312 
313  bool evenRow = false;
314 
315  for (DataRetrieverMonitorCollection::SummaryStats::EventTypeStatList::const_iterator
316  it = summaryStats.eventTypeStats.begin(), itEnd = summaryStats.eventTypeStats.end();
317  it != itEnd; ++it)
318  {
319  stor::XHTMLMaker::AttrMap rowAttr = rowAttr_;
320  if( evenRow )
321  {
322  rowAttr[ "style" ] = "background-color:#e0e0e0;";
323  evenRow = false;
324  }
325  else
326  {
327  evenRow = true;
328  }
329  stor::XHTMLMaker::Node* tableRow = maker.addNode("tr", table, rowAttr);
330  addRowForEventType(maker, tableRow, *it);
331  }
332 
333  addSummaryRowForThroughput(maker, table, summaryStats);
334  }
335 
336 
338  (
339  stor::XHTMLMaker& maker,
340  stor::XHTMLMaker::Node* tableRow,
342  ) const
343  {
344  // Event type
345  stor::XHTMLMaker::Node* tableDiv = maker.addNode("td", tableRow);
346  stor::XHTMLMaker::Node* pre = maker.addNode("pre", tableDiv);
347  std::ostringstream eventType;
348  stats.first->eventType(eventType);
349  maker.addText(pre, eventType.str());
350 
351  // Average event size
352  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
353  maker.addDouble(tableDiv, stats.second.sizeStats.getValueAverage(stor::MonitoredQuantity::FULL));
354  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
355  maker.addDouble(tableDiv, stats.second.sizeStats.getValueAverage(stor::MonitoredQuantity::RECENT));
356 
357  // Input event rate
358  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
359  maker.addDouble(tableDiv, stats.second.sizeStats.getSampleRate(stor::MonitoredQuantity::FULL));
360  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
361  maker.addDouble(tableDiv, stats.second.sizeStats.getSampleRate(stor::MonitoredQuantity::RECENT));
362 
363  // Input bandwidth
364  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
365  maker.addDouble(tableDiv, stats.second.sizeStats.getValueRate(stor::MonitoredQuantity::FULL));
366  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
367  maker.addDouble(tableDiv, stats.second.sizeStats.getValueRate(stor::MonitoredQuantity::RECENT));
368 
369  // Input corrupted events rate
370  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
371  maker.addDouble(tableDiv,
372  stats.second.corruptedEventsStats.getSampleRate(stor::MonitoredQuantity::FULL));
373  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
374  maker.addDouble(tableDiv,
375  stats.second.corruptedEventsStats.getSampleRate(stor::MonitoredQuantity::RECENT));
376 
377  // Get statistics for consumers requesting this event type
378  stor::QueueIDs queueIDs;
379  bool isEventConsumer =
380  stateMachine_->getDataManager()->getQueueIDsFromDataEventRetrievers(
381  boost::dynamic_pointer_cast<stor::EventConsumerRegistrationInfo>(stats.first),
382  queueIDs
383  );
384  if ( ! isEventConsumer)
385  {
386  stateMachine_->getDataManager()->getQueueIDsFromDQMEventRetrievers(
387  boost::dynamic_pointer_cast<stor::DQMEventConsumerRegistrationInfo>(stats.first),
388  queueIDs
389  );
390  }
391 
392  if ( queueIDs.empty() )
393  {
394  stor::XHTMLMaker::AttrMap noConsumersAttr = tableLabelAttr_;
395  noConsumersAttr[ "colspan" ] = "4";
396  tableDiv = maker.addNode("td", tableRow, noConsumersAttr);
397  maker.addText(tableDiv, "no consumers connected");
398  return;
399  }
400 
402  stateMachine_->getStatisticsReporter()->getEventConsumerMonitorCollection();
404  stateMachine_->getStatisticsReporter()->getDQMConsumerMonitorCollection();
406  isEventConsumer ?
407  static_cast<const stor::ConsumerMonitorCollection&>(ecmc) :
408  static_cast<const stor::ConsumerMonitorCollection&>(dcmc);
409 
410  double rateOverall = 0;
411  double rateRecent = 0;
412  double bandwidthOverall = 0;
413  double bandwidthRecent = 0;
414 
415  for ( stor::QueueIDs::const_iterator it = queueIDs.begin(),
416  itEnd = queueIDs.end(); it != itEnd; ++it)
417  {
419  if ( cmc.getServed(*it, result) )
420  {
421  rateOverall += result.getSampleRate(stor::MonitoredQuantity::FULL);
422  rateRecent += result.getSampleRate(stor::MonitoredQuantity::RECENT);
423  bandwidthOverall += result.getValueRate(stor::MonitoredQuantity::FULL) / 1024;
424  bandwidthRecent += result.getValueRate(stor::MonitoredQuantity::RECENT) / 1024;
425  }
426  }
427 
428  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
429  maker.addDouble(tableDiv, rateOverall);
430  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
431  maker.addDouble(tableDiv, rateRecent);
432  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
433  maker.addDouble(tableDiv, bandwidthOverall);
434  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
435  maker.addDouble(tableDiv, bandwidthRecent);
436  }
437 
438 
440  (
441  stor::XHTMLMaker& maker,
444  ) const
445  {
446  stor::XHTMLMaker::Node* tableRow = maker.addNode("tr", table, specialRowAttr_);
447  stor::XHTMLMaker::Node* tableDiv = maker.addNode("td", tableRow);
448  maker.addText(tableDiv, "Total");
449 
450  // Average event size
451  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
453  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
455 
456  // Input event rate
457  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
459  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
461 
462  // Input bandwidth
463  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
465  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
467 
468  // Input corrupted events rate
469  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
471  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
473 
475  stateMachine_->getStatisticsReporter()->getEventConsumerMonitorCollection();
477  stateMachine_->getStatisticsReporter()->getDQMConsumerMonitorCollection();
478  stor::ConsumerMonitorCollection::TotalStats ecmcStats, dcmcStats;
479  ecmc.getTotalStats(ecmcStats);
480  dcmc.getTotalStats(dcmcStats);
481 
482  // Output event rate
483  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
484  maker.addDouble(tableDiv,
487  );
488  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
489  maker.addDouble(tableDiv,
492  );
493 
494  // Output bandwidth
495  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
496  maker.addDouble(tableDiv,
499  );
500  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
501  maker.addDouble(tableDiv,
504  );
505  }
506 
507 
509  (
510  stor::XHTMLMaker& maker,
511  stor::XHTMLMaker::Node* parent
512  ) const
513  {
514  stor::XHTMLMaker::AttrMap colspanAttr;
515  colspanAttr[ "colspan" ] = "14";
516 
517  stor::XHTMLMaker::Node* table = maker.addNode("table", parent, tableAttr_);
518 
519  stor::XHTMLMaker::Node* tableRow = maker.addNode("tr", table, rowAttr_);
520  stor::XHTMLMaker::Node* tableDiv = maker.addNode("th", tableRow, colspanAttr);
521  maker.addText(tableDiv, "Event Servers");
522 
523  stor::XHTMLMaker::AttrMap rowspanAttr;
524  rowspanAttr[ "rowspan" ] = "2";
525 
526  stor::XHTMLMaker::AttrMap subColspanAttr;
527  subColspanAttr[ "colspan" ] = "2";
528 
529  stor::XHTMLMaker::AttrMap noWrapAttr;
530  noWrapAttr[ "style" ] = "white-space: nowrap;";
531 
532  // Header
533  tableRow = maker.addNode("tr", table, specialRowAttr_);
534  tableDiv = maker.addNode("th", tableRow, rowspanAttr);
535  maker.addText(tableDiv, "Hostname");
536  tableDiv = maker.addNode("th", tableRow, rowspanAttr);
537  maker.addText(tableDiv, "Status");
538  tableDiv = maker.addNode("th", tableRow, rowspanAttr);
539  maker.addText(tableDiv, "Requested Event Type");
540  tableDiv = maker.addNode("th", tableRow, rowspanAttr);
541  maker.addText(tableDiv, "Max Request Rate (Hz)");
542  tableDiv = maker.addNode("th", tableRow, subColspanAttr);
543  maker.addText(tableDiv, "Event Rate (Hz)");
544  tableDiv = maker.addNode("th", tableRow, subColspanAttr);
545  maker.addText(tableDiv, "Average Event Size (kB)");
546  tableDiv = maker.addNode("th", tableRow, subColspanAttr);
547  maker.addText(tableDiv, "Bandwidth (kB/s)");
548  tableDiv = maker.addNode("th", tableRow, subColspanAttr);
549  maker.addText(tableDiv, "Corrupted Events");
550  tableDiv = maker.addNode("th", tableRow, subColspanAttr);
551  maker.addText(tableDiv, "Corrupted Event Rate (Hz)");
552 
553  tableRow = maker.addNode("tr", table, specialRowAttr_);
554  tableDiv = maker.addNode("th", tableRow);
555  maker.addText(tableDiv, "overall");
556  tableDiv = maker.addNode("th", tableRow, noWrapAttr);
557  maker.addText(tableDiv, "last 60 s");
558  tableDiv = maker.addNode("th", tableRow);
559  maker.addText(tableDiv, "overall");
560  tableDiv = maker.addNode("th", tableRow, noWrapAttr);
561  maker.addText(tableDiv, "last 60 s");
562  tableDiv = maker.addNode("th", tableRow);
563  maker.addText(tableDiv, "overall");
564  tableDiv = maker.addNode("th", tableRow, noWrapAttr);
565  maker.addText(tableDiv, "last 60 s");
566  tableDiv = maker.addNode("th", tableRow);
567  maker.addText(tableDiv, "overall");
568  tableDiv = maker.addNode("th", tableRow, noWrapAttr);
569  maker.addText(tableDiv, "last 60 s");
570  tableDiv = maker.addNode("th", tableRow);
571  maker.addText(tableDiv, "overall");
572  tableDiv = maker.addNode("th", tableRow, noWrapAttr);
573  maker.addText(tableDiv, "last 60 s");
574 
576  stateMachine_->getStatisticsReporter()->getDataRetrieverMonitorCollection()
577  .getStatsByEventTypesPerConnection(eventTypePerConnectionStats);
578 
580  stateMachine_->getStatisticsReporter()->getDataRetrieverMonitorCollection()
581  .getStatsByConnection(connectionStats);
582 
583  if ( eventTypePerConnectionStats.empty() )
584  {
585  stor::XHTMLMaker::AttrMap messageAttr = colspanAttr;
586  messageAttr[ "align" ] = "center";
587 
588  tableRow = maker.addNode("tr", table, rowAttr_);
589  tableDiv = maker.addNode("td", tableRow, messageAttr);
590  maker.addText(tableDiv, "Not registered to any event servers yet");
591  return;
592  }
593 
594  bool evenRow = false;
595 
596  for (DataRetrieverMonitorCollection::EventTypePerConnectionStatList::const_iterator
597  it = eventTypePerConnectionStats.begin(), itEnd = eventTypePerConnectionStats.end();
598  it != itEnd; ++it)
599  {
600  stor::XHTMLMaker::AttrMap rowAttr = rowAttr_;
601  if( evenRow )
602  {
603  rowAttr[ "style" ] = "background-color:#e0e0e0;";
604  evenRow = false;
605  }
606  else
607  {
608  evenRow = true;
609  }
610  stor::XHTMLMaker::Node* tableRow = maker.addNode("tr", table, rowAttr);
611  addRowForEventServer(maker, tableRow, *it);
612 
613  const std::string currentSourceURL = it->regPtr->sourceURL();
614 
615  if ( (it+1) == eventTypePerConnectionStats.end() ||
616  (it+1)->regPtr->sourceURL() != currentSourceURL )
617  {
618  addSummaryRowForEventServer(maker, table,
619  connectionStats.find(currentSourceURL));
620  }
621  }
622  }
623 
624 
626  (
627  stor::XHTMLMaker& maker,
628  stor::XHTMLMaker::Node* tableRow,
630  ) const
631  {
632  stor::XHTMLMaker::Node* tableDiv;
633 
634  // Hostname
635  addDOMforSMhost(maker, tableRow, stats.regPtr->sourceURL());
636 
637  // Status
639  {
640  tableDiv = maker.addNode("td", tableRow, tableLabelAttr_);
641  maker.addText(tableDiv, "Connected");
642  }
643  else
644  {
645  stor::XHTMLMaker::AttrMap statusAttr = tableLabelAttr_;
646  statusAttr[ "style" ] = "color:brown;";
647  tableDiv = maker.addNode("td", tableRow, statusAttr);
648  std::ostringstream status;
649  status << stats.connectionStatus;
650  maker.addText(tableDiv, status.str());
651  }
652 
653  // Requested event type
654  tableDiv = maker.addNode("td", tableRow, tableLabelAttr_);
655  stor::XHTMLMaker::Node* pre = maker.addNode("pre", tableDiv);
656  std::ostringstream eventType;
657  stats.regPtr->eventType(eventType);
658  maker.addText(pre, eventType.str());
659 
660  // Max request rate
661  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
663  stats.regPtr->minEventRequestInterval();
664  if ( interval.is_not_a_date_time() )
665  maker.addText(tableDiv, "unlimited");
666  else
667  maker.addDouble(tableDiv, 1 / stor::utils::durationToSeconds(interval), 1);
668 
669  // Event rate
670  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
672  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
674 
675  // Average event size
676  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
678  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
680 
681  // Bandwidth
682  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
684  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
686 
687  // Corrupted events counts
688  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
689  maker.addDouble(tableDiv,
691  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
692  maker.addDouble(tableDiv,
694 
695  // Corrupted event rate
696  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
697  maker.addDouble(tableDiv,
699  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
700  maker.addDouble(tableDiv,
702  }
703 
704 
706  (
707  stor::XHTMLMaker& maker,
708  stor::XHTMLMaker::Node* table,
709  DataRetrieverMonitorCollection::ConnectionStats::const_iterator pos
710  ) const
711  {
712  stor::XHTMLMaker::Node* tableRow = maker.addNode("tr", table, specialRowAttr_);
713 
714  // Hostname
715  addDOMforSMhost(maker, tableRow, pos->first);
716 
717  // Status, requst type, and max request rate not filled
718  stor::XHTMLMaker::Node* tableDiv = maker.addNode("td", tableRow);
719  tableDiv = maker.addNode("td", tableRow);
720  tableDiv = maker.addNode("td", tableRow);
721 
722  // Event rate
723  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
724  maker.addDouble(tableDiv, pos->second.sizeStats.getSampleRate(stor::MonitoredQuantity::FULL));
725  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
726  maker.addDouble(tableDiv, pos->second.sizeStats.getSampleRate(stor::MonitoredQuantity::RECENT));
727 
728  // Average event size
729  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
730  maker.addDouble(tableDiv, pos->second.sizeStats.getValueAverage(stor::MonitoredQuantity::FULL));
731  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
732  maker.addDouble(tableDiv, pos->second.sizeStats.getValueAverage(stor::MonitoredQuantity::RECENT));
733 
734  // Bandwidth
735  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
736  maker.addDouble(tableDiv, pos->second.sizeStats.getValueRate(stor::MonitoredQuantity::FULL));
737  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
738  maker.addDouble(tableDiv, pos->second.sizeStats.getValueRate(stor::MonitoredQuantity::RECENT));
739 
740  // Corrupted events counts
741  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
742  maker.addDouble(tableDiv,
743  pos->second.corruptedEventsStats.getValueSum(stor::MonitoredQuantity::FULL), 0);
744  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
745  maker.addDouble(tableDiv,
746  pos->second.corruptedEventsStats.getValueSum(stor::MonitoredQuantity::RECENT), 0);
747 
748  // Corrupted event rate
749  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
750  maker.addDouble(tableDiv,
751  pos->second.corruptedEventsStats.getValueRate(stor::MonitoredQuantity::FULL));
752  tableDiv = maker.addNode("td", tableRow, tableValueAttr_);
753  maker.addDouble(tableDiv,
754  pos->second.corruptedEventsStats.getValueRate(stor::MonitoredQuantity::RECENT));
755  }
756 
757 
759  (
760  stor::XHTMLMaker& maker,
761  stor::XHTMLMaker::Node* tableRow,
762  const std::string& sourceURL
763  ) const
764  {
765  stor::XHTMLMaker::Node* tableDiv = maker.addNode("td", tableRow, tableLabelAttr_);
766  std::string::size_type startPos = sourceURL.find("//");
767  if ( startPos == std::string::npos )
768  startPos = 0;
769  else
770  startPos += 2;
771  const std::string::size_type endPos = sourceURL.find('.');
772  const std::string hostname = sourceURL.substr(startPos,(endPos-startPos));
773  stor::XHTMLMaker::AttrMap linkAttr;
774  linkAttr[ "href" ] = sourceURL + "/consumerStatistics";
775  stor::XHTMLMaker::Node* link = maker.addNode("a", tableDiv, linkAttr);
776  maker.addText(link, hostname);
777  }
778 
779 
781  (
782  stor::XHTMLMaker& maker,
783  stor::XHTMLMaker::Node* parent
784  ) const
785  {
786  }
787 
788 } // namespace smproxy
789 
790 
double getValueRate(DataSetType t=FULL) const
list table
Definition: asciidump.py:386
Node * addNode(const std::string &name, Node *parent, const AttrMap &attrs)
Definition: XHTMLMaker.cc:146
void addDOMforDQMEventStatistics(XHTMLMaker &maker, XHTMLMaker::Node *parent, DQMEventMonitorCollection const &) const
void addDouble(Node *parent, const double &value, const unsigned int &precision=2)
Definition: XHTMLMaker.cc:254
std::map< std::string, EventStats > ConnectionStats
std::vector< EventConsRegPtr > ConsumerRegistrations
bool getServed(const QueueID &qid, MonitoredQuantity::Stats &result) const
list parent
Definition: dbtoconf.py:74
void addText(Node *parent, const std::string &)
Definition: XHTMLMaker.cc:173
void addSummaryRowForThroughput(stor::XHTMLMaker &, stor::XHTMLMaker::Node *table, DataRetrieverMonitorCollection::SummaryStats const &) const
tuple interval
Definition: MergeJob_cfg.py:20
std::vector< QueueID > QueueIDs
Definition: QueueID.h:80
void defaultWebPage(xgi::Output *) const
void dataRetrieverWebPage(xgi::Output *) const
uint16_t size_type
std::string link(std::string &nm, std::string &ns)
Definition: hierarchy.cc:47
boost::posix_time::time_duration Duration_t
Definition: Utils.h:41
std::vector< EventTypePerConnectionStats > EventTypePerConnectionStatList
void addDOMforDQMEventServers(stor::XHTMLMaker &, stor::XHTMLMaker::Node *parent) const
edm::serviceregistry::AllArgsMaker< DTDataMonitorInterface, DTDataIntegrityTask > maker
Definition: plugins.cc:73
tuple result
Definition: query.py:137
std::map< std::string, std::string > AttrMap
Definition: XHTMLMaker.h:36
ConsumerWebPageHelper_t consumerWebPageHelper_
void addInt(Node *parent, const int &)
Definition: XHTMLMaker.cc:184
double getSampleRate(DataSetType t=FULL) const
void dqmEventStatisticsWebPage(xgi::Output *) const
double getValueAverage(DataSetType t=FULL) const
void addDOMforProcessedDQMEvents(XHTMLMaker &maker, XHTMLMaker::Node *parent, DQMEventMonitorCollection const &) const
void addSummaryRowForEventServer(stor::XHTMLMaker &, stor::XHTMLMaker::Node *table, DataRetrieverMonitorCollection::ConnectionStats::const_iterator) const
tuple out
Definition: dbtoconf.py:99
void addDOMforSMhost(stor::XHTMLMaker &, stor::XHTMLMaker::Node *tableRow, const std::string &sourceURL) const
SMPSWebPageHelper(xdaq::ApplicationDescriptor *, StateMachinePtr)
void addDOMforConnectionInfo(stor::XHTMLMaker &, stor::XHTMLMaker::Node *parent, const DataRetrieverMonitorCollection::SummaryStats &) const
boost::shared_ptr< StateMachine > StateMachinePtr
Definition: StateMachine.h:144
#define Output(cl)
Definition: vmac.h:193
virtual void addDOMforHyperLinks(stor::XHTMLMaker &, stor::XHTMLMaker::Node *parent) const
void consumerStatistics(xgi::Output *, const std::string &externallyVisibleState, const std::string &innerStateName, const std::string &errorMsg, boost::shared_ptr< StatisticsReporter_t >, RegistrationCollectionPtr, boost::shared_ptr< EventQueueCollection_t >, DQMEventQueueCollectionPtr) const
std::vector< DQMEventConsRegPtr > DQMConsumerRegistrations
double durationToSeconds(Duration_t const &)
Definition: Utils.h:147
void addDOMforThroughputPerEventType(stor::XHTMLMaker &, stor::XHTMLMaker::Node *parent, const DataRetrieverMonitorCollection::SummaryStats &) const
xercesc::DOMElement Node
Definition: XHTMLMaker.h:35
tuple status
Definition: ntuplemaker.py:245
void addRowForEventServer(stor::XHTMLMaker &, stor::XHTMLMaker::Node *table, DataRetrieverMonitorCollection::EventTypePerConnectionStats const &) const
XHTMLMaker::Node * createWebPageBody(XHTMLMaker &, const std::string &pageTitle, const std::string &externallyVisibleState, const std::string &innerStateName, const std::string &errorMsg) const
double getValueSum(DataSetType t=FULL) const
void addDOMforEventServers(stor::XHTMLMaker &, stor::XHTMLMaker::Node *parent) const
void addRowForEventType(stor::XHTMLMaker &, stor::XHTMLMaker::Node *table, DataRetrieverMonitorCollection::SummaryStats::EventTypeStats const &) const
void consumerStatisticsWebPage(xgi::Output *) const