14 #include "tbb/concurrent_unordered_map.h" 37 struct ErrorSummaryMapKey {
42 bool operator<(ErrorSummaryMapKey
const& iOther)
const {
43 int comp =severity.
getLevel()-iOther.severity.getLevel();
45 comp = category.compare(iOther.category);
47 comp = module.compare(iOther.module);
53 bool operator==(ErrorSummaryMapKey
const& iOther)
const {
54 return ((iOther.category==category) and
55 (iOther.module==module) and
56 (severity.
getLevel() ==iOther.severity.getLevel()));
58 size_t smallHash()
const {
59 std::hash<std::string>
h;
61 return h( category+module+severity.
getSymbol());
65 std::size_t operator()(ErrorSummaryMapKey
const& iKey)
const{
66 return iKey.smallHash();
71 class AtomicUnsignedInt {
73 AtomicUnsignedInt() : value_(0) {}
74 AtomicUnsignedInt(AtomicUnsignedInt
const&
r) : value_(r.value_.load(std::memory_order_acquire)) {}
75 std::atomic<unsigned int>&
value() {
return value_; }
76 std::atomic<unsigned int>
const&
value()
const {
return value_; }
78 std::atomic<unsigned int> value_;
85 [[cms::thread_safe]]
static std::vector<tbb::concurrent_unordered_map<ErrorSummaryMapKey, AtomicUnsignedInt,ErrorSummaryMapKey::key_hash>>
errorSummaryMaps;
89 bool verbatim,
bool suppressed )
100 if (errorObjPtr ==
nullptr) {
118 if (!drop)
std::cerr <<
"MessageSender::~MessageSender() - Null drop pointer \n";
129 auto i = errorSummaryMap.find(
key);
130 if (
i != errorSummaryMap.end()) {
131 i->second.value().fetch_add(1,std::memory_order_acq_rel);
133 errorSummaryMap[
key].value().store(1,std::memory_order_release);
179 std::vector<ErrorSummaryEntry>
v;
180 auto end = errorSummaryMap.end();
181 for (
auto i = errorSummaryMap.begin();
183 auto const&
key =
i->first;
186 e.count =
i->second.value().load(std::memory_order_acquire);
189 std::sort(v.begin(),v.end());
204 std::vector<ErrorSummaryEntry>
v;
207 auto end = errorSummaryMap.end();
208 for (
auto i = errorSummaryMap.begin();
210 auto const&
key =
i->first;
213 e.count =
i->second.value().load(std::memory_order_acquire);
217 std::sort(v.begin(),v.end());
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
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)
static std::vector< tbb::concurrent_unordered_map< ErrorSummaryMapKey, AtomicUnsignedInt, ErrorSummaryMapKey::key_hash > > errorSummaryMaps
virtual void setModule(const ELstring &module)