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 ((0==
category.compare(iOther.category)) and
55 (0==
module.compare(iOther.module)) and
56 (severity.getLevel() ==iOther.severity.getLevel()));
58 size_t smallHash()
const {
59 std::hash<std::string>
h;
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 == 0) {
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);
205 std::vector<ErrorSummaryEntry>
v;
208 auto end = errorSummaryMap.end();
209 for (
auto i = errorSummaryMap.begin();
211 auto const&
key =
i->first;
214 e.count =
i->second.value().load(std::memory_order_acquire);
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
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 ELextendedID & xid() const
ELslProxy< ELerrorGen > const ELerror
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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)