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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 base::DictionaryValue* info = new base::DictionaryValue(); | 136 base::DictionaryValue* info = new base::DictionaryValue(); |
137 info->SetInteger("sequence_number", static_cast<int>(it->first)); | 137 info->SetInteger("sequence_number", static_cast<int>(it->first)); |
138 info->SetInteger("received", | 138 info->SetInteger("received", |
139 static_cast<int>(it->second.ToDebuggingValue())); | 139 static_cast<int>(it->second.ToDebuggingValue())); |
140 received->Append(info); | 140 received->Append(info); |
141 } | 141 } |
142 | 142 |
143 return dict; | 143 return dict; |
144 } | 144 } |
145 | 145 |
146 base::Value* NetLogQuicCongestionFeedbackFrameCallback( | |
147 const QuicCongestionFeedbackFrame* frame, | |
148 NetLog::LogLevel /* log_level */) { | |
149 base::DictionaryValue* dict = new base::DictionaryValue(); | |
150 switch (frame->type) { | |
151 case kTCP: | |
152 dict->SetString("type", "TCP"); | |
153 dict->SetInteger("receive_window", | |
154 static_cast<int>(frame->tcp.receive_window)); | |
155 break; | |
156 } | |
157 | |
158 return dict; | |
159 } | |
160 | |
161 base::Value* NetLogQuicRstStreamFrameCallback( | 146 base::Value* NetLogQuicRstStreamFrameCallback( |
162 const QuicRstStreamFrame* frame, | 147 const QuicRstStreamFrame* frame, |
163 NetLog::LogLevel /* log_level */) { | 148 NetLog::LogLevel /* log_level */) { |
164 base::DictionaryValue* dict = new base::DictionaryValue(); | 149 base::DictionaryValue* dict = new base::DictionaryValue(); |
165 dict->SetInteger("stream_id", frame->stream_id); | 150 dict->SetInteger("stream_id", frame->stream_id); |
166 dict->SetInteger("quic_rst_stream_error", frame->error_code); | 151 dict->SetInteger("quic_rst_stream_error", frame->error_code); |
167 dict->SetString("details", frame->error_details); | 152 dict->SetString("details", frame->error_details); |
168 return dict; | 153 return dict; |
169 } | 154 } |
170 | 155 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 for (SequenceNumberSet::const_iterator it = missing_packets.begin(); | 406 for (SequenceNumberSet::const_iterator it = missing_packets.begin(); |
422 it != missing_packets.end(); ++it) { | 407 it != missing_packets.end(); ++it) { |
423 if (*it != last_missing + 1 && ++num_ranges >= max_ranges) { | 408 if (*it != last_missing + 1 && ++num_ranges >= max_ranges) { |
424 ++num_truncated_acks_sent_; | 409 ++num_truncated_acks_sent_; |
425 break; | 410 break; |
426 } | 411 } |
427 last_missing = *it; | 412 last_missing = *it; |
428 } | 413 } |
429 break; | 414 break; |
430 } | 415 } |
431 case CONGESTION_FEEDBACK_FRAME: | |
432 net_log_.AddEvent( | |
433 NetLog::TYPE_QUIC_SESSION_CONGESTION_FEEDBACK_FRAME_SENT, | |
434 base::Bind(&NetLogQuicCongestionFeedbackFrameCallback, | |
435 frame.congestion_feedback_frame)); | |
436 break; | |
437 case RST_STREAM_FRAME: | 416 case RST_STREAM_FRAME: |
438 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeClient", | 417 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeClient", |
439 frame.rst_stream_frame->error_code); | 418 frame.rst_stream_frame->error_code); |
440 net_log_.AddEvent( | 419 net_log_.AddEvent( |
441 NetLog::TYPE_QUIC_SESSION_RST_STREAM_FRAME_SENT, | 420 NetLog::TYPE_QUIC_SESSION_RST_STREAM_FRAME_SENT, |
442 base::Bind(&NetLogQuicRstStreamFrameCallback, | 421 base::Bind(&NetLogQuicRstStreamFrameCallback, |
443 frame.rst_stream_frame)); | 422 frame.rst_stream_frame)); |
444 break; | 423 break; |
445 case CONNECTION_CLOSE_FRAME: | 424 case CONNECTION_CLOSE_FRAME: |
446 net_log_.AddEvent( | 425 net_log_.AddEvent( |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 previous_missing_packet = *it; | 605 previous_missing_packet = *it; |
627 ++it; | 606 ++it; |
628 } | 607 } |
629 if (num_consecutive_missing_packets != 0) { | 608 if (num_consecutive_missing_packets != 0) { |
630 UpdatePacketGapSentHistogram(num_consecutive_missing_packets); | 609 UpdatePacketGapSentHistogram(num_consecutive_missing_packets); |
631 } | 610 } |
632 largest_received_missing_packet_sequence_number_ = | 611 largest_received_missing_packet_sequence_number_ = |
633 *missing_packets.rbegin(); | 612 *missing_packets.rbegin(); |
634 } | 613 } |
635 | 614 |
636 void QuicConnectionLogger::OnCongestionFeedbackFrame( | |
637 const QuicCongestionFeedbackFrame& frame) { | |
638 net_log_.AddEvent( | |
639 NetLog::TYPE_QUIC_SESSION_CONGESTION_FEEDBACK_FRAME_RECEIVED, | |
640 base::Bind(&NetLogQuicCongestionFeedbackFrameCallback, &frame)); | |
641 } | |
642 | |
643 void QuicConnectionLogger::OnStopWaitingFrame( | 615 void QuicConnectionLogger::OnStopWaitingFrame( |
644 const QuicStopWaitingFrame& frame) { | 616 const QuicStopWaitingFrame& frame) { |
645 net_log_.AddEvent( | 617 net_log_.AddEvent( |
646 NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_RECEIVED, | 618 NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_RECEIVED, |
647 base::Bind(&NetLogQuicStopWaitingFrameCallback, &frame)); | 619 base::Bind(&NetLogQuicStopWaitingFrameCallback, &frame)); |
648 } | 620 } |
649 | 621 |
650 void QuicConnectionLogger::OnRstStreamFrame(const QuicRstStreamFrame& frame) { | 622 void QuicConnectionLogger::OnRstStreamFrame(const QuicRstStreamFrame& frame) { |
651 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeServer", | 623 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeServer", |
652 frame.error_code); | 624 frame.error_code); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 continue; | 891 continue; |
920 } | 892 } |
921 // Record some overlapping patterns, to get a better picture, since this is | 893 // Record some overlapping patterns, to get a better picture, since this is |
922 // not very expensive. | 894 // not very expensive. |
923 if (i % 3 == 0) | 895 if (i % 3 == 0) |
924 six_packet_histogram->Add(recent_6_mask); | 896 six_packet_histogram->Add(recent_6_mask); |
925 } | 897 } |
926 } | 898 } |
927 | 899 |
928 } // namespace net | 900 } // namespace net |
OLD | NEW |