| 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 #ifndef NET_QUIC_QUIC_CONNECTION_LOGGER_H_ | 5 #ifndef NET_QUIC_QUIC_CONNECTION_LOGGER_H_ |
| 6 #define NET_QUIC_QUIC_CONNECTION_LOGGER_H_ | 6 #define NET_QUIC_QUIC_CONNECTION_LOGGER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <bitset> | 10 #include <bitset> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 void OnCryptoHandshakeMessageSent(const CryptoHandshakeMessage& message); | 81 void OnCryptoHandshakeMessageSent(const CryptoHandshakeMessage& message); |
| 82 void UpdateReceivedFrameCounts(QuicStreamId stream_id, | 82 void UpdateReceivedFrameCounts(QuicStreamId stream_id, |
| 83 int num_frames_received, | 83 int num_frames_received, |
| 84 int num_duplicate_frames_received); | 84 int num_duplicate_frames_received); |
| 85 void OnCertificateVerified(const CertVerifyResult& result); | 85 void OnCertificateVerified(const CertVerifyResult& result); |
| 86 | 86 |
| 87 // Returns connection's overall packet loss rate in fraction. | 87 // Returns connection's overall packet loss rate in fraction. |
| 88 float ReceivedPacketLossRate() const; | 88 float ReceivedPacketLossRate() const; |
| 89 | 89 |
| 90 private: | 90 private: |
| 91 // Do a factory get for a histogram for recording data, about individual | |
| 92 // packet numbers, that was gathered in the vectors | |
| 93 // received_packets_ and received_acks_. |statistic_name| identifies which | |
| 94 // element of data is recorded, and is used to form the histogram name. | |
| 95 base::HistogramBase* GetPacketNumberHistogram( | |
| 96 const char* statistic_name) const; | |
| 97 // Do a factory get for a histogram to record a 6-packet loss-sequence as a | 91 // Do a factory get for a histogram to record a 6-packet loss-sequence as a |
| 98 // sample. The histogram will record the 64 distinct possible combinations. | 92 // sample. The histogram will record the 64 distinct possible combinations. |
| 99 // |which_6| is used to adjust the name of the histogram to distinguish the | 93 // |which_6| is used to adjust the name of the histogram to distinguish the |
| 100 // first 6 packets in a connection, vs. some later 6 packets. | 94 // first 6 packets in a connection, vs. some later 6 packets. |
| 101 base::HistogramBase* Get6PacketHistogram(const char* which_6) const; | 95 base::HistogramBase* Get6PacketHistogram(const char* which_6) const; |
| 102 // Do a factory get for a histogram to record cumulative stats across a 21 | |
| 103 // packet sequence. |which_21| is used to adjust the name of the histogram | |
| 104 // to distinguish the first 21 packets' loss data, vs. some later 21 packet | |
| 105 // sequences' loss data. | |
| 106 base::HistogramBase* Get21CumulativeHistogram(const char* which_21) const; | |
| 107 // Add samples associated with a |bit_mask_of_packets| to the given histogram | |
| 108 // that was provided by Get21CumulativeHistogram(). The LSB of that mask | |
| 109 // corresponds to the oldest packet number in the series of packets, | |
| 110 // and the bit in the 2^20 position corresponds to the most recently received | |
| 111 // packet. Of the maximum of 21 bits that are valid (correspond to packets), | |
| 112 // only the most significant |valid_bits_in_mask| are processed. | |
| 113 // A bit value of 0 indicates that a packet was never received, and a 1 | |
| 114 // indicates the packet was received. | |
| 115 static void AddTo21CumulativeHistogram(base::HistogramBase* histogram, | |
| 116 int bit_mask_of_packets, | |
| 117 int valid_bits_in_mask); | |
| 118 // For connections longer than 21 received packets, this call will calculate | 96 // For connections longer than 21 received packets, this call will calculate |
| 119 // the overall packet loss rate, and record it into a histogram. | 97 // the overall packet loss rate, and record it into a histogram. |
| 120 void RecordAggregatePacketLossRate() const; | 98 void RecordAggregatePacketLossRate() const; |
| 121 // At destruction time, this records results of |pacaket_received_| into | |
| 122 // histograms for specific connection types. | |
| 123 void RecordLossHistograms() const; | |
| 124 | 99 |
| 125 BoundNetLog net_log_; | 100 BoundNetLog net_log_; |
| 126 QuicSpdySession* session_; // Unowned. | 101 QuicSpdySession* session_; // Unowned. |
| 127 // The last packet number received. | 102 // The last packet number received. |
| 128 QuicPacketNumber last_received_packet_number_; | 103 QuicPacketNumber last_received_packet_number_; |
| 129 // The size of the most recently received packet. | 104 // The size of the most recently received packet. |
| 130 size_t last_received_packet_size_; | 105 size_t last_received_packet_size_; |
| 131 // The size of the previously received packet. | 106 // The size of the previously received packet. |
| 132 size_t previous_received_packet_size_; | 107 size_t previous_received_packet_size_; |
| 133 // The largest packet number received. In the case where a packet is | 108 // The largest packet number received. In the case where a packet is |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // Receives notifications regarding the performance of the underlying socket | 155 // Receives notifications regarding the performance of the underlying socket |
| 181 // for the QUIC connection. May be null. | 156 // for the QUIC connection. May be null. |
| 182 const std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher_; | 157 const std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher_; |
| 183 | 158 |
| 184 DISALLOW_COPY_AND_ASSIGN(QuicConnectionLogger); | 159 DISALLOW_COPY_AND_ASSIGN(QuicConnectionLogger); |
| 185 }; | 160 }; |
| 186 | 161 |
| 187 } // namespace net | 162 } // namespace net |
| 188 | 163 |
| 189 #endif // NET_QUIC_QUIC_CONNECTION_LOGGER_H_ | 164 #endif // NET_QUIC_QUIC_CONNECTION_LOGGER_H_ |
| OLD | NEW |