Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: content/renderer/media/rtc_peer_connection_handler.cc

Issue 1274213006: Add instrumentation to track the IceCandidatePairType and IceConnectionState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/rtc_peer_connection_handler.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/rtc_peer_connection_handler.cc
diff --git a/content/renderer/media/rtc_peer_connection_handler.cc b/content/renderer/media/rtc_peer_connection_handler.cc
index 2de508789f2b1050a5f9e62ffef495cf89cd1de8..b5ce46b5a466b65283a4b8d49d3208a3bee45142 100644
--- a/content/renderer/media/rtc_peer_connection_handler.cc
+++ b/content/renderer/media/rtc_peer_connection_handler.cc
@@ -505,13 +505,26 @@ class PeerConnectionUMAObserver : public webrtc::UMAObserver {
public:
PeerConnectionUMAObserver() {}
~PeerConnectionUMAObserver() override {}
-
- void IncrementCounter(
- webrtc::PeerConnectionUMAMetricsCounter counter) override {
- // Runs on libjingle's signaling thread.
- UMA_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.IPMetrics",
- counter,
- webrtc::kBoundary);
+ void IncrementEnumCounter(webrtc::PeerConnectionEnumCounterType counter_type,
+ int counter,
+ int counter_max) override {
+ switch (counter_type) {
+ case webrtc::kEnumCounterAddressFamily:
+ UMA_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.IPMetrics", counter,
+ counter_max);
+ break;
+ case webrtc::kEnumCounterIceCandidatePairTypeUdp:
+ UMA_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.CandidatePairType_UDP",
+ counter, counter_max);
+ break;
+ case webrtc::kEnumCounterIceCandidatePairTypeTcp:
+ UMA_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.CandidatePairType_TCP",
+ counter, counter_max);
+ break;
+ case webrtc::kPeerConnectionEnumCounterMax:
+ NOTREACHED();
+ break;
+ }
}
void AddHistogramSample(webrtc::PeerConnectionUMAMetricsName type,
@@ -722,10 +735,6 @@ RTCPeerConnectionHandler::RTCPeerConnectionHandler(
PeerConnectionDependencyFactory* dependency_factory)
: client_(client),
dependency_factory_(dependency_factory),
- frame_(NULL),
- num_data_channels_created_(0),
- num_local_candidates_ipv4_(0),
- num_local_candidates_ipv6_(0),
weak_factory_(this) {
g_peer_connection_handlers.Get().insert(this);
}
@@ -1317,6 +1326,7 @@ void RTCPeerConnectionHandler::OnIceConnectionChange(
webrtc::PeerConnectionInterface::IceConnectionState new_state) {
TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::OnIceConnectionChange");
DCHECK(thread_checker_.CalledOnValidThread());
+ ReportICEState(new_state);
if (new_state == webrtc::PeerConnectionInterface::kIceConnectionChecking) {
ice_connection_checking_start_ = base::TimeTicks::Now();
} else if (new_state ==
@@ -1370,8 +1380,7 @@ void RTCPeerConnectionHandler::OnIceGatheringChange(
webrtc::PeerConnectionInterface::kIceGatheringGathering) {
// ICE restarts will change gathering state back to "gathering",
// reset the counter.
- num_local_candidates_ipv6_ = 0;
- num_local_candidates_ipv4_ = 0;
+ ResetUMAStats();
}
blink::WebRTCPeerConnectionHandlerClient::ICEGatheringState state =
@@ -1526,4 +1535,21 @@ void RTCPeerConnectionHandler::RunSynchronousClosureOnSignalingThread(
}
}
+void RTCPeerConnectionHandler::ReportICEState(
+ webrtc::PeerConnectionInterface::IceConnectionState new_state) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ if (ice_state_seen_[new_state])
+ return;
+ ice_state_seen_[new_state] = true;
+ UMA_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.ConnectionState", new_state,
+ webrtc::PeerConnectionInterface::kIceConnectionMax);
+}
+
+void RTCPeerConnectionHandler::ResetUMAStats() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ num_local_candidates_ipv6_ = 0;
+ num_local_candidates_ipv4_ = 0;
+ ice_connection_checking_start_ = base::TimeTicks();
+ memset(ice_state_seen_, 0, sizeof(ice_state_seen_));
+}
} // namespace content
« no previous file with comments | « content/renderer/media/rtc_peer_connection_handler.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698