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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
360 | 360 |
361 void QuicConnectionLogger::OnFrameAddedToPacket(const QuicFrame& frame) { | 361 void QuicConnectionLogger::OnFrameAddedToPacket(const QuicFrame& frame) { |
362 switch (frame.type) { | 362 switch (frame.type) { |
363 case PADDING_FRAME: | 363 case PADDING_FRAME: |
364 break; | 364 break; |
365 case STREAM_FRAME: | 365 case STREAM_FRAME: |
366 net_log_.AddEvent( | 366 net_log_.AddEvent( |
367 NetLog::TYPE_QUIC_SESSION_STREAM_FRAME_SENT, | 367 NetLog::TYPE_QUIC_SESSION_STREAM_FRAME_SENT, |
368 base::Bind(&NetLogQuicStreamFrameCallback, frame.stream_frame)); | 368 base::Bind(&NetLogQuicStreamFrameCallback, frame.stream_frame)); |
369 break; | 369 break; |
370 case ACK_FRAME: | 370 case ACK_FRAME: { |
371 net_log_.AddEvent( | 371 net_log_.AddEvent( |
372 NetLog::TYPE_QUIC_SESSION_ACK_FRAME_SENT, | 372 NetLog::TYPE_QUIC_SESSION_ACK_FRAME_SENT, |
373 base::Bind(&NetLogQuicAckFrameCallback, frame.ack_frame)); | 373 base::Bind(&NetLogQuicAckFrameCallback, frame.ack_frame)); |
374 if (frame.ack_frame->is_truncated) | 374 size_t num_ranges = 0; |
375 QuicPacketSequenceNumber last_missing = 0; | |
376 for (SequenceNumberSet::const_iterator it = | |
377 frame.ack_frame->missing_packets.begin(); | |
378 it != frame.ack_frame->missing_packets.end(); | |
379 ++it) { | |
380 if (*it != last_missing + 1) { | |
eroman
2014/09/09 00:08:01
possibility of integer overflow?
Ryan Hamilton
2014/09/09 19:00:36
I guess it's *possible*, but since I'm using != an
| |
381 ++num_ranges; | |
382 } | |
383 last_missing = *it; | |
384 } | |
385 if (num_ranges >= std::numeric_limits<uint8>::max()) | |
eroman
2014/09/09 00:08:01
is it necessary to iterate everything if this is t
Ryan Hamilton
2014/09/09 19:00:36
as far as I know, but I'd be happy to come up with
eroman
2014/09/09 22:35:18
What I mean is that the "if" could be moved inside
Ryan Hamilton
2014/09/12 19:34:08
Done.
| |
375 ++num_truncated_acks_sent_; | 386 ++num_truncated_acks_sent_; |
376 break; | 387 break; |
388 } | |
eroman
2014/09/09 00:08:01
How clever does this algorithm need to be? (How of
Ryan Hamilton
2014/09/09 19:00:36
Good question. We run it for computing data for hi
eroman
2014/09/09 22:35:18
Checking on size alone is another short cuircuit.
Ryan Hamilton
2014/09/12 19:34:08
Gotcha. I think I've implemented basically what yo
| |
377 case CONGESTION_FEEDBACK_FRAME: | 389 case CONGESTION_FEEDBACK_FRAME: |
378 net_log_.AddEvent( | 390 net_log_.AddEvent( |
379 NetLog::TYPE_QUIC_SESSION_CONGESTION_FEEDBACK_FRAME_SENT, | 391 NetLog::TYPE_QUIC_SESSION_CONGESTION_FEEDBACK_FRAME_SENT, |
380 base::Bind(&NetLogQuicCongestionFeedbackFrameCallback, | 392 base::Bind(&NetLogQuicCongestionFeedbackFrameCallback, |
381 frame.congestion_feedback_frame)); | 393 frame.congestion_feedback_frame)); |
382 break; | 394 break; |
383 case RST_STREAM_FRAME: | 395 case RST_STREAM_FRAME: |
384 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeClient", | 396 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeClient", |
385 frame.rst_stream_frame->error_code); | 397 frame.rst_stream_frame->error_code); |
386 net_log_.AddEvent( | 398 net_log_.AddEvent( |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
852 continue; | 864 continue; |
853 } | 865 } |
854 // Record some overlapping patterns, to get a better picture, since this is | 866 // Record some overlapping patterns, to get a better picture, since this is |
855 // not very expensive. | 867 // not very expensive. |
856 if (i % 3 == 0) | 868 if (i % 3 == 0) |
857 six_packet_histogram->Add(recent_6_mask); | 869 six_packet_histogram->Add(recent_6_mask); |
858 } | 870 } |
859 } | 871 } |
860 | 872 |
861 } // namespace net | 873 } // namespace net |
OLD | NEW |