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

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

Issue 549433006: Fix the logic for computing the number of truncated QUIC ACK frames sent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more comments Created 6 years, 3 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_logger_unittest.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"
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 385
386 void QuicConnectionLogger::OnFrameAddedToPacket(const QuicFrame& frame) { 386 void QuicConnectionLogger::OnFrameAddedToPacket(const QuicFrame& frame) {
387 switch (frame.type) { 387 switch (frame.type) {
388 case PADDING_FRAME: 388 case PADDING_FRAME:
389 break; 389 break;
390 case STREAM_FRAME: 390 case STREAM_FRAME:
391 net_log_.AddEvent( 391 net_log_.AddEvent(
392 NetLog::TYPE_QUIC_SESSION_STREAM_FRAME_SENT, 392 NetLog::TYPE_QUIC_SESSION_STREAM_FRAME_SENT,
393 base::Bind(&NetLogQuicStreamFrameCallback, frame.stream_frame)); 393 base::Bind(&NetLogQuicStreamFrameCallback, frame.stream_frame));
394 break; 394 break;
395 case ACK_FRAME: 395 case ACK_FRAME: {
396 net_log_.AddEvent( 396 net_log_.AddEvent(
397 NetLog::TYPE_QUIC_SESSION_ACK_FRAME_SENT, 397 NetLog::TYPE_QUIC_SESSION_ACK_FRAME_SENT,
398 base::Bind(&NetLogQuicAckFrameCallback, frame.ack_frame)); 398 base::Bind(&NetLogQuicAckFrameCallback, frame.ack_frame));
399 if (frame.ack_frame->is_truncated) 399 const SequenceNumberSet& missing_packets =
400 ++num_truncated_acks_sent_; 400 frame.ack_frame->missing_packets;
401 const uint8 max_ranges = std::numeric_limits<uint8>::max();
402 // Compute an upper bound on the number of NACK ranges. If the bound
403 // is below the max, then it clearly isn't truncated.
404 if (missing_packets.size() < max_ranges ||
405 (*missing_packets.rbegin() - *missing_packets.begin() -
406 missing_packets.size() + 1) < max_ranges) {
407 break;
408 }
409 size_t num_ranges = 0;
410 QuicPacketSequenceNumber last_missing = 0;
411 for (SequenceNumberSet::const_iterator it = missing_packets.begin();
412 it != missing_packets.end(); ++it) {
413 if (*it != last_missing + 1 && ++num_ranges >= max_ranges) {
414 ++num_truncated_acks_sent_;
415 break;
416 }
417 last_missing = *it;
418 }
401 break; 419 break;
420 }
402 case CONGESTION_FEEDBACK_FRAME: 421 case CONGESTION_FEEDBACK_FRAME:
403 net_log_.AddEvent( 422 net_log_.AddEvent(
404 NetLog::TYPE_QUIC_SESSION_CONGESTION_FEEDBACK_FRAME_SENT, 423 NetLog::TYPE_QUIC_SESSION_CONGESTION_FEEDBACK_FRAME_SENT,
405 base::Bind(&NetLogQuicCongestionFeedbackFrameCallback, 424 base::Bind(&NetLogQuicCongestionFeedbackFrameCallback,
406 frame.congestion_feedback_frame)); 425 frame.congestion_feedback_frame));
407 break; 426 break;
408 case RST_STREAM_FRAME: 427 case RST_STREAM_FRAME:
409 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeClient", 428 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeClient",
410 frame.rst_stream_frame->error_code); 429 frame.rst_stream_frame->error_code);
411 net_log_.AddEvent( 430 net_log_.AddEvent(
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 continue; 896 continue;
878 } 897 }
879 // Record some overlapping patterns, to get a better picture, since this is 898 // Record some overlapping patterns, to get a better picture, since this is
880 // not very expensive. 899 // not very expensive.
881 if (i % 3 == 0) 900 if (i % 3 == 0)
882 six_packet_histogram->Add(recent_6_mask); 901 six_packet_histogram->Add(recent_6_mask);
883 } 902 }
884 } 903 }
885 904
886 } // namespace net 905 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection_logger.h ('k') | net/quic/quic_connection_logger_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698