FWCore
MessageService
src
ELlimitsTable.cc
Go to the documentation of this file.
1
// ----------------------------------------------------------------------
2
//
3
// ELlimitsTable.cc
4
//
5
// History:
6
// 7/6/98 mf Created
7
// 6/10/99 jvr Corrected initialization for severityLimits and
8
// timespans to -1 instead of 0.
9
// 6/17/99 jvr setLimit(id,n) works w/ setTimespan(sev||"*",n)
10
// and setTimespan(id,n) w/ setLimit(sev||"*",n)
11
// 6/15/00 web using -> USING
12
// 11/01/01 web Fixed mixed-type comparisons
13
// 5/18/06 mf setInterval
14
// 11/2/07 mf add: Changed ivl = wildcardLimit to wildcardInterval.
15
// Probably moot and never reached, but a clear correction.
16
// 9/29/10 mf,ql Fix savanah bug 65284 where two messages of same
17
// category but different severity, if limits were not
18
// take from category, first severity sets the limit
19
// for both of those xid's.
20
//
21
// ----------------------------------------------------------------------
22
23
#include "
FWCore/MessageService/src/ELlimitsTable.h
"
24
25
// Posible traces
26
//#include <iostream>
27
//using std::cerr;
28
//#define ELlimitsTableCONSTRUCTOR_TRACE
29
//#define ELlimitsTableATRACE
30
31
namespace
edm
{
32
namespace
service
{
33
34
// ----------------------------------------------------------------------
35
// Constructor, destructor:
36
// ----------------------------------------------------------------------
37
38
ELlimitsTable::ELlimitsTable
()
39
: wildcardLimit(-1), wildcardInterval(-1), wildcardTimespan(-1), tableLimit(-1),
limits
(),
counts
() {
40
#ifdef ELlimitsTableCONSTRUCTOR_TRACE
41
std::cerr
<<
"Constructor for ELlimitsTable\n"
;
42
#endif
43
44
for
(
int
k
= 0;
k
<
messagelogger::ELseverityLevel::nLevels
; ++
k
) {
45
severityLimits
[
k
] = -1;
// JvR 99-06-10
46
severityIntervals
[
k
] = -1;
47
severityTimespans
[
k
] = -1;
48
}
49
50
}
// ELlimitsTable()
51
52
ELlimitsTable::~ELlimitsTable
() {
53
#ifdef ELlimitsTableCONSTRUCTOR_TRACE
54
std::cerr
<<
"Destructor for ELlimitsTable\n"
;
55
#endif
56
57
}
// ~ELlimitsTable()
58
59
// ----------------------------------------------------------------------
60
// Methods invoked by the logger:
61
// ----------------------------------------------------------------------
62
63
void
ELlimitsTable::setTableLimit
(
int
n
) {
tableLimit
=
n
; }
64
65
bool
ELlimitsTable::add
(
const
ELextendedID
& xid) {
66
#ifdef ELlimitsTableATRACE
67
std::cerr
<<
"&&&--- adding to limits table: "
<< xid.
id
<<
'\n'
;
68
#endif
69
70
ELmap_counts::iterator
c
=
counts
.find(xid);
71
72
if
(
c
==
counts
.end()) {
// no such entry yet
73
74
#ifdef ELlimitsTableATRACE
75
std::cerr
<<
"&&& no such entry yet in counts \n"
;
76
#endif
77
78
// if the counts table is "full", then this will never be rejected
79
// and info will not be kept so why go through significant work:
80
if
(
tableLimit
> 0 && static_cast<int>(
counts
.size()) >=
tableLimit
) {
81
return
true
;
82
}
83
int
lim;
84
int
ivl;
85
int
ts;
86
ELmap_limits::iterator
l
=
limits
.find(xid.
id
);
87
88
if
(
l
!=
limits
.end()) {
// use limits previously established for this id
89
lim = (*l).second.limit;
90
ivl = (*l).second.interval;
91
ts = (*l).second.timespan;
92
if
(lim < 0) {
// jvr 6/17/99
93
lim =
severityLimits
[xid.
severity
.
getLevel
()];
94
if
(lim < 0) {
95
lim =
wildcardLimit
;
96
}
97
}
98
if
(ivl < 0) {
99
ivl =
severityIntervals
[xid.
severity
.
getLevel
()];
100
if
(ivl < 0) {
101
ivl =
wildcardInterval
;
// mf 11/02/07
102
}
103
}
104
if
(ts < 0) {
105
ts =
severityTimespans
[xid.
severity
.
getLevel
()];
106
if
(ts < 0) {
107
ts =
wildcardTimespan
;
108
}
109
limits
[xid.
id
] =
LimitAndTimespan
(lim, ts);
110
}
111
#ifdef ELlimitsTableATRACE
112
std::cerr
<<
"&&& Entry found in limits: limit = "
<< lim <<
" interval = "
<< ivl <<
" timespan = "
<< ts
113
<<
'\n'
;
114
#endif
115
// change log 9/29/10: Do not put this into limits table
116
}
else
{
// establish and use limits new to this id
117
lim =
severityLimits
[xid.
severity
.
getLevel
()];
118
ivl =
severityIntervals
[xid.
severity
.
getLevel
()];
119
ts =
severityTimespans
[xid.
severity
.
getLevel
()];
120
#ifdef ELlimitsTableATRACE
121
std::cerr
<<
"&&& Limit taken from severityLimits: "
<< lim <<
'\n'
122
<<
"&&& Interval taken from severityLimits: "
<< ivl <<
'\n'
;
123
#endif
124
if
(lim < 0) {
125
lim =
wildcardLimit
;
126
#ifdef ELlimitsTableATRACE
127
std::cerr
<<
"&&& Limit reset to wildcard limit: "
<< lim <<
'\n'
;
128
#endif
129
}
130
if
(ivl < 0) {
131
ivl =
wildcardInterval
;
132
#ifdef ELlimitsTableATRACE
133
std::cerr
<<
"&&& Interval reset to wildcard interval: "
<< ivl <<
'\n'
;
134
#endif
135
}
136
#ifdef ELlimitsTableATRACE
137
std::cerr
<<
"&&& Timespan taken from severityTimespans: "
<< ts <<
'\n'
;
138
#endif
139
if
(ts < 0) {
140
ts =
wildcardTimespan
;
141
#ifdef ELlimitsTableATRACE
142
std::cerr
<<
"&&& timespan reset to wildcard timespan: "
<< ts <<
'\n'
;
143
#endif
144
}
145
146
// change log 9/29/10 DO not save id's future limits:
147
}
148
149
// save, if possible, this xid's initial entry:
150
if
(
tableLimit
< 0 || static_cast<int>(
counts
.size()) <
tableLimit
)
151
counts
[xid] =
CountAndLimit
(lim, ts, ivl);
152
c
=
counts
.find(xid);
153
}
154
155
return
(
c
==
counts
.end()) ?
true
// no limit filtering can be applied
156
: (*c).second.add()
// apply limit filtering
157
;
158
159
}
// add()
160
161
// ----------------------------------------------------------------------
162
// Control methods invoked by the framework:
163
// ----------------------------------------------------------------------
164
165
void
ELlimitsTable::wipe
() {
166
// This clears everything -- counts and aggregate counts for severity levels
167
// and for individual ID's, as well as any limits established, the limit
168
// for "*" all messages, and the collection of severity defaults. wipe()
169
// does not not affect thresholds.
170
171
limits
.erase(
limits
.begin(),
limits
.end());
172
ELmap_counts::iterator
i
;
173
for
(
i
=
counts
.begin();
i
!=
counts
.end(); ++
i
) {
174
(*i).second.limit = -1;
175
(*i).second.n = (*i).second.aggregateN = 0;
176
}
177
178
wildcardLimit
= -1;
179
wildcardTimespan
= -1;
180
for
(
int
lev = 0; lev <
messagelogger::ELseverityLevel::nLevels
; ++lev) {
181
severityLimits
[lev] = -1;
182
severityIntervals
[lev] = -1;
183
severityTimespans
[lev] = -1;
184
}
185
}
186
187
void
ELlimitsTable::zero
() {
188
// This clears counts but not aggregate counts for severity levels
189
// and for individual ID's.
190
191
ELmap_counts::iterator
i
;
192
for
(
i
=
counts
.begin();
i
!=
counts
.end(); ++
i
)
193
(*i).second.n = 0;
194
}
195
196
void
ELlimitsTable::setLimit
(
const
std::string
&
id
,
int
n
) {
197
if
(
id
[0] ==
'*'
)
198
wildcardLimit
=
n
;
199
else
200
limits
[
id
].limit =
n
;
201
}
202
203
void
ELlimitsTable::setLimit
(
const
messagelogger::ELseverityLevel
& sev,
int
n
) {
204
severityLimits
[sev.
getLevel
()] =
n
;
205
}
206
207
void
ELlimitsTable::setInterval
(
const
std::string
&
id
,
int
interval
) {
208
if
(
id
[0] ==
'*'
)
209
wildcardInterval
=
interval
;
210
else
211
limits
[
id
].interval =
interval
;
212
}
213
214
void
ELlimitsTable::setInterval
(
const
messagelogger::ELseverityLevel
& sev,
int
interval
) {
215
severityIntervals
[sev.
getLevel
()] =
interval
;
216
}
217
218
void
ELlimitsTable::setTimespan
(
const
std::string
&
id
,
int
n
) {
219
if
(
id
[0] ==
'*'
)
220
wildcardTimespan
=
n
;
221
else
222
limits
[
id
].timespan =
n
;
223
}
224
225
void
ELlimitsTable::setTimespan
(
const
messagelogger::ELseverityLevel
& sev,
int
n
) {
226
severityTimespans
[sev.
getLevel
()] =
n
;
227
}
228
229
// ----------------------------------------------------------------------
230
// Support for internal operations:
231
// ----------------------------------------------------------------------
232
233
ELlimitsTable
&
ELlimitsTable::operator=
(
const
ELlimitsTable
&
t
) {
234
if
(
this
== &
t
) {
235
return
*
this
;
// self assignment
236
}
237
limits
=
t
.limits;
// The non-trivial operator= for a map!
238
239
for
(
int
lev = 0; lev <
messagelogger::ELseverityLevel::nLevels
; ++lev) {
240
severityTimespans
[lev] =
t
.severityTimespans[lev];
241
severityTimespans
[lev] =
t
.severityTimespans[lev];
242
}
243
244
wildcardLimit
=
t
.wildcardLimit;
245
wildcardTimespan
=
t
.wildcardTimespan;
246
247
return
*
this
;
248
249
}
// operator=()
250
251
// ----------------------------------------------------------------------
252
253
}
// end of namespace service
254
}
// end of namespace edm
service
Definition:
service.py:1
mps_fire.i
i
Definition:
mps_fire.py:428
dqmiodumpmetadata.n
n
Definition:
dqmiodumpmetadata.py:28
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::service::ELlimitsTable::setTimespan
void setTimespan(const std::string &id, int n)
Definition:
ELlimitsTable.cc:218
edm::service::ELlimitsTable::operator=
ELlimitsTable & operator=(const ELlimitsTable &t)
Definition:
ELlimitsTable.cc:233
edm::ELextendedID
Definition:
ELextendedID.h:25
edm::service::ELlimitsTable::severityIntervals
int severityIntervals[messagelogger::ELseverityLevel::nLevels]
Definition:
ELlimitsTable.h:91
edm::service::ELlimitsTable::wipe
void wipe()
Definition:
ELlimitsTable.cc:165
edm::messagelogger::ELseverityLevel::getLevel
constexpr int getLevel() const noexcept
Definition:
ELseverityLevel.h:60
edm::service::ELlimitsTable::severityLimits
int severityLimits[messagelogger::ELseverityLevel::nLevels]
Definition:
ELlimitsTable.h:89
edm::service::ELlimitsTable::wildcardTimespan
int wildcardTimespan
Definition:
ELlimitsTable.h:94
edm::LimitAndTimespan
Definition:
ELmap.h:43
edm::ELextendedID::severity
messagelogger::ELseverityLevel severity
Definition:
ELextendedID.h:30
edm::service::ELlimitsTable::~ELlimitsTable
~ELlimitsTable()
Definition:
ELlimitsTable.cc:52
edm::service::ELlimitsTable
Definition:
ELlimitsTable.h:57
edm::messagelogger::ELseverityLevel::nLevels
Definition:
ELseverityLevel.h:43
ELlimitsTable.h
dqmdumpme.k
k
Definition:
dqmdumpme.py:60
edm::CountAndLimit
Definition:
ELmap.h:53
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::service::ELlimitsTable::setInterval
void setInterval(const std::string &id, int interval)
Definition:
ELlimitsTable.cc:207
edm::service::ELlimitsTable::add
bool add(const ELextendedID &xid)
Definition:
ELlimitsTable.cc:65
edm::service::ELlimitsTable::setTableLimit
void setTableLimit(int n)
Definition:
ELlimitsTable.cc:63
edm::service::ELlimitsTable::limits
ELmap_limits limits
Definition:
ELlimitsTable.h:97
edm::service::ELlimitsTable::wildcardInterval
int wildcardInterval
Definition:
ELlimitsTable.h:93
readEcalDQMStatus.interval
interval
Definition:
readEcalDQMStatus.py:18
edm::service::ELlimitsTable::tableLimit
int tableLimit
Definition:
ELlimitsTable.h:96
cmsLHEtoEOSManager.l
l
Definition:
cmsLHEtoEOSManager.py:204
edm::service::ELlimitsTable::wildcardLimit
int wildcardLimit
Definition:
ELlimitsTable.h:92
TH2PolyOfflineMaps.limits
limits
Definition:
TH2PolyOfflineMaps.py:45
edm::ELextendedID::id
std::string id
Definition:
ELextendedID.h:29
edm::service::ELlimitsTable::zero
void zero()
Definition:
ELlimitsTable.cc:187
triggerObjects_cff.id
id
Definition:
triggerObjects_cff.py:29
edm::service::ELlimitsTable::setLimit
void setLimit(const std::string &id, int n)
Definition:
ELlimitsTable.cc:196
dqmiodumpmetadata.counts
counts
Definition:
dqmiodumpmetadata.py:25
edm::messagelogger::ELseverityLevel
Definition:
ELseverityLevel.h:26
edm::service::ELlimitsTable::counts
ELmap_counts counts
Definition:
ELlimitsTable.h:98
edm::service::ELlimitsTable::severityTimespans
int severityTimespans[messagelogger::ELseverityLevel::nLevels]
Definition:
ELlimitsTable.h:90
c
auto & c
Definition:
CAHitNtupletGeneratorKernelsImpl.h:46
submitPVValidationJobs.t
string t
Definition:
submitPVValidationJobs.py:644
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition:
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
edm::service::ELlimitsTable::ELlimitsTable
ELlimitsTable()
Definition:
ELlimitsTable.cc:38
Generated for CMSSW Reference Manual by
1.8.16