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

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

Issue 2690113004: Throttle Socket watcher RTT notifications from QUIC (Closed)
Patch Set: Rebased, rch comments Created 3 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
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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 float num_received = largest_received_packet_number_ - num_packets_received_; 679 float num_received = largest_received_packet_number_ - num_packets_received_;
680 return num_received / largest_received_packet_number_; 680 return num_received / largest_received_packet_number_;
681 } 681 }
682 682
683 void QuicConnectionLogger::OnRttChanged(QuicTime::Delta rtt) const { 683 void QuicConnectionLogger::OnRttChanged(QuicTime::Delta rtt) const {
684 // Notify socket performance watcher of the updated RTT value. 684 // Notify socket performance watcher of the updated RTT value.
685 if (!socket_performance_watcher_) 685 if (!socket_performance_watcher_)
686 return; 686 return;
687 687
688 int64_t microseconds = rtt.ToMicroseconds(); 688 int64_t microseconds = rtt.ToMicroseconds();
689 if (microseconds != 0) { 689 if (microseconds != 0 &&
690 socket_performance_watcher_->ShouldNotifyUpdatedRTT()) {
690 socket_performance_watcher_->OnUpdatedRTTAvailable( 691 socket_performance_watcher_->OnUpdatedRTTAvailable(
691 base::TimeDelta::FromMicroseconds(rtt.ToMicroseconds())); 692 base::TimeDelta::FromMicroseconds(rtt.ToMicroseconds()));
692 } 693 }
693 } 694 }
694 695
695 void QuicConnectionLogger::RecordAggregatePacketLossRate() const { 696 void QuicConnectionLogger::RecordAggregatePacketLossRate() const {
696 // For short connections under 22 packets in length, we'll rely on the 697 // For short connections under 22 packets in length, we'll rely on the
697 // Net.QuicSession.21CumulativePacketsReceived_* histogram to indicate packet 698 // Net.QuicSession.21CumulativePacketsReceived_* histogram to indicate packet
698 // loss rates. This way we avoid tremendously anomalous contributions to our 699 // loss rates. This way we avoid tremendously anomalous contributions to our
699 // histogram. (e.g., if we only got 5 packets, but lost 1, we'd otherwise 700 // histogram. (e.g., if we only got 5 packets, but lost 1, we'd otherwise
700 // record a 20% loss in this histogram!). We may still get some strange data 701 // record a 20% loss in this histogram!). We may still get some strange data
701 // (1 loss in 22 is still high :-/). 702 // (1 loss in 22 is still high :-/).
702 if (largest_received_packet_number_ <= 21) 703 if (largest_received_packet_number_ <= 21)
703 return; 704 return;
704 705
705 string prefix("Net.QuicSession.PacketLossRate_"); 706 string prefix("Net.QuicSession.PacketLossRate_");
706 base::HistogramBase* histogram = base::Histogram::FactoryGet( 707 base::HistogramBase* histogram = base::Histogram::FactoryGet(
707 prefix + connection_description_, 1, 1000, 75, 708 prefix + connection_description_, 1, 1000, 75,
708 base::HistogramBase::kUmaTargetedHistogramFlag); 709 base::HistogramBase::kUmaTargetedHistogramFlag);
709 histogram->Add(static_cast<base::HistogramBase::Sample>( 710 histogram->Add(static_cast<base::HistogramBase::Sample>(
710 ReceivedPacketLossRate() * 1000)); 711 ReceivedPacketLossRate() * 1000));
711 } 712 }
712 713
713 } // namespace net 714 } // namespace net
OLDNEW
« no previous file with comments | « net/nqe/socket_watcher_unittest.cc ('k') | net/quic/chromium/quic_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698