diff options
-rw-r--r-- | net/base/net_util.h | 2 | ||||
-rw-r--r-- | net/quic/quic_connection_logger.cc | 56 | ||||
-rw-r--r-- | net/quic/quic_connection_logger.h | 2 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 13 |
4 files changed, 65 insertions, 8 deletions
diff --git a/net/base/net_util.h b/net/base/net_util.h index 0ec0a82..04a9b2d 100644 --- a/net/base/net_util.h +++ b/net/base/net_util.h @@ -547,7 +547,7 @@ NET_EXPORT bool GetNetworkList(NetworkInterfaceList* networks, enum WifiPHYLayerProtocol { // No wifi support or no associated AP. WIFI_PHY_LAYER_PROTOCOL_NONE, - // An obsolete modes introduced by the original 802.11, e.g. IR, FHSS, + // An obsolete modes introduced by the original 802.11, e.g. IR, FHSS. WIFI_PHY_LAYER_PROTOCOL_ANCIENT, // 802.11a, OFDM-based rates. WIFI_PHY_LAYER_PROTOCOL_A, diff --git a/net/quic/quic_connection_logger.cc b/net/quic/quic_connection_logger.cc index 4ce7da8..31fc4df 100644 --- a/net/quic/quic_connection_logger.cc +++ b/net/quic/quic_connection_logger.cc @@ -14,6 +14,7 @@ #include "base/strings/string_number_conversions.h" #include "base/values.h" #include "net/base/net_log.h" +#include "net/base/net_util.h" #include "net/quic/crypto/crypto_handshake_message.h" #include "net/quic/crypto/crypto_protocol.h" #include "net/quic/quic_address_mismatch.h" @@ -243,6 +244,52 @@ void UpdatePublicResetAddressMismatchHistogram( sample, QUIC_ADDRESS_MISMATCH_MAX); } +const char* GetConnectionDescriptionString() { + NetworkChangeNotifier::ConnectionType type = + NetworkChangeNotifier::GetConnectionType(); + const char* description = NetworkChangeNotifier::ConnectionTypeToString(type); + // Most platforms don't distingish Wifi vs Etherenet, and call everything + // CONNECTION_UNKNOWN :-(. We'll tease out some details when we are on WiFi, + // and hopefully leave only ethernet (with no WiFi available) in the + // CONNECTION_UNKNOWN category. This *might* err if there is both ethernet, + // as well as WiFi, where WiFi was not being used that much. + // This function only seems usefully defined on Windows currently. + if (type == NetworkChangeNotifier::CONNECTION_UNKNOWN || + type == NetworkChangeNotifier::CONNECTION_WIFI) { + WifiPHYLayerProtocol wifi_type = GetWifiPHYLayerProtocol(); + switch (wifi_type) { + case WIFI_PHY_LAYER_PROTOCOL_NONE: + // No wifi support or no associated AP. + break; + case WIFI_PHY_LAYER_PROTOCOL_ANCIENT: + // An obsolete modes introduced by the original 802.11, e.g. IR, FHSS. + description = "CONNECTION_WIFI_ANCIENT"; + break; + case WIFI_PHY_LAYER_PROTOCOL_A: + // 802.11a, OFDM-based rates. + description = "CONNECTION_WIFI_802.11a"; + break; + case WIFI_PHY_LAYER_PROTOCOL_B: + // 802.11b, DSSS or HR DSSS. + description = "CONNECTION_WIFI_802.11b"; + break; + case WIFI_PHY_LAYER_PROTOCOL_G: + // 802.11g, same rates as 802.11a but compatible with 802.11b. + description = "CONNECTION_WIFI_802.11g"; + break; + case WIFI_PHY_LAYER_PROTOCOL_N: + // 802.11n, HT rates. + description = "CONNECTION_WIFI_802.11n"; + break; + case WIFI_PHY_LAYER_PROTOCOL_UNKNOWN: + // Unclassified mode or failure to identify. + break; + } + } + return description; +} + + } // namespace QuicConnectionLogger::QuicConnectionLogger(const BoundNetLog& net_log) @@ -253,7 +300,7 @@ QuicConnectionLogger::QuicConnectionLogger(const BoundNetLog& net_log) out_of_order_recieved_packet_count_(0), num_truncated_acks_sent_(0), num_truncated_acks_received_(0), - connection_type_(NetworkChangeNotifier::GetConnectionType()) { + connection_description_(GetConnectionDescriptionString()) { } QuicConnectionLogger::~QuicConnectionLogger() { @@ -530,10 +577,9 @@ void QuicConnectionLogger::OnSuccessfulVersionNegotiation( base::HistogramBase* QuicConnectionLogger::GetAckHistogram( const char* ack_or_nack) { string prefix("Net.QuicSession.PacketReceived_"); - const char* suffix = NetworkChangeNotifier::ConnectionTypeToString( - connection_type_); - return base::LinearHistogram::FactoryGet(prefix + ack_or_nack + suffix, 1, - packets_received_.size(), packets_received_.size() + 1, + return base::LinearHistogram::FactoryGet( + prefix + ack_or_nack + connection_description_, + 1, packets_received_.size(), packets_received_.size() + 1, base::HistogramBase::kUmaTargetedHistogramFlag); } diff --git a/net/quic/quic_connection_logger.h b/net/quic/quic_connection_logger.h index 7efed12..cd7f4dc 100644 --- a/net/quic/quic_connection_logger.h +++ b/net/quic/quic_connection_logger.h @@ -95,7 +95,7 @@ class NET_EXPORT_PRIVATE QuicConnectionLogger std::bitset<101> packets_received_; // The available type of connection (WiFi, 3G, etc.) when connection was first // used. - NetworkChangeNotifier::ConnectionType connection_type_; + const char* const connection_description_; DISALLOW_COPY_AND_ASSIGN(QuicConnectionLogger); }; diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index d771e40..be66c94 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -36439,7 +36439,18 @@ other types of suffix sets. connections to a WiFi bridge."/> <group name="CONNECTION_WIFI" label="Connections via WiFi are tallied, but this may include - connections to a mobile hotspot."/> + connections to a mobile hotspot. Also check similar histograms + that end in WIFI_802.11* for more details on some platforms."/> + <group name="CONNECTION_WIFI_ANCIENT" + label="Connections via 802.11 that are no longer standard are tallied."/> + <group name="CONNECTION_WIFI_802.11a" + label="Connections via 802.11a are tallied."/> + <group name="CONNECTION_WIFI_802.11b" + label="Connections via 802.11b are tallied."/> + <group name="CONNECTION_WIFI_802.11g" + label="Connections via 802.11g are tallied."/> + <group name="CONNECTION_WIFI_802.11n" + label="Connections via 802.11n are tallied."/> <group name="CONNECTION_2G" label="Connections via mobile 2G are tallied."/> <group name="CONNECTION_3G" label="Connections via mobile 3G are tallied."/> <group name="CONNECTION_4G" label="Connections via mobile 4G are tallied."/> |