From: aa7133@att.com Date: Thu, 2 Apr 2020 07:20:52 +0000 (+0300) Subject: version 4.0.7 X-Git-Tag: 5.4.8~61 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=30c28908aa639c3d9fc7082a7193d597dedf8bb9;p=ric-plt%2Fe2.git version 4.0.7 Patch on stat and remove tbb set logging flag to debug Change-Id: I3f4f56ce8d3de19e94e706f15758501ebc7cacaf Signed-off-by: aa7133@att.com --- diff --git a/RIC-E2-TERMINATION/config/config.conf b/RIC-E2-TERMINATION/config/config.conf index 6b57be1..2bfe8b1 100644 --- a/RIC-E2-TERMINATION/config/config.conf +++ b/RIC-E2-TERMINATION/config/config.conf @@ -1,5 +1,5 @@ nano=38000 -loglevel=info +loglevel=debug volume=log #the key name of the environment holds the local ip address local-ip=127.0.0.1 diff --git a/RIC-E2-TERMINATION/statCollector.h b/RIC-E2-TERMINATION/statCollector.h index 706426d..3279585 100644 --- a/RIC-E2-TERMINATION/statCollector.h +++ b/RIC-E2-TERMINATION/statCollector.h @@ -33,9 +33,9 @@ #include #include #include -#include +//#include -using namespace tbb; +//using namespace tbb; typedef struct statResult { std::string ranName; @@ -75,10 +75,10 @@ public: for (auto const &e : recvMessages) { statResult_t result {}; result.ranName = e.first; - result.receivedMessages = e.second; + result.receivedMessages = e.second.load(std::memory_order_acquire); auto found = sentMessages.find(result.ranName); if (found != sentMessages.end()) { - result.sentMessages = found->second; + result.sentMessages = found->second.load(std::memory_order_acquire); } else { result.sentMessages = 0; } @@ -92,10 +92,10 @@ public: StatCollector& operator=(const StatCollector&)= delete; private: - tbb::concurrent_unordered_map sentMessages; - //std::unordered_map sentMessages; - //std::unordered_map recvMessages; - tbb::concurrent_unordered_map recvMessages; + //tbb::concurrent_unordered_map sentMessages; + std::unordered_map> sentMessages; + std::unordered_map> recvMessages; +// tbb::concurrent_unordered_map recvMessages; std::vector results; @@ -107,50 +107,26 @@ private: ~StatCollector() = default; - void increment(tbb::concurrent_unordered_map &map, const std::string &key); + void increment(std::unordered_map> &map, const std::string &key); }; -void StatCollector::increment(tbb::concurrent_unordered_map &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__); - } +void StatCollector::increment(std::unordered_map> &map, const std::string &key) { 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]++; + map[key].fetch_add(1, std::memory_order_release); + //map[key]++; } else { //add //sentMessages.emplace(std::make_pair(std::string(key), std::atomic(0))); - 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__); - } } }