X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=source%2Fdiameter.comm%2FApplicationMessageOamModule.cpp;h=8f3dfa0fb8c28915eeac295354a7fd9ff796f854;hb=4275d46f5d3c3a150ced258ae20c985520f6477a;hp=d167d716cb6978d0dcf9462f181c8ff0dc2d9c93;hpb=30def5757c5b3411f77fff62a163241ecc616337;p=anna.git diff --git a/source/diameter.comm/ApplicationMessageOamModule.cpp b/source/diameter.comm/ApplicationMessageOamModule.cpp index d167d71..8f3dfa0 100644 --- a/source/diameter.comm/ApplicationMessageOamModule.cpp +++ b/source/diameter.comm/ApplicationMessageOamModule.cpp @@ -36,7 +36,7 @@ anna_assign_enum(anna::diameter::comm::ApplicationMessageOamModule::Counter) = { NULL /* list end indicator */ }; -void anna::diameter::comm::ApplicationMessageOamModule::createStackCounterScope(int scopeId, unsigned int stackId) throw(anna::RuntimeException) { +void anna::diameter::comm::ApplicationMessageOamModule::createStackCounterScope(int scopeId, unsigned int stackId) noexcept(false) { initializeCounterScope(scopeId, anna::functions::asString("Application Message Events for stack id %lu", stackId)); @@ -47,7 +47,7 @@ void anna::diameter::comm::ApplicationMessageOamModule::createStackCounterScope( a_stackMap[stackId] = scopeId; } -void anna::diameter::comm::ApplicationMessageOamModule::count (int messageCode, int resultCode, unsigned int stackId, const int & type, const int & amount) throw(anna::RuntimeException) { +void anna::diameter::comm::ApplicationMessageOamModule::count (int messageCode, int resultCode, unsigned int stackId, const int & type, const int & amount) noexcept(false) { // Optimization: // Checkings @@ -80,10 +80,10 @@ void anna::diameter::comm::ApplicationMessageOamModule::count (int messageCode, setActiveCounterScope(scopeId); // Build event id: _ - std::string eventId = anna::functions::asString("%d%d", messageCode, resultCode); + std::string eventId = anna::functions::asString("%d_%d", messageCode, resultCode); std::map::const_iterator eventMap_it = a_eventMap.find(eventId); - int baseOffset = eventMap_it->second; + int baseOffset; if (eventMap_it == a_eventMap.end()) { int capacity = anna::oam::CounterScope::MaxCounter / getCounterTypes(); @@ -91,7 +91,7 @@ void anna::diameter::comm::ApplicationMessageOamModule::count (int messageCode, LOGDEBUG(anna::Logger::debug(anna::functions::asString("No more holes to register new application message counters in the scope (up to %d message codes)", capacity), ANNA_FILE_LOCATION)); return; } - baseOffset = getCounterTypes() * a_eventMap.size(); // N counter types for each message code + baseOffset = getCounterTypes() * a_eventMap.size(); // N counter types for each message code / rc a_eventMap[eventId] = baseOffset; // Counter name: @@ -116,13 +116,22 @@ void anna::diameter::comm::ApplicationMessageOamModule::count (int messageCode, if (counterNamePrefix[counterNamePrefix.size() - 1] != '-') counterNamePrefix += "-"; std::string counterName; - // register only count event: - //for (int offset = 0; offset < getCounterTypes(); offset++) { - int offset = baseOffset + type; + /* + for (int offset = 0; offset < getCounterTypes(); offset++) { counterName = counterNamePrefix + getDefaultInternalCounterDescription(offset); if (resultCode != -1) counterName += anna::functions::asString("-ResultCode_%d", resultCode); registerCounter(baseOffset + offset, counterName, baseOffset + offset); - //} + } + */ + // Register only affected one: + int offset = baseOffset + type; + counterName = counterNamePrefix + getDefaultInternalCounterDescription(type); + if (resultCode != -1) counterName += anna::functions::asString("-ResultCode_%d", resultCode); + registerCounter(offset, counterName, offset); + + } + else { + baseOffset = eventMap_it->second; } // Count