Chromium Code Reviews| 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/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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 785 ReceivedPacketLossRate() * 1000)); | 785 ReceivedPacketLossRate() * 1000)); |
| 786 } | 786 } |
| 787 | 787 |
| 788 void QuicConnectionLogger::RecordLossHistograms() const { | 788 void QuicConnectionLogger::RecordLossHistograms() const { |
| 789 if (largest_received_packet_number_ == 0) | 789 if (largest_received_packet_number_ == 0) |
| 790 return; // Connection was never used. | 790 return; // Connection was never used. |
| 791 RecordAggregatePacketLossRate(); | 791 RecordAggregatePacketLossRate(); |
| 792 | 792 |
| 793 base::HistogramBase* is_not_ack_histogram = | 793 base::HistogramBase* is_not_ack_histogram = |
| 794 GetPacketNumberHistogram("IsNotAck_"); | 794 GetPacketNumberHistogram("IsNotAck_"); |
| 795 base::HistogramBase* is_an_ack_histogram = | |
| 796 GetPacketNumberHistogram("IsAnAck_"); | |
| 797 base::HistogramBase* packet_arrived_histogram = | 795 base::HistogramBase* packet_arrived_histogram = |
| 798 GetPacketNumberHistogram("Ack_"); | 796 GetPacketNumberHistogram("Ack_"); |
| 799 base::HistogramBase* packet_missing_histogram = | 797 base::HistogramBase* packet_missing_histogram = |
| 800 GetPacketNumberHistogram("Nack_"); | 798 GetPacketNumberHistogram("Nack_"); |
| 801 base::HistogramBase* ongoing_cumulative_packet_histogram = | 799 base::HistogramBase* ongoing_cumulative_packet_histogram = |
| 802 Get21CumulativeHistogram("Some21s_"); | 800 Get21CumulativeHistogram("Some21s_"); |
| 803 base::HistogramBase* first_cumulative_packet_histogram = | 801 base::HistogramBase* first_cumulative_packet_histogram = |
| 804 Get21CumulativeHistogram("First21_"); | 802 Get21CumulativeHistogram("First21_"); |
| 805 base::HistogramBase* six_packet_histogram = Get6PacketHistogram("Some6s_"); | 803 base::HistogramBase* six_packet_histogram = Get6PacketHistogram("Some6s_"); |
|
Ryan Hamilton
2016/08/17 23:55:15
I think you can get rid of all the histograms on l
Zhongyi Shi
2016/08/18 03:56:04
Do we also want to remove the last one? All the ot
Ryan Hamilton
2016/08/18 04:05:21
You could ask on quic-dev, though I suspect it's r
| |
| 806 | 804 |
| 807 DCHECK_EQ(received_packets_.size(), received_acks_.size()); | 805 DCHECK_EQ(received_packets_.size(), received_acks_.size()); |
| 808 const QuicPacketNumber last_index = std::min<QuicPacketNumber>( | 806 const QuicPacketNumber last_index = std::min<QuicPacketNumber>( |
| 809 received_packets_.size() - 1, largest_received_packet_number_); | 807 received_packets_.size() - 1, largest_received_packet_number_); |
| 810 const QuicPacketNumber index_of_first_21_contribution = | 808 const QuicPacketNumber index_of_first_21_contribution = |
| 811 std::min<QuicPacketNumber>(21, last_index); | 809 std::min<QuicPacketNumber>(21, last_index); |
| 812 // Bit pattern of consecutively received packets that is maintained as we scan | 810 // Bit pattern of consecutively received packets that is maintained as we scan |
| 813 // through the received_packets_ vector. Less significant bits correspond to | 811 // through the received_packets_ vector. Less significant bits correspond to |
| 814 // less recent packets, and only the low order 21 bits are ever defined. | 812 // less recent packets, and only the low order 21 bits are ever defined. |
| 815 // Bit is 1 iff corresponding packet was received. | 813 // Bit is 1 iff corresponding packet was received. |
| 816 int packet_pattern_21 = 0; | 814 int packet_pattern_21 = 0; |
| 817 // Zero is an invalid packet sequence number. | 815 // Zero is an invalid packet sequence number. |
| 818 DCHECK(!received_packets_[0]); | 816 DCHECK(!received_packets_[0]); |
| 819 for (size_t i = 1; i <= last_index; ++i) { | 817 for (size_t i = 1; i <= last_index; ++i) { |
| 820 if (received_acks_[i]) | 818 if (!received_acks_[i]) |
| 821 is_an_ack_histogram->Add(i); | |
| 822 else | |
| 823 is_not_ack_histogram->Add(i); | 819 is_not_ack_histogram->Add(i); |
| 824 | 820 |
| 825 packet_pattern_21 >>= 1; | 821 packet_pattern_21 >>= 1; |
| 826 if (received_packets_[i]) { | 822 if (received_packets_[i]) { |
| 827 packet_arrived_histogram->Add(i); | 823 packet_arrived_histogram->Add(i); |
| 828 packet_pattern_21 |= (1 << 20); // Turn on the 21st bit. | 824 packet_pattern_21 |= (1 << 20); // Turn on the 21st bit. |
| 829 } else { | 825 } else { |
| 830 packet_missing_histogram->Add(i); | 826 packet_missing_histogram->Add(i); |
| 831 } | 827 } |
| 832 | 828 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 850 continue; | 846 continue; |
| 851 } | 847 } |
| 852 // Record some overlapping patterns, to get a better picture, since this is | 848 // Record some overlapping patterns, to get a better picture, since this is |
| 853 // not very expensive. | 849 // not very expensive. |
| 854 if (i % 3 == 0) | 850 if (i % 3 == 0) |
| 855 six_packet_histogram->Add(recent_6_mask); | 851 six_packet_histogram->Add(recent_6_mask); |
| 856 } | 852 } |
| 857 } | 853 } |
| 858 | 854 |
| 859 } // namespace net | 855 } // namespace net |
| OLD | NEW |