aboutsummaryrefslogtreecommitdiff
path: root/p2p/client
diff options
context:
space:
mode:
authorQingsi Wang <qingsi@google.com>2018-07-12 12:54:53 -0700
committerCommit Bot <commit-bot@chromium.org>2018-07-12 21:35:47 +0000
commit7fc821d42dcdd27494907df10884149373b21ade (patch)
tree100b50b07093e1ee0ac0a575fc9d7ecc7bec2871 /p2p/client
parentdb443acf77f32b8e491411b99a4519243d2f4bcd (diff)
downloadwebrtc-7fc821d42dcdd27494907df10884149373b21ade.tar.gz
Reland "Reland "Replace the usage of MetricsObserverInterface by RTC_HISTOGRAM_*.""
This is a reland of 1a2cc0acba6a66f89249455d8e5775849b56f755 Original change's description: > Reland "Replace the usage of MetricsObserverInterface by RTC_HISTOGRAM_*." > > This is a reland of 870bca1f418a1abf445169a638a61f9a649d557f > > Original change's description: > > Replace the usage of MetricsObserverInterface by RTC_HISTOGRAM_*. > > > > We now use RTC_HISTOGRAM_* macros in system_wrappers/include/metrics.h > > to report the metrics in pc/ and p2p/ that are currently been reported > > using MetricsObserverInterface. > > > > TBR=tommi@webrtc.org > > > > Bug: webrtc:9409 > > Change-Id: I47c9975402293c72250203fa1ec19eb1668766f6 > > Reviewed-on: https://webrtc-review.googlesource.com/83782 > > Commit-Queue: Qingsi Wang <qingsi@google.com> > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Reviewed-by: Taylor (left Google) <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#23914} > > TBR=steveanton@webrtc.org,hta@webrtc.org,tommi@webrtc.org > > Bug: webrtc:9409 > Change-Id: I37fc95ced60dea25aa9b4f5ad44bdf7174c8bd5c > Reviewed-on: https://webrtc-review.googlesource.com/88060 > Reviewed-by: Qingsi Wang <qingsi@webrtc.org> > Commit-Queue: Qingsi Wang <qingsi@google.com> > Cr-Commit-Position: refs/heads/master@{#23919} TBR=steveanton@webrtc.org,tommi@webrtc.org Bug: webrtc:9409 Change-Id: Ib55f0b6c9bcb9d9585924a4dfac5cf643ff4d76b Reviewed-on: https://webrtc-review.googlesource.com/88343 Commit-Queue: Qingsi Wang <qingsi@google.com> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23957}
Diffstat (limited to 'p2p/client')
-rw-r--r--p2p/client/basicportallocator.cc11
-rw-r--r--p2p/client/basicportallocator_unittest.cc19
2 files changed, 23 insertions, 7 deletions
diff --git a/p2p/client/basicportallocator.cc b/p2p/client/basicportallocator.cc
index 4335ddaad4..eb14a37758 100644
--- a/p2p/client/basicportallocator.cc
+++ b/p2p/client/basicportallocator.cc
@@ -16,7 +16,6 @@
#include <string>
#include <vector>
-#include "api/umametrics.h"
#include "p2p/base/basicpacketsocketfactory.h"
#include "p2p/base/port.h"
#include "p2p/base/relayport.h"
@@ -28,6 +27,7 @@
#include "rtc_base/helpers.h"
#include "rtc_base/ipaddress.h"
#include "rtc_base/logging.h"
+#include "system_wrappers/include/metrics.h"
using rtc::CreateRandomId;
@@ -196,9 +196,6 @@ void BasicPortAllocator::Construct() {
void BasicPortAllocator::OnIceRegathering(PortAllocatorSession* session,
IceRegatheringReason reason) {
- if (!metrics_observer()) {
- return;
- }
// If the session has not been taken by an active channel, do not report the
// metric.
for (auto& allocator_session : pooled_sessions()) {
@@ -207,9 +204,9 @@ void BasicPortAllocator::OnIceRegathering(PortAllocatorSession* session,
}
}
- metrics_observer()->IncrementEnumCounter(
- webrtc::kEnumCounterIceRegathering, static_cast<int>(reason),
- static_cast<int>(IceRegatheringReason::MAX_VALUE));
+ RTC_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.IceRegatheringReason",
+ static_cast<int>(reason),
+ static_cast<int>(IceRegatheringReason::MAX_VALUE));
}
BasicPortAllocator::~BasicPortAllocator() {
diff --git a/p2p/client/basicportallocator_unittest.cc b/p2p/client/basicportallocator_unittest.cc
index d995eb18de..b3e52ffec5 100644
--- a/p2p/client/basicportallocator_unittest.cc
+++ b/p2p/client/basicportallocator_unittest.cc
@@ -34,6 +34,7 @@
#include "rtc_base/ssladapter.h"
#include "rtc_base/thread.h"
#include "rtc_base/virtualsocketserver.h"
+#include "system_wrappers/include/metrics_default.h"
using rtc::IPAddress;
using rtc::SocketAddress;
@@ -168,6 +169,7 @@ class BasicPortAllocatorTestBase : public testing::Test,
kRelaySslTcpIntAddr));
allocator_->Initialize();
allocator_->set_step_delay(kMinimumStepDelay);
+ webrtc::metrics::Reset();
}
void AddInterface(const SocketAddress& addr) {
@@ -2368,4 +2370,21 @@ TEST_F(BasicPortAllocatorTest,
expected_stun_keepalive_interval);
}
+TEST_F(BasicPortAllocatorTest, IceRegatheringMetricsLoggedWhenNetworkChanges) {
+ // Only test local ports to simplify test.
+ ResetWithNoServersOrNat();
+ AddInterface(kClientAddr, "test_net0");
+ ASSERT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
+ session_->StartGettingPorts();
+ EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
+ kDefaultAllocationTimeout, fake_clock);
+ candidate_allocation_done_ = false;
+ AddInterface(kClientAddr2, "test_net1");
+ EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
+ kDefaultAllocationTimeout, fake_clock);
+ EXPECT_EQ(1, webrtc::metrics::NumEvents(
+ "WebRTC.PeerConnection.IceRegatheringReason",
+ static_cast<int>(IceRegatheringReason::NETWORK_CHANGE)));
+}
+
} // namespace cricket