summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/InstrumentationI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice/InstrumentationI.cpp')
-rw-r--r--cpp/src/Ice/InstrumentationI.cpp87
1 files changed, 26 insertions, 61 deletions
diff --git a/cpp/src/Ice/InstrumentationI.cpp b/cpp/src/Ice/InstrumentationI.cpp
index 718d132f053..a5121ff7e23 100644
--- a/cpp/src/Ice/InstrumentationI.cpp
+++ b/cpp/src/Ice/InstrumentationI.cpp
@@ -26,45 +26,6 @@ namespace
Context emptyCtx;
-int ConnectionMetrics::*
-getConnectionStateMetric(ConnectionState s)
-{
- switch(s)
- {
- case ConnectionStateValidating:
- return &ConnectionMetrics::validating;
- case ConnectionStateActive:
- return &ConnectionMetrics::active;
- case ConnectionStateHolding:
- return &ConnectionMetrics::holding;
- case ConnectionStateClosing:
- return &ConnectionMetrics::closing;
- case ConnectionStateClosed:
- return &ConnectionMetrics::closed;
- default:
- assert(false);
- return 0;
- }
-}
-
-struct ConnectionStateChanged
-{
- ConnectionStateChanged(ConnectionState oldState, ConnectionState newState) :
- oldState(oldState), newState(newState)
- {
- }
-
- void operator()(const ConnectionMetricsPtr& v)
- {
- --(v.get()->*getConnectionStateMetric(oldState));
- ++(v.get()->*getConnectionStateMetric(newState));
- }
-
-
- ConnectionState oldState;
- ConnectionState newState;
-};
-
int ThreadMetrics::*
getThreadStateMetric(ThreadState s)
{
@@ -152,6 +113,7 @@ public:
add("parent", &ConnectionHelper::getParent);
add("id", &ConnectionHelper::getId);
add("endpoint", &ConnectionHelper::getEndpoint);
+ add("state", &ConnectionHelper::getState);
addConnectionAttributes<ConnectionHelper>(*this);
}
};
@@ -167,11 +129,6 @@ public:
return attributes(this, attribute);
}
- virtual void initMetrics(const ConnectionMetricsPtr& v) const
- {
- ++(v.get()->*getConnectionStateMetric(_state));
- }
-
const string&
getId() const
{
@@ -197,6 +154,27 @@ public:
}
return _id;
}
+
+ string
+ getState() const
+ {
+ switch(_state)
+ {
+ case ConnectionStateValidating:
+ return "validating";
+ case ConnectionStateHolding:
+ return "holding";
+ case ConnectionStateActive:
+ return "active";
+ case ConnectionStateClosing:
+ return "closing";
+ case ConnectionStateClosed:
+ return "closed";
+ default:
+ assert(false);
+ return "";
+ }
+ }
string
getParent() const
@@ -291,7 +269,7 @@ public:
return p->second;
}
}
- return "unknown";
+ throw invalid_argument(attribute);
}
string
@@ -411,7 +389,7 @@ public:
return p->second;
}
}
- return "unknown";
+ throw invalid_argument(attribute);
}
virtual string operator()(const string& attribute) const
@@ -424,7 +402,7 @@ public:
{
if(!_proxy)
{
- return "unknown";
+ throw invalid_argument("mode");
}
if(_proxy->ice_isTwoway())
@@ -449,7 +427,7 @@ public:
}
else
{
- return "unknown";
+ throw invalid_argument("mode");
}
}
@@ -725,19 +703,6 @@ EndpointHelper::Attributes EndpointHelper::attributes;
}
-void
-ConnectionObserverI::detach()
-{
- ObserverT<ConnectionMetrics>::detach();
- forEach(dec(&ConnectionMetrics::closed));
-}
-
-void
-ConnectionObserverI::stateChanged(ConnectionState oldState, ConnectionState newState)
-{
- forEach(ConnectionStateChanged(oldState, newState));
-}
-
void
ConnectionObserverI::sentBytes(Int num)
{