13 #include "tbb/concurrent_unordered_map.h"
36 struct ErrorSummaryMapKey {
41 bool operator<(ErrorSummaryMapKey
const& iOther)
const {
42 int comp =severity.getLevel()-iOther.severity.getLevel();
44 comp =
category.compare(iOther.category);
46 comp =
module.compare(iOther.module);
52 bool operator==(ErrorSummaryMapKey
const& iOther)
const {
53 return ((0==
category.compare(iOther.category)) and
54 (0==
module.compare(iOther.module)) and
55 (severity.getLevel() ==iOther.severity.getLevel()));
57 size_t smallHash()
const {
58 std::hash<std::string>
h;
64 std::size_t operator()(ErrorSummaryMapKey
const& iKey)
const{
65 return iKey.smallHash();
70 class AtomicUnsignedInt {
72 AtomicUnsignedInt() : value_(0) {}
73 AtomicUnsignedInt(AtomicUnsignedInt
const&
r) : value_(r.value_.load(std::memory_order_acquire)) {}
74 std::atomic<unsigned int>&
value() {
return value_; }
75 std::atomic<unsigned int>
const&
value()
const {
return value_; }
77 std::atomic<unsigned int> value_;
84 [[cms::thread_safe]]
static std::vector<tbb::concurrent_unordered_map<ErrorSummaryMapKey, AtomicUnsignedInt,ErrorSummaryMapKey::key_hash>>
errorSummaryMaps;
88 bool verbatim,
bool suppressed )
99 if (errorObjPtr == 0) {
117 if (!drop)
std::cerr <<
"MessageSender::~MessageSender() - Null drop pointer \n";
128 auto i = errorSummaryMap.find(
key);
129 if (
i != errorSummaryMap.end()) {
130 i->second.value().fetch_add(1,std::memory_order_acq_rel);
132 errorSummaryMap[
key].value().store(1,std::memory_order_release);
178 std::vector<ErrorSummaryEntry>
v;
179 auto end = errorSummaryMap.end();
180 for (
auto i = errorSummaryMap.begin();
182 auto const&
key =
i->first;
185 e.count =
i->second.value().load(std::memory_order_acquire);
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);
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
const T & max(const T &a, const T &b)
ELslProxy< ELerrorGen > const ELerror
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &)
std::string moduleContext()
std::vector< ErrorSummaryEntry > LoggedErrorsOnlySummary(unsigned int iStreamID)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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)