14 #include "tbb/concurrent_unordered_map.h" 35 struct ErrorSummaryMapKey {
40 bool operator<(ErrorSummaryMapKey
const& iOther)
const {
41 int comp = severity.
getLevel() - iOther.severity.getLevel();
43 comp = category.compare(iOther.category);
45 comp = module.compare(iOther.module);
51 bool operator==(ErrorSummaryMapKey
const& iOther)
const {
52 return ((iOther.category == category) and (iOther.module == module) and
53 (severity.
getLevel() == iOther.severity.getLevel()));
55 size_t smallHash()
const {
56 std::hash<std::string>
h;
58 return h(category + module + severity.
getSymbol());
62 std::size_t operator()(ErrorSummaryMapKey
const& iKey)
const {
return iKey.smallHash(); }
66 class AtomicUnsignedInt {
68 AtomicUnsignedInt() : value_(0) {}
69 AtomicUnsignedInt(AtomicUnsignedInt
const&
r) : value_(r.value_.load(std::memory_order_acquire)) {}
70 std::atomic<unsigned int>&
value() {
return value_; }
71 std::atomic<unsigned int>
const&
value()
const {
return value_; }
74 std::atomic<unsigned int> value_;
82 tbb::concurrent_unordered_map<ErrorSummaryMapKey, AtomicUnsignedInt, ErrorSummaryMapKey::key_hash>>
94 if (errorObjPtr ==
nullptr) {
112 std::cerr <<
"MessageSender::~MessageSender() - Null drop pointer \n";
121 auto i = errorSummaryMap.find(
key);
122 if (
i != errorSummaryMap.end()) {
123 i->second.value().fetch_add(1, std::memory_order_acq_rel);
125 errorSummaryMap[
key].value().store(1, std::memory_order_release);
167 std::vector<ErrorSummaryEntry>
v;
168 auto end = errorSummaryMap.end();
169 for (
auto i = errorSummaryMap.begin();
i !=
end; ++
i) {
170 auto const&
key =
i->first;
173 e.count =
i->second.value().load(std::memory_order_acquire);
188 std::vector<ErrorSummaryEntry>
v;
191 auto end = errorSummaryMap.end();
192 for (
auto i = errorSummaryMap.begin();
i !=
end; ++
i) {
193 auto const&
key =
i->first;
196 e.count =
i->second.value().load(std::memory_order_acquire);
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
static std::vector< tbb::concurrent_unordered_map< ErrorSummaryMapKey, AtomicUnsignedInt, ErrorSummaryMapKey::key_hash > > errorSummaryMaps
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
bool EnableLoggedErrorsSummary()
static MessageDrop * instance()
void operator()(ErrorObj *errorObjPtr)
void clearLoggedErrorsSummary(unsigned int iStreamID)
void setMaxLoggedErrorsSummaryIndicies(unsigned int iMax)
ELslProxy< ELwarningGen > const ELwarning
bool FreshErrorsExist(unsigned int iStreamID)
bool DisableLoggedErrorsSummary()
virtual void setContext(const ELstring &context)
const ELstring getSymbol() const
const ELextendedID & xid() const
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
ELslProxy< ELerrorGen > const ELerror
std::string moduleContext()
std::vector< ErrorSummaryEntry > LoggedErrorsOnlySummary(unsigned int iStreamID)
static std::atomic< bool > errorSummaryIsBeingKept
static void MLqLOG(ErrorObj *p)
std::vector< ErrorSummaryEntry > LoggedErrorsSummary(unsigned int iStreamID)
virtual void setModule(const ELstring &module)