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

Side by Side Diff: net/quic/quic_connection_logger.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « net/quic/quic_connection_logger.h ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/metrics/sparse_histogram.h" 13 #include "base/metrics/sparse_histogram.h"
14 #include "base/profiler/scoped_tracker.h"
14 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
15 #include "base/values.h" 16 #include "base/values.h"
16 #include "net/base/net_log.h" 17 #include "net/base/net_log.h"
17 #include "net/base/net_util.h" 18 #include "net/base/net_util.h"
18 #include "net/cert/cert_verify_result.h" 19 #include "net/cert/cert_verify_result.h"
19 #include "net/cert/x509_certificate.h" 20 #include "net/cert/x509_certificate.h"
20 #include "net/quic/crypto/crypto_handshake_message.h" 21 #include "net/quic/crypto/crypto_handshake_message.h"
21 #include "net/quic/crypto/crypto_protocol.h" 22 #include "net/quic/crypto/crypto_protocol.h"
22 #include "net/quic/quic_address_mismatch.h" 23 #include "net/quic/quic_address_mismatch.h"
23 #include "net/quic/quic_socket_address_coder.h" 24 #include "net/quic/quic_socket_address_coder.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // 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
261 // feature, so we can't report the results in the histogram. 262 // feature, so we can't report the results in the histogram.
262 if (sample < 0) { 263 if (sample < 0) {
263 return; 264 return;
264 } 265 }
265 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.PublicResetAddressMismatch2", 266 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.PublicResetAddressMismatch2",
266 sample, QUIC_ADDRESS_MISMATCH_MAX); 267 sample, QUIC_ADDRESS_MISMATCH_MAX);
267 } 268 }
268 269
269 const char* GetConnectionDescriptionString() { 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
270 NetworkChangeNotifier::ConnectionType type = 276 NetworkChangeNotifier::ConnectionType type =
271 NetworkChangeNotifier::GetConnectionType(); 277 NetworkChangeNotifier::GetConnectionType();
272 const char* description = NetworkChangeNotifier::ConnectionTypeToString(type); 278 const char* description = NetworkChangeNotifier::ConnectionTypeToString(type);
273 // Most platforms don't distingish Wifi vs Etherenet, and call everything 279 // Most platforms don't distingish Wifi vs Etherenet, and call everything
274 // CONNECTION_UNKNOWN :-(. We'll tease out some details when we are on WiFi, 280 // CONNECTION_UNKNOWN :-(. We'll tease out some details when we are on WiFi,
275 // and hopefully leave only ethernet (with no WiFi available) in the 281 // and hopefully leave only ethernet (with no WiFi available) in the
276 // CONNECTION_UNKNOWN category. This *might* err if there is both ethernet, 282 // CONNECTION_UNKNOWN category. This *might* err if there is both ethernet,
277 // as well as WiFi, where WiFi was not being used that much. 283 // as well as WiFi, where WiFi was not being used that much.
278 // This function only seems usefully defined on Windows currently. 284 // This function only seems usefully defined on Windows currently.
279 if (type == NetworkChangeNotifier::CONNECTION_UNKNOWN || 285 if (type == NetworkChangeNotifier::CONNECTION_UNKNOWN ||
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 } 325 }
320 326
321 } // namespace 327 } // namespace
322 328
323 QuicConnectionLogger::QuicConnectionLogger(QuicSession* session, 329 QuicConnectionLogger::QuicConnectionLogger(QuicSession* session,
324 const BoundNetLog& net_log) 330 const BoundNetLog& net_log)
325 : net_log_(net_log), 331 : net_log_(net_log),
326 session_(session), 332 session_(session),
327 last_received_packet_sequence_number_(0), 333 last_received_packet_sequence_number_(0),
328 last_received_packet_size_(0), 334 last_received_packet_size_(0),
335 previous_received_packet_size_(0),
329 largest_received_packet_sequence_number_(0), 336 largest_received_packet_sequence_number_(0),
330 largest_received_missing_packet_sequence_number_(0), 337 largest_received_missing_packet_sequence_number_(0),
331 num_out_of_order_received_packets_(0), 338 num_out_of_order_received_packets_(0),
339 num_out_of_order_large_received_packets_(0),
332 num_packets_received_(0), 340 num_packets_received_(0),
333 num_truncated_acks_sent_(0), 341 num_truncated_acks_sent_(0),
334 num_truncated_acks_received_(0), 342 num_truncated_acks_received_(0),
335 num_frames_received_(0), 343 num_frames_received_(0),
336 num_duplicate_frames_received_(0), 344 num_duplicate_frames_received_(0),
337 num_incorrect_connection_ids_(0), 345 num_incorrect_connection_ids_(0),
338 num_undecryptable_packets_(0), 346 num_undecryptable_packets_(0),
339 num_duplicate_packets_(0), 347 num_duplicate_packets_(0),
340 num_blocked_frames_received_(0), 348 num_blocked_frames_received_(0),
341 num_blocked_frames_sent_(0), 349 num_blocked_frames_sent_(0),
342 connection_description_(GetConnectionDescriptionString()) { 350 connection_description_(GetConnectionDescriptionString()) {
343 } 351 }
344 352
345 QuicConnectionLogger::~QuicConnectionLogger() { 353 QuicConnectionLogger::~QuicConnectionLogger() {
346 UMA_HISTOGRAM_COUNTS("Net.QuicSession.OutOfOrderPacketsReceived", 354 UMA_HISTOGRAM_COUNTS("Net.QuicSession.OutOfOrderPacketsReceived",
347 num_out_of_order_received_packets_); 355 num_out_of_order_received_packets_);
356 UMA_HISTOGRAM_COUNTS("Net.QuicSession.OutOfOrderLargePacketsReceived",
357 num_out_of_order_large_received_packets_);
348 UMA_HISTOGRAM_COUNTS("Net.QuicSession.TruncatedAcksSent", 358 UMA_HISTOGRAM_COUNTS("Net.QuicSession.TruncatedAcksSent",
349 num_truncated_acks_sent_); 359 num_truncated_acks_sent_);
350 UMA_HISTOGRAM_COUNTS("Net.QuicSession.TruncatedAcksReceived", 360 UMA_HISTOGRAM_COUNTS("Net.QuicSession.TruncatedAcksReceived",
351 num_truncated_acks_received_); 361 num_truncated_acks_received_);
352 UMA_HISTOGRAM_COUNTS("Net.QuicSession.IncorrectConnectionIDsReceived", 362 UMA_HISTOGRAM_COUNTS("Net.QuicSession.IncorrectConnectionIDsReceived",
353 num_incorrect_connection_ids_); 363 num_incorrect_connection_ids_);
354 UMA_HISTOGRAM_COUNTS("Net.QuicSession.UndecryptablePacketsReceived", 364 UMA_HISTOGRAM_COUNTS("Net.QuicSession.UndecryptablePacketsReceived",
355 num_undecryptable_packets_); 365 num_undecryptable_packets_);
356 UMA_HISTOGRAM_COUNTS("Net.QuicSession.DuplicatePacketsReceived", 366 UMA_HISTOGRAM_COUNTS("Net.QuicSession.DuplicatePacketsReceived",
357 num_duplicate_packets_); 367 num_duplicate_packets_);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 void QuicConnectionLogger::OnPacketReceived(const IPEndPoint& self_address, 499 void QuicConnectionLogger::OnPacketReceived(const IPEndPoint& self_address,
490 const IPEndPoint& peer_address, 500 const IPEndPoint& peer_address,
491 const QuicEncryptedPacket& packet) { 501 const QuicEncryptedPacket& packet) {
492 if (local_address_from_self_.GetFamily() == ADDRESS_FAMILY_UNSPECIFIED) { 502 if (local_address_from_self_.GetFamily() == ADDRESS_FAMILY_UNSPECIFIED) {
493 local_address_from_self_ = self_address; 503 local_address_from_self_ = self_address;
494 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionTypeFromSelf", 504 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionTypeFromSelf",
495 GetRealAddressFamily(self_address.address()), 505 GetRealAddressFamily(self_address.address()),
496 ADDRESS_FAMILY_LAST); 506 ADDRESS_FAMILY_LAST);
497 } 507 }
498 508
509 previous_received_packet_size_ = last_received_packet_size_;
499 last_received_packet_size_ = packet.length(); 510 last_received_packet_size_ = packet.length();
500 net_log_.AddEvent( 511 net_log_.AddEvent(
501 NetLog::TYPE_QUIC_SESSION_PACKET_RECEIVED, 512 NetLog::TYPE_QUIC_SESSION_PACKET_RECEIVED,
502 base::Bind(&NetLogQuicPacketCallback, &self_address, &peer_address, 513 base::Bind(&NetLogQuicPacketCallback, &self_address, &peer_address,
503 packet.length())); 514 packet.length()));
504 } 515 }
505 516
506 void QuicConnectionLogger::OnIncorrectConnectionId( 517 void QuicConnectionLogger::OnIncorrectConnectionId(
507 QuicConnectionId connection_id) { 518 QuicConnectionId connection_id) {
508 ++num_incorrect_connection_ids_; 519 ++num_incorrect_connection_ids_;
(...skipping 30 matching lines...) Expand all
539 static_cast<base::HistogramBase::Sample>(delta - 1)); 550 static_cast<base::HistogramBase::Sample>(delta - 1));
540 } 551 }
541 largest_received_packet_sequence_number_ = header.packet_sequence_number; 552 largest_received_packet_sequence_number_ = header.packet_sequence_number;
542 } 553 }
543 if (header.packet_sequence_number < received_packets_.size()) { 554 if (header.packet_sequence_number < received_packets_.size()) {
544 received_packets_[static_cast<size_t>(header.packet_sequence_number)] = 555 received_packets_[static_cast<size_t>(header.packet_sequence_number)] =
545 true; 556 true;
546 } 557 }
547 if (header.packet_sequence_number < last_received_packet_sequence_number_) { 558 if (header.packet_sequence_number < last_received_packet_sequence_number_) {
548 ++num_out_of_order_received_packets_; 559 ++num_out_of_order_received_packets_;
560 if (previous_received_packet_size_ < last_received_packet_size_)
561 ++num_out_of_order_large_received_packets_;
549 UMA_HISTOGRAM_COUNTS( 562 UMA_HISTOGRAM_COUNTS(
550 "Net.QuicSession.OutOfOrderGapReceived", 563 "Net.QuicSession.OutOfOrderGapReceived",
551 static_cast<base::HistogramBase::Sample>( 564 static_cast<base::HistogramBase::Sample>(
552 last_received_packet_sequence_number_ - 565 last_received_packet_sequence_number_ -
553 header.packet_sequence_number)); 566 header.packet_sequence_number));
554 } 567 }
555 last_received_packet_sequence_number_ = header.packet_sequence_number; 568 last_received_packet_sequence_number_ = header.packet_sequence_number;
556 } 569 }
557 570
558 void QuicConnectionLogger::OnStreamFrame(const QuicStreamFrame& frame) { 571 void QuicConnectionLogger::OnStreamFrame(const QuicStreamFrame& frame) {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 continue; 904 continue;
892 } 905 }
893 // Record some overlapping patterns, to get a better picture, since this is 906 // Record some overlapping patterns, to get a better picture, since this is
894 // not very expensive. 907 // not very expensive.
895 if (i % 3 == 0) 908 if (i % 3 == 0)
896 six_packet_histogram->Add(recent_6_mask); 909 six_packet_histogram->Add(recent_6_mask);
897 } 910 }
898 } 911 }
899 912
900 } // namespace net 913 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection_logger.h ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698