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();
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;
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);
176 std::sort(
v.begin(),
v.end());
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);
200 std::sort(
v.begin(),
v.end());