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

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

Issue 2516033003: Landing Recent QUIC changes until Mon Nov 14 04:43:50 2016 +0000 (Closed)
Patch Set: Remove unused UpdatePacketGapSentHistogram() function. Created 4 years, 1 month 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/chromium/quic_connection_logger.h ('k') | net/quic/chromium/quic_http_stream.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/chromium/quic_connection_logger.h" 5 #include "net/quic/chromium/quic_connection_logger.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 107
108 std::unique_ptr<base::Value> NetLogQuicAckFrameCallback( 108 std::unique_ptr<base::Value> NetLogQuicAckFrameCallback(
109 const QuicAckFrame* frame, 109 const QuicAckFrame* frame,
110 NetLogCaptureMode /* capture_mode */) { 110 NetLogCaptureMode /* capture_mode */) {
111 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 111 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
112 dict->SetString("largest_observed", 112 dict->SetString("largest_observed",
113 base::Uint64ToString(frame->largest_observed)); 113 base::Uint64ToString(frame->largest_observed));
114 dict->SetString("delta_time_largest_observed_us", 114 dict->SetString("delta_time_largest_observed_us",
115 base::Int64ToString(frame->ack_delay_time.ToMicroseconds())); 115 base::Int64ToString(frame->ack_delay_time.ToMicroseconds()));
116 if (frame->missing) {
117 // Entropy and Truncated are not present in v34 and above.
118 dict->SetInteger("entropy_hash", frame->entropy_hash);
119 dict->SetBoolean("truncated", frame->is_truncated);
120 }
121 116
122 base::ListValue* missing = new base::ListValue(); 117 base::ListValue* missing = new base::ListValue();
123 dict->Set("missing_packets", missing); 118 dict->Set("missing_packets", missing);
124 if (frame->missing) { 119 if (!frame->packets.Empty()) {
125 for (const Interval<QuicPacketNumber>& interval : frame->packets) {
126 for (QuicPacketNumber packet = interval.min(); packet < interval.max();
127 ++packet) {
128 missing->AppendString(base::Uint64ToString(packet));
129 }
130 }
131 } else if (!frame->packets.Empty()) {
132 // V34 and above express acked packets, but only print 120 // V34 and above express acked packets, but only print
133 // missing packets, because it's typically a shorter list. 121 // missing packets, because it's typically a shorter list.
134 for (QuicPacketNumber packet = frame->packets.Min(); 122 for (QuicPacketNumber packet = frame->packets.Min();
135 packet < frame->largest_observed; ++packet) { 123 packet < frame->largest_observed; ++packet) {
136 if (!frame->packets.Contains(packet)) { 124 if (!frame->packets.Contains(packet)) {
137 missing->AppendString(base::Uint64ToString(packet)); 125 missing->AppendString(base::Uint64ToString(packet));
138 } 126 }
139 } 127 }
140 } 128 }
141 129
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 250 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
263 base::ListValue* subjects = new base::ListValue(); 251 base::ListValue* subjects = new base::ListValue();
264 for (std::vector<std::string>::const_iterator it = dns_names.begin(); 252 for (std::vector<std::string>::const_iterator it = dns_names.begin();
265 it != dns_names.end(); it++) { 253 it != dns_names.end(); it++) {
266 subjects->AppendString(*it); 254 subjects->AppendString(*it);
267 } 255 }
268 dict->Set("subjects", subjects); 256 dict->Set("subjects", subjects);
269 return std::move(dict); 257 return std::move(dict);
270 } 258 }
271 259
272 void UpdatePacketGapSentHistogram(size_t num_consecutive_missing_packets) {
273 UMA_HISTOGRAM_COUNTS("Net.QuicSession.PacketGapSent",
274 num_consecutive_missing_packets);
275 }
276
277 void UpdatePublicResetAddressMismatchHistogram( 260 void UpdatePublicResetAddressMismatchHistogram(
278 const IPEndPoint& server_hello_address, 261 const IPEndPoint& server_hello_address,
279 const IPEndPoint& public_reset_address) { 262 const IPEndPoint& public_reset_address) {
280 int sample = GetAddressMismatch(server_hello_address, public_reset_address); 263 int sample = GetAddressMismatch(server_hello_address, public_reset_address);
281 // We are seemingly talking to an older server that does not support the 264 // We are seemingly talking to an older server that does not support the
282 // feature, so we can't report the results in the histogram. 265 // feature, so we can't report the results in the histogram.
283 if (sample < 0) { 266 if (sample < 0) {
284 return; 267 return;
285 } 268 }
286 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.PublicResetAddressMismatch2", 269 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.PublicResetAddressMismatch2",
(...skipping 14 matching lines...) Expand all
301 const char* const connection_description, 284 const char* const connection_description,
302 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, 285 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher,
303 const NetLogWithSource& net_log) 286 const NetLogWithSource& net_log)
304 : net_log_(net_log), 287 : net_log_(net_log),
305 session_(session), 288 session_(session),
306 last_received_packet_number_(0), 289 last_received_packet_number_(0),
307 last_received_packet_size_(0), 290 last_received_packet_size_(0),
308 no_packet_received_after_ping_(false), 291 no_packet_received_after_ping_(false),
309 previous_received_packet_size_(0), 292 previous_received_packet_size_(0),
310 largest_received_packet_number_(0), 293 largest_received_packet_number_(0),
311 largest_received_missing_packet_number_(0),
312 num_out_of_order_received_packets_(0), 294 num_out_of_order_received_packets_(0),
313 num_out_of_order_large_received_packets_(0), 295 num_out_of_order_large_received_packets_(0),
314 num_packets_received_(0), 296 num_packets_received_(0),
315 num_frames_received_(0), 297 num_frames_received_(0),
316 num_duplicate_frames_received_(0), 298 num_duplicate_frames_received_(0),
317 num_incorrect_connection_ids_(0), 299 num_incorrect_connection_ids_(0),
318 num_undecryptable_packets_(0), 300 num_undecryptable_packets_(0),
319 num_duplicate_packets_(0), 301 num_duplicate_packets_(0),
320 num_blocked_frames_received_(0), 302 num_blocked_frames_received_(0),
321 num_blocked_frames_sent_(0), 303 num_blocked_frames_sent_(0),
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 const size_t kApproximateLargestSoloAckBytes = 100; 525 const size_t kApproximateLargestSoloAckBytes = 100;
544 if (last_received_packet_number_ < received_acks_.size() && 526 if (last_received_packet_number_ < received_acks_.size() &&
545 last_received_packet_size_ < kApproximateLargestSoloAckBytes) { 527 last_received_packet_size_ < kApproximateLargestSoloAckBytes) {
546 received_acks_[static_cast<size_t>(last_received_packet_number_)] = true; 528 received_acks_[static_cast<size_t>(last_received_packet_number_)] = true;
547 } 529 }
548 530
549 if (frame.packets.Empty()) 531 if (frame.packets.Empty())
550 return; 532 return;
551 533
552 // TODO(rch, rtenneti) sort out histograms for QUIC_VERSION_34 and above. 534 // TODO(rch, rtenneti) sort out histograms for QUIC_VERSION_34 and above.
553 if (session_->connection()->version() > QUIC_VERSION_33) {
554 return;
555 }
556 const PacketNumberQueue& missing_packets = frame.packets;
557 PacketNumberQueue::const_iterator it =
558 missing_packets.lower_bound(largest_received_missing_packet_number_);
559 if (it == missing_packets.end() ||
560 largest_received_missing_packet_number_ == missing_packets.Max()) {
561 return;
562 }
563
564 // Scan through the list and log consecutive ranges of missing packets.
565 size_t num_consecutive_missing_packets = 1;
566 QuicPacketNumber previous_missing_packet =
567 largest_received_missing_packet_number_;
568 for (; it != missing_packets.end(); ++it) {
569 // Account for case where first interval starts below
570 // largest_received_missing_packet_number_.
571 QuicPacketNumber interval_min =
572 std::max(previous_missing_packet + 1, it->min());
573 DCHECK_LE(interval_min, it->max());
574
575 size_t interval_len = it->max() - interval_min;
576 if (interval_len == 0) {
577 continue;
578 }
579 if (interval_min == previous_missing_packet + 1) {
580 num_consecutive_missing_packets += interval_len;
581 } else {
582 UpdatePacketGapSentHistogram(num_consecutive_missing_packets);
583 num_consecutive_missing_packets = interval_len;
584 }
585 previous_missing_packet = it->max() - 1;
586 }
587 UpdatePacketGapSentHistogram(num_consecutive_missing_packets);
588 largest_received_missing_packet_number_ = missing_packets.Max();
589 } 535 }
590 536
591 void QuicConnectionLogger::OnStopWaitingFrame( 537 void QuicConnectionLogger::OnStopWaitingFrame(
592 const QuicStopWaitingFrame& frame) { 538 const QuicStopWaitingFrame& frame) {
593 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_STOP_WAITING_FRAME_RECEIVED, 539 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_STOP_WAITING_FRAME_RECEIVED,
594 base::Bind(&NetLogQuicStopWaitingFrameCallback, &frame)); 540 base::Bind(&NetLogQuicStopWaitingFrameCallback, &frame));
595 } 541 }
596 542
597 void QuicConnectionLogger::OnRstStreamFrame(const QuicRstStreamFrame& frame) { 543 void QuicConnectionLogger::OnRstStreamFrame(const QuicRstStreamFrame& frame) {
598 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeServer", 544 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeServer",
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 700
755 string prefix("Net.QuicSession.PacketLossRate_"); 701 string prefix("Net.QuicSession.PacketLossRate_");
756 base::HistogramBase* histogram = base::Histogram::FactoryGet( 702 base::HistogramBase* histogram = base::Histogram::FactoryGet(
757 prefix + connection_description_, 1, 1000, 75, 703 prefix + connection_description_, 1, 1000, 75,
758 base::HistogramBase::kUmaTargetedHistogramFlag); 704 base::HistogramBase::kUmaTargetedHistogramFlag);
759 histogram->Add(static_cast<base::HistogramBase::Sample>( 705 histogram->Add(static_cast<base::HistogramBase::Sample>(
760 ReceivedPacketLossRate() * 1000)); 706 ReceivedPacketLossRate() * 1000));
761 } 707 }
762 708
763 } // namespace net 709 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/chromium/quic_connection_logger.h ('k') | net/quic/chromium/quic_http_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698