Add UMA Counts for number of IPv4 and IPv6 interfaces detected for PeerConnection.

R=sergeyu@chromium.org
BUG=N/A

Review URL: https://codereview.chromium.org/299103002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272371 0039d316-1c4b-4281-b951-d872f2087c98
parent 1156ebf8
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/metrics/histogram.h"
#include "base/sys_byteorder.h" #include "base/sys_byteorder.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "net/base/net_util.h" #include "net/base/net_util.h"
...@@ -75,6 +76,8 @@ void IpcNetworkManager::OnNetworkListChanged( ...@@ -75,6 +76,8 @@ void IpcNetworkManager::OnNetworkListChanged(
// talk_base::Network uses these prefix_length to compare network // talk_base::Network uses these prefix_length to compare network
// interfaces discovered. // interfaces discovered.
std::vector<talk_base::Network*> networks; std::vector<talk_base::Network*> networks;
int ipv4_interfaces = 0;
int ipv6_interfaces = 0;
for (net::NetworkInterfaceList::const_iterator it = list.begin(); for (net::NetworkInterfaceList::const_iterator it = list.begin();
it != list.end(); it++) { it != list.end(); it++) {
if (it->address.size() == net::kIPv4AddressSize) { if (it->address.size() == net::kIPv4AddressSize) {
...@@ -86,6 +89,7 @@ void IpcNetworkManager::OnNetworkListChanged( ...@@ -86,6 +89,7 @@ void IpcNetworkManager::OnNetworkListChanged(
ConvertConnectionTypeToAdapterType(it->type)); ConvertConnectionTypeToAdapterType(it->type));
network->AddIP(talk_base::IPAddress(address)); network->AddIP(talk_base::IPAddress(address));
networks.push_back(network); networks.push_back(network);
++ipv4_interfaces;
} else if (it->address.size() == net::kIPv6AddressSize) { } else if (it->address.size() == net::kIPv6AddressSize) {
in6_addr address; in6_addr address;
memcpy(&address, &it->address[0], sizeof(in6_addr)); memcpy(&address, &it->address[0], sizeof(in6_addr));
...@@ -96,10 +100,21 @@ void IpcNetworkManager::OnNetworkListChanged( ...@@ -96,10 +100,21 @@ void IpcNetworkManager::OnNetworkListChanged(
ConvertConnectionTypeToAdapterType(it->type)); ConvertConnectionTypeToAdapterType(it->type));
network->AddIP(ip6_addr); network->AddIP(ip6_addr);
networks.push_back(network); networks.push_back(network);
++ipv6_interfaces;
} }
} }
} }
if (ipv4_interfaces > 0) {
UMA_HISTOGRAM_COUNTS_100("WebRTC.PeerConnection.IPv4Interfaces",
ipv4_interfaces);
}
if (ipv6_interfaces > 0) {
UMA_HISTOGRAM_COUNTS_100("WebRTC.PeerConnection.IPv6Interfaces",
ipv6_interfaces);
}
if (CommandLine::ForCurrentProcess()->HasSwitch( if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kAllowLoopbackInPeerConnection)) { switches::kAllowLoopbackInPeerConnection)) {
std::string name_v4("loopback_ipv4"); std::string name_v4("loopback_ipv4");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment