OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/quic_connection_logger.h" | 5 #include "net/quic/quic_connection_logger.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 int sample = GetAddressMismatch(server_hello_address, public_reset_address); | 260 int sample = GetAddressMismatch(server_hello_address, public_reset_address); |
261 // We are seemingly talking to an older server that does not support the | 261 // We are seemingly talking to an older server that does not support the |
262 // feature, so we can't report the results in the histogram. | 262 // feature, so we can't report the results in the histogram. |
263 if (sample < 0) { | 263 if (sample < 0) { |
264 return; | 264 return; |
265 } | 265 } |
266 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.PublicResetAddressMismatch2", | 266 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.PublicResetAddressMismatch2", |
267 sample, QUIC_ADDRESS_MISMATCH_MAX); | 267 sample, QUIC_ADDRESS_MISMATCH_MAX); |
268 } | 268 } |
269 | 269 |
270 const char* GetConnectionDescriptionString() { | |
271 // TODO(rtenneti): Remove ScopedTracker below once crbug.com/422516 is fixed. | |
272 tracked_objects::ScopedTracker tracking_profile( | |
273 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
274 "422516 QuicConnectionLogger GetConnectionDescriptionString")); | |
275 | |
276 NetworkChangeNotifier::ConnectionType type = | |
277 NetworkChangeNotifier::GetConnectionType(); | |
278 const char* description = NetworkChangeNotifier::ConnectionTypeToString(type); | |
279 // Most platforms don't distingish Wifi vs Etherenet, and call everything | |
280 // CONNECTION_UNKNOWN :-(. We'll tease out some details when we are on WiFi, | |
281 // and hopefully leave only ethernet (with no WiFi available) in the | |
282 // CONNECTION_UNKNOWN category. This *might* err if there is both ethernet, | |
283 // as well as WiFi, where WiFi was not being used that much. | |
284 // This function only seems usefully defined on Windows currently. | |
285 if (type == NetworkChangeNotifier::CONNECTION_UNKNOWN || | |
286 type == NetworkChangeNotifier::CONNECTION_WIFI) { | |
287 // TODO(rtenneti): Remove ScopedTracker below once crbug.com/422516 is | |
288 // fixed. | |
289 tracked_objects::ScopedTracker tracking_profile1( | |
290 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
291 "422516 QuicConnectionLogger GetConnectionDescriptionString1")); | |
292 | |
293 WifiPHYLayerProtocol wifi_type = GetWifiPHYLayerProtocol(); | |
294 switch (wifi_type) { | |
295 case WIFI_PHY_LAYER_PROTOCOL_NONE: | |
296 // No wifi support or no associated AP. | |
297 break; | |
298 case WIFI_PHY_LAYER_PROTOCOL_ANCIENT: | |
299 // An obsolete modes introduced by the original 802.11, e.g. IR, FHSS. | |
300 description = "CONNECTION_WIFI_ANCIENT"; | |
301 break; | |
302 case WIFI_PHY_LAYER_PROTOCOL_A: | |
303 // 802.11a, OFDM-based rates. | |
304 description = "CONNECTION_WIFI_802.11a"; | |
305 break; | |
306 case WIFI_PHY_LAYER_PROTOCOL_B: | |
307 // 802.11b, DSSS or HR DSSS. | |
308 description = "CONNECTION_WIFI_802.11b"; | |
309 break; | |
310 case WIFI_PHY_LAYER_PROTOCOL_G: | |
311 // 802.11g, same rates as 802.11a but compatible with 802.11b. | |
312 description = "CONNECTION_WIFI_802.11g"; | |
313 break; | |
314 case WIFI_PHY_LAYER_PROTOCOL_N: | |
315 // 802.11n, HT rates. | |
316 description = "CONNECTION_WIFI_802.11n"; | |
317 break; | |
318 case WIFI_PHY_LAYER_PROTOCOL_UNKNOWN: | |
319 // Unclassified mode or failure to identify. | |
320 break; | |
321 } | |
322 } | |
323 return description; | |
324 } | |
325 | |
326 // If |address| is an IPv4-mapped IPv6 address, returns ADDRESS_FAMILY_IPV4 | 270 // If |address| is an IPv4-mapped IPv6 address, returns ADDRESS_FAMILY_IPV4 |
327 // instead of ADDRESS_FAMILY_IPV6. Othewise, behaves like GetAddressFamily(). | 271 // instead of ADDRESS_FAMILY_IPV6. Othewise, behaves like GetAddressFamily(). |
328 AddressFamily GetRealAddressFamily(const IPAddressNumber& address) { | 272 AddressFamily GetRealAddressFamily(const IPAddressNumber& address) { |
329 return IsIPv4Mapped(address) ? ADDRESS_FAMILY_IPV4 : | 273 return IsIPv4Mapped(address) ? ADDRESS_FAMILY_IPV4 : |
330 GetAddressFamily(address); | 274 GetAddressFamily(address); |
331 } | 275 } |
332 | 276 |
333 } // namespace | 277 } // namespace |
334 | 278 |
335 QuicConnectionLogger::QuicConnectionLogger(QuicSession* session, | 279 QuicConnectionLogger::QuicConnectionLogger( |
336 const BoundNetLog& net_log) | 280 QuicSession* session, |
| 281 const char* const connection_description, |
| 282 const BoundNetLog& net_log) |
337 : net_log_(net_log), | 283 : net_log_(net_log), |
338 session_(session), | 284 session_(session), |
339 last_received_packet_sequence_number_(0), | 285 last_received_packet_sequence_number_(0), |
340 last_received_packet_size_(0), | 286 last_received_packet_size_(0), |
341 previous_received_packet_size_(0), | 287 previous_received_packet_size_(0), |
342 largest_received_packet_sequence_number_(0), | 288 largest_received_packet_sequence_number_(0), |
343 largest_received_missing_packet_sequence_number_(0), | 289 largest_received_missing_packet_sequence_number_(0), |
344 num_out_of_order_received_packets_(0), | 290 num_out_of_order_received_packets_(0), |
345 num_out_of_order_large_received_packets_(0), | 291 num_out_of_order_large_received_packets_(0), |
346 num_packets_received_(0), | 292 num_packets_received_(0), |
347 num_truncated_acks_sent_(0), | 293 num_truncated_acks_sent_(0), |
348 num_truncated_acks_received_(0), | 294 num_truncated_acks_received_(0), |
349 num_frames_received_(0), | 295 num_frames_received_(0), |
350 num_duplicate_frames_received_(0), | 296 num_duplicate_frames_received_(0), |
351 num_incorrect_connection_ids_(0), | 297 num_incorrect_connection_ids_(0), |
352 num_undecryptable_packets_(0), | 298 num_undecryptable_packets_(0), |
353 num_duplicate_packets_(0), | 299 num_duplicate_packets_(0), |
354 num_blocked_frames_received_(0), | 300 num_blocked_frames_received_(0), |
355 num_blocked_frames_sent_(0), | 301 num_blocked_frames_sent_(0), |
356 connection_description_(GetConnectionDescriptionString()) { | 302 connection_description_(connection_description) { |
357 } | 303 } |
358 | 304 |
359 QuicConnectionLogger::~QuicConnectionLogger() { | 305 QuicConnectionLogger::~QuicConnectionLogger() { |
360 UMA_HISTOGRAM_COUNTS("Net.QuicSession.OutOfOrderPacketsReceived", | 306 UMA_HISTOGRAM_COUNTS("Net.QuicSession.OutOfOrderPacketsReceived", |
361 num_out_of_order_received_packets_); | 307 num_out_of_order_received_packets_); |
362 UMA_HISTOGRAM_COUNTS("Net.QuicSession.OutOfOrderLargePacketsReceived", | 308 UMA_HISTOGRAM_COUNTS("Net.QuicSession.OutOfOrderLargePacketsReceived", |
363 num_out_of_order_large_received_packets_); | 309 num_out_of_order_large_received_packets_); |
364 UMA_HISTOGRAM_COUNTS("Net.QuicSession.TruncatedAcksSent", | 310 UMA_HISTOGRAM_COUNTS("Net.QuicSession.TruncatedAcksSent", |
365 num_truncated_acks_sent_); | 311 num_truncated_acks_sent_); |
366 UMA_HISTOGRAM_COUNTS("Net.QuicSession.TruncatedAcksReceived", | 312 UMA_HISTOGRAM_COUNTS("Net.QuicSession.TruncatedAcksReceived", |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 continue; | 858 continue; |
913 } | 859 } |
914 // Record some overlapping patterns, to get a better picture, since this is | 860 // Record some overlapping patterns, to get a better picture, since this is |
915 // not very expensive. | 861 // not very expensive. |
916 if (i % 3 == 0) | 862 if (i % 3 == 0) |
917 six_packet_histogram->Add(recent_6_mask); | 863 six_packet_histogram->Add(recent_6_mask); |
918 } | 864 } |
919 } | 865 } |
920 | 866 |
921 } // namespace net | 867 } // namespace net |
OLD | NEW |