CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes | Friends
edm::service::ELlimitsTable Class Reference

#include <ELlimitsTable.h>

Public Member Functions

bool add (const ELextendedID &xid)
 
 ELlimitsTable ()
 
ELlimitsTableoperator= (const ELlimitsTable &t)
 
void setInterval (const ELstring &id, int interval)
 
void setInterval (const ELseverityLevel &sev, int interval)
 
void setLimit (const ELstring &id, int n)
 
void setLimit (const ELseverityLevel &sev, int n)
 
void setTableLimit (int n)
 
void setTimespan (const ELstring &id, int n)
 
void setTimespan (const ELseverityLevel &sev, int n)
 
void wipe ()
 
void zero ()
 
 ~ELlimitsTable ()
 

Protected Attributes

ELmap_counts counts
 
ELmap_limits limits
 
int severityIntervals [ELseverityLevel::nLevels]
 
int severityLimits [ELseverityLevel::nLevels]
 
int severityTimespans [ELseverityLevel::nLevels]
 
int tableLimit
 
int wildcardInterval
 
int wildcardLimit
 
int wildcardTimespan
 

Friends

class ELdestination
 
class ELoutput
 

Detailed Description

Definition at line 60 of file ELlimitsTable.h.

Constructor & Destructor Documentation

edm::service::ELlimitsTable::ELlimitsTable ( )

Definition at line 41 of file ELlimitsTable.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, relval_2017::k, edm::ELseverityLevel::nLevels, severityIntervals, severityLimits, and severityTimespans.

42 : wildcardLimit ( -1 )
43 , wildcardInterval( -1 )
44 , wildcardTimespan( -1 )
45 , tableLimit ( -1 )
46 , limits ( )
47 , counts ( )
48 {
49 
50 #ifdef ELlimitsTableCONSTRUCTOR_TRACE
51  std::cerr << "Constructor for ELlimitsTable\n";
52 #endif
53 
54  for ( int k = 0; k < ELseverityLevel::nLevels; ++k ) {
55  severityLimits[k] = -1; // JvR 99-06-10
56  severityIntervals[k] = -1;
57  severityTimespans[k] = -1;
58  }
59 
60 } // ELlimitsTable()
int severityTimespans[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:97
int severityLimits[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:96
int severityIntervals[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:98
edm::service::ELlimitsTable::~ELlimitsTable ( )

Definition at line 63 of file ELlimitsTable.cc.

References ecal_dqm_sourceclient-live_cfg::cerr.

63  {
64 
65 #ifdef ELlimitsTableCONSTRUCTOR_TRACE
66  std::cerr << "Destructor for ELlimitsTable\n";
67 #endif
68 
69 } // ~ELlimitsTable()

Member Function Documentation

bool edm::service::ELlimitsTable::add ( const ELextendedID xid)

Definition at line 79 of file ELlimitsTable.cc.

References EnergyCorrector::c, ecal_dqm_sourceclient-live_cfg::cerr, counts, edm::ELseverityLevel::getLevel(), edm::ELextendedID::id, cmsLHEtoEOSManager::l, limits, edm::ELextendedID::severity, severityIntervals, severityLimits, severityTimespans, tableLimit, wildcardInterval, wildcardLimit, and wildcardTimespan.

Referenced by edm::service::ELoutput::log(), and counter.Counter::register().

79  {
80 
81 #ifdef ELlimitsTableATRACE
82  std::cerr << "&&&--- adding to limits table: " << xid.id << '\n';
83 #endif
84 
85  ELmap_counts::iterator c = counts.find( xid );
86 
87  if ( c == counts.end() ) { // no such entry yet
88 
89  #ifdef ELlimitsTableATRACE
90  std::cerr << "&&& no such entry yet in counts \n";
91  #endif
92 
93  // if the counts table is "full", then this will never be rejected
94  // and info will not be kept so why go through significant work:
95  if ( tableLimit > 0 && static_cast<int>(counts.size()) >= tableLimit ) {
96  return true;
97  }
98  int lim;
99  int ivl;
100  int ts;
101  ELmap_limits::iterator l = limits.find( xid.id );
102 
103  if ( l != limits.end() ) { // use limits previously established for this id
104  lim = (*l).second.limit;
105  ivl = (*l).second.interval;
106  ts = (*l).second.timespan;
107  if ( lim < 0 ) { // jvr 6/17/99
108  lim = severityLimits[xid.severity.getLevel()];
109  if ( lim < 0 ) {
110  lim = wildcardLimit;
111  }
112  }
113  if ( ivl < 0 ) {
114  ivl = severityIntervals[xid.severity.getLevel()];
115  if ( ivl < 0 ) {
116  ivl = wildcardInterval; // mf 11/02/07
117  }
118  }
119  if ( ts < 0 ) {
120  ts = severityTimespans[xid.severity.getLevel()];
121  if (ts < 0 ) {
122  ts = wildcardTimespan;
123  }
124  limits[xid.id] = LimitAndTimespan( lim, ts );
125  }
126  #ifdef ELlimitsTableATRACE
127  std::cerr << "&&& Entry found in limits: limit = " << lim
128  << " interval = " << ivl
129  << " timespan = " << ts << '\n';
130  #endif
131  // change log 9/29/10: Do not put this into limits table
132  } else { // establish and use limits new to this id
133  lim = severityLimits [xid.severity.getLevel()];
134  ivl = severityIntervals[xid.severity.getLevel()];
135  ts = severityTimespans[xid.severity.getLevel()];
136  #ifdef ELlimitsTableATRACE
137  std::cerr << "&&& Limit taken from severityLimits: " << lim << '\n'
138  << "&&& Interval taken from severityLimits: " << ivl << '\n';
139  #endif
140  if ( lim < 0 ) {
141  lim = wildcardLimit;
142  #ifdef ELlimitsTableATRACE
143  std::cerr << "&&& Limit reset to wildcard limit: " << lim << '\n';
144  #endif
145  }
146  if ( ivl < 0 ) {
147  ivl = wildcardInterval;
148  #ifdef ELlimitsTableATRACE
149  std::cerr << "&&& Interval reset to wildcard interval: " << ivl << '\n';
150  #endif
151  }
152  #ifdef ELlimitsTableATRACE
153  std::cerr << "&&& Timespan taken from severityTimespans: " << ts << '\n';
154  #endif
155  if ( ts < 0 ) {
156  ts = wildcardTimespan;
157  #ifdef ELlimitsTableATRACE
158  std::cerr << "&&& timespan reset to wildcard timespan: " << ts << '\n';
159  #endif
160  }
161 
162  // change log 9/29/10 DO not save id's future limits:
163  }
164 
165  // save, if possible, this xid's initial entry:
166  if ( tableLimit < 0 || static_cast<int>(counts.size()) < tableLimit )
167  counts[xid] = CountAndLimit( lim, ts, ivl );
168  c = counts.find( xid );
169  }
170 
171  return ( c == counts.end() )
172  ? true // no limit filtering can be applied
173  : (*c).second.add() // apply limit filtering
174  ;
175 
176 } // add()
int severityTimespans[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:97
int severityLimits[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:96
int severityIntervals[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:98
ELlimitsTable & edm::service::ELlimitsTable::operator= ( const ELlimitsTable t)

Definition at line 253 of file ELlimitsTable.cc.

References limits, edm::ELseverityLevel::nLevels, severityTimespans, wildcardLimit, and wildcardTimespan.

253  {
254 
255  if(this == &t) {
256  return *this; // self assignment
257  }
258  limits = t.limits; // The non-trivial operator= for a map!
259 
260  for ( int lev = 0; lev < ELseverityLevel::nLevels; ++lev ) {
261  severityTimespans[lev] = t.severityTimespans[lev];
262  severityTimespans[lev] = t.severityTimespans[lev];
263  }
264 
265  wildcardLimit = t.wildcardLimit;
266  wildcardTimespan = t.wildcardTimespan;
267 
268  return *this;
269 
270 } // operator=()
int severityTimespans[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:97
void edm::service::ELlimitsTable::setInterval ( const ELstring id,
int  interval 
)

Definition at line 227 of file ELlimitsTable.cc.

References MergeJob_cfg::interval, limits, and wildcardInterval.

227  {
228  if ( id[0] == '*' ) wildcardInterval = interval;
229  else limits[id].interval = interval;
230 }
tuple interval
Definition: MergeJob_cfg.py:20
void edm::service::ELlimitsTable::setInterval ( const ELseverityLevel sev,
int  interval 
)

Definition at line 233 of file ELlimitsTable.cc.

References edm::ELseverityLevel::getLevel(), MergeJob_cfg::interval, and severityIntervals.

233  {
234  severityIntervals[sev.getLevel()] = interval;
235 }
tuple interval
Definition: MergeJob_cfg.py:20
int severityIntervals[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:98
void edm::service::ELlimitsTable::setLimit ( const ELstring id,
int  n 
)

Definition at line 217 of file ELlimitsTable.cc.

References limits, gen::n, and wildcardLimit.

217  {
218  if ( id[0] == '*' ) wildcardLimit = n;
219  else limits[id].limit = n;
220 }
void edm::service::ELlimitsTable::setLimit ( const ELseverityLevel sev,
int  n 
)

Definition at line 223 of file ELlimitsTable.cc.

References edm::ELseverityLevel::getLevel(), gen::n, and severityLimits.

223  {
224  severityLimits[sev.getLevel()] = n;
225 }
int severityLimits[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:96
void edm::service::ELlimitsTable::setTableLimit ( int  n)

Definition at line 76 of file ELlimitsTable.cc.

References gen::n, and tableLimit.

Referenced by edm::service::ELdestination::setTableLimit().

void edm::service::ELlimitsTable::setTimespan ( const ELstring id,
int  n 
)

Definition at line 238 of file ELlimitsTable.cc.

References limits, gen::n, and wildcardTimespan.

238  {
239  if ( id[0] == '*' ) wildcardTimespan = n;
240  else limits[id].timespan = n;
241 }
void edm::service::ELlimitsTable::setTimespan ( const ELseverityLevel sev,
int  n 
)

Definition at line 244 of file ELlimitsTable.cc.

References edm::ELseverityLevel::getLevel(), gen::n, and severityTimespans.

244  {
245  severityTimespans[sev.getLevel()] = n;
246 }
int severityTimespans[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:97
void edm::service::ELlimitsTable::wipe ( )

Definition at line 183 of file ELlimitsTable.cc.

References counts, i, limits, edm::ELseverityLevel::nLevels, severityIntervals, severityLimits, severityTimespans, wildcardLimit, and wildcardTimespan.

Referenced by edm::service::ELdestination::wipe(), and edm::service::ELstatistics::wipe().

183  {
184  // This clears everything -- counts and aggregate counts for severity levels
185  // and for individual ID's, as well as any limits established, the limit
186  // for "*" all messages, and the collection of severity defaults. wipe()
187  // does not not affect thresholds.
188 
189  limits.erase( limits.begin(), limits.end() );
190  ELmap_counts::iterator i;
191  for ( i = counts.begin(); i != counts.end(); ++i ) {
192  (*i).second.limit = -1;
193  (*i).second.n = (*i).second.aggregateN = 0;
194  }
195 
196  wildcardLimit = -1;
197  wildcardTimespan = -1;
198  for ( int lev = 0; lev < ELseverityLevel::nLevels; ++lev ) {
199  severityLimits [lev] = -1;
200  severityIntervals[lev] = -1;
201  severityTimespans[lev] = -1;
202  }
203 
204 }
int i
Definition: DBlmapReader.cc:9
int severityTimespans[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:97
int severityLimits[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:96
int severityIntervals[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:98
void edm::service::ELlimitsTable::zero ( )

Definition at line 207 of file ELlimitsTable.cc.

References counts, and i.

Referenced by edm::service::ELstatistics::clearSummary(), edm::service::ELdestination::zero(), and edm::service::ELstatistics::zero().

207  {
208  // This clears counts but not aggregate counts for severity levels
209  // and for individual ID's.
210 
211  ELmap_counts::iterator i;
212  for ( i = counts.begin(); i != counts.end(); ++i )
213  (*i).second.n = 0;
214 }
int i
Definition: DBlmapReader.cc:9

Friends And Related Function Documentation

friend class ELdestination
friend

Definition at line 62 of file ELlimitsTable.h.

friend class ELoutput
friend

Definition at line 63 of file ELlimitsTable.h.

Member Data Documentation

ELmap_counts edm::service::ELlimitsTable::counts
protected

Definition at line 105 of file ELlimitsTable.h.

Referenced by add(), wipe(), and zero().

ELmap_limits edm::service::ELlimitsTable::limits
protected

Definition at line 104 of file ELlimitsTable.h.

Referenced by add(), operator=(), setInterval(), setLimit(), setTimespan(), and wipe().

int edm::service::ELlimitsTable::severityIntervals[ELseverityLevel::nLevels]
protected

Definition at line 98 of file ELlimitsTable.h.

Referenced by add(), ELlimitsTable(), setInterval(), and wipe().

int edm::service::ELlimitsTable::severityLimits[ELseverityLevel::nLevels]
protected

Definition at line 96 of file ELlimitsTable.h.

Referenced by add(), ELlimitsTable(), setLimit(), and wipe().

int edm::service::ELlimitsTable::severityTimespans[ELseverityLevel::nLevels]
protected

Definition at line 97 of file ELlimitsTable.h.

Referenced by add(), ELlimitsTable(), operator=(), setTimespan(), and wipe().

int edm::service::ELlimitsTable::tableLimit
protected

Definition at line 103 of file ELlimitsTable.h.

Referenced by add(), and setTableLimit().

int edm::service::ELlimitsTable::wildcardInterval
protected

Definition at line 100 of file ELlimitsTable.h.

Referenced by add(), and setInterval().

int edm::service::ELlimitsTable::wildcardLimit
protected

Definition at line 99 of file ELlimitsTable.h.

Referenced by add(), operator=(), setLimit(), and wipe().

int edm::service::ELlimitsTable::wildcardTimespan
protected

Definition at line 101 of file ELlimitsTable.h.

Referenced by add(), operator=(), setTimespan(), and wipe().