- void inline static increment(std::unordered_map<std::string, std::atomic<int>> &map, const std::string &key) {
- auto found = map.find(key);
- if (found != map.end()) { //inc
- map[key].fetch_add(1, std::memory_order_release);
- } else { //add
- //sentMessages.emplace(std::make_pair(std::string(key), std::atomic<int>(0)));
- map.emplace(std::piecewise_construct,
- std::forward_as_tuple(key),
- std::forward_as_tuple(0));
+ void increment(tbb::concurrent_unordered_map<std::string, int> &map, const std::string &key);
+
+};
+
+void StatCollector::increment(tbb::concurrent_unordered_map<std::string, int> &map, const std::string &key) {
+ if (mdclog_level_get() >= MDCLOG_DEBUG) {
+ mdclog_write(MDCLOG_INFO, "in file %s at finction %s in line %d", __FILE__, __func__, __LINE__);
+ }
+ if (map.empty()) {
+ if (mdclog_level_get() >= MDCLOG_DEBUG) {
+ mdclog_write(MDCLOG_INFO, "in file %s at finction %s in line %d", __FILE__, __func__, __LINE__);
+ }
+ map.emplace(std::piecewise_construct,
+ std::forward_as_tuple(key),
+ std::forward_as_tuple(1));
+ if (mdclog_level_get() >= MDCLOG_DEBUG) {
+ mdclog_write(MDCLOG_INFO, "in file %s at finction %s in line %d", __FILE__, __func__, __LINE__);
+ }
+ return;
+ }
+ if (mdclog_level_get() >= MDCLOG_DEBUG) {
+ mdclog_write(MDCLOG_INFO, "in file %s at finction %s in line %d", __FILE__, __func__, __LINE__);
+ }
+ auto found = map.find(key);
+ if (mdclog_level_get() >= MDCLOG_DEBUG) {
+ mdclog_write(MDCLOG_INFO, "in file %s at finction %s in line %d", __FILE__, __func__, __LINE__);
+ }
+ if (found != map.end()) { //inc
+ if (mdclog_level_get() >= MDCLOG_DEBUG) {
+ mdclog_write(MDCLOG_INFO, "in file %s at finction %s in line %d", __FILE__, __func__, __LINE__);
+ }
+ map[key]++;
+ } else { //add
+ //sentMessages.emplace(std::make_pair(std::string(key), std::atomic<int>(0)));
+ if (mdclog_level_get() >= MDCLOG_DEBUG) {
+ mdclog_write(MDCLOG_INFO, "in file %s at finction %s in line %d", __FILE__, __func__, __LINE__);