| 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> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "net/base/ip_endpoint.h" | 14 #include "net/base/ip_endpoint.h" |
| 15 #include "net/base/network_change_notifier.h" | 15 #include "net/base/network_change_notifier.h" |
| 16 #include "net/cert/cert_verify_result.h" | 16 #include "net/cert/cert_verify_result.h" |
| 17 #include "net/log/net_log.h" | 17 #include "net/log/net_log.h" |
| 18 #include "net/quic/core/crypto/crypto_handshake_message.h" | 18 #include "net/quic/core/crypto/crypto_handshake_message.h" |
| 19 #include "net/quic/core/quic_connection.h" | 19 #include "net/quic/core/quic_connection.h" |
| 20 #include "net/quic/core/quic_protocol.h" | 20 #include "net/quic/core/quic_protocol.h" |
| 21 #include "net/quic/core/quic_spdy_session.h" | 21 #include "net/quic/core/quic_spdy_session.h" |
| 22 #include "net/socket/socket_performance_watcher.h" | 22 #include "net/socket/socket_performance_watcher.h" |
| 23 | 23 |
| 24 namespace base { | 24 namespace base { |
| 25 class HistogramBase; | 25 class HistogramBase; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace net { | 28 namespace net { |
| 29 namespace test { | |
| 30 class QuicConnectionLoggerPeer; | |
| 31 } // namespace test | |
| 32 | |
| 33 | 29 |
| 34 // This class is a debug visitor of a QuicConnection which logs | 30 // This class is a debug visitor of a QuicConnection which logs |
| 35 // events to |net_log|. | 31 // events to |net_log|. |
| 36 class NET_EXPORT_PRIVATE QuicConnectionLogger | 32 class NET_EXPORT_PRIVATE QuicConnectionLogger |
| 37 : public QuicConnectionDebugVisitor, | 33 : public QuicConnectionDebugVisitor, |
| 38 public QuicPacketCreator::DebugDelegate { | 34 public QuicPacketCreator::DebugDelegate { |
| 39 public: | 35 public: |
| 40 QuicConnectionLogger( | 36 QuicConnectionLogger( |
| 41 QuicSpdySession* session, | 37 QuicSpdySession* session, |
| 42 const char* const connection_description, | 38 const char* const connection_description, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 void OnCryptoHandshakeMessageSent(const CryptoHandshakeMessage& message); | 81 void OnCryptoHandshakeMessageSent(const CryptoHandshakeMessage& message); |
| 86 void UpdateReceivedFrameCounts(QuicStreamId stream_id, | 82 void UpdateReceivedFrameCounts(QuicStreamId stream_id, |
| 87 int num_frames_received, | 83 int num_frames_received, |
| 88 int num_duplicate_frames_received); | 84 int num_duplicate_frames_received); |
| 89 void OnCertificateVerified(const CertVerifyResult& result); | 85 void OnCertificateVerified(const CertVerifyResult& result); |
| 90 | 86 |
| 91 // Returns connection's overall packet loss rate in fraction. | 87 // Returns connection's overall packet loss rate in fraction. |
| 92 float ReceivedPacketLossRate() const; | 88 float ReceivedPacketLossRate() const; |
| 93 | 89 |
| 94 private: | 90 private: |
| 95 friend class test::QuicConnectionLoggerPeer; | |
| 96 | |
| 97 // Do a factory get for a histogram for recording data, about individual | 91 // Do a factory get for a histogram for recording data, about individual |
| 98 // packet numbers, that was gathered in the vectors | 92 // packet numbers, that was gathered in the vectors |
| 99 // received_packets_ and received_acks_. |statistic_name| identifies which | 93 // received_packets_ and received_acks_. |statistic_name| identifies which |
| 100 // element of data is recorded, and is used to form the histogram name. | 94 // element of data is recorded, and is used to form the histogram name. |
| 101 base::HistogramBase* GetPacketNumberHistogram( | 95 base::HistogramBase* GetPacketNumberHistogram( |
| 102 const char* statistic_name) const; | 96 const char* statistic_name) const; |
| 103 // Do a factory get for a histogram to record a 6-packet loss-sequence as a | 97 // Do a factory get for a histogram to record a 6-packet loss-sequence as a |
| 104 // sample. The histogram will record the 64 distinct possible combinations. | 98 // sample. The histogram will record the 64 distinct possible combinations. |
| 105 // |which_6| is used to adjust the name of the histogram to distinguish the | 99 // |which_6| is used to adjust the name of the histogram to distinguish the |
| 106 // first 6 packets in a connection, vs. some later 6 packets. | 100 // first 6 packets in a connection, vs. some later 6 packets. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 size_t num_out_of_order_received_packets_; | 143 size_t num_out_of_order_received_packets_; |
| 150 // Number of times that the current received packet number is | 144 // Number of times that the current received packet number is |
| 151 // smaller than the last received packet number and where the | 145 // smaller than the last received packet number and where the |
| 152 // size of the current packet is larger than the size of the previous | 146 // size of the current packet is larger than the size of the previous |
| 153 // packet. | 147 // packet. |
| 154 size_t num_out_of_order_large_received_packets_; | 148 size_t num_out_of_order_large_received_packets_; |
| 155 // The number of times that OnPacketHeader was called. | 149 // The number of times that OnPacketHeader was called. |
| 156 // If the network replicates packets, then this number may be slightly | 150 // If the network replicates packets, then this number may be slightly |
| 157 // different from the real number of distinct packets received. | 151 // different from the real number of distinct packets received. |
| 158 QuicPacketCount num_packets_received_; | 152 QuicPacketCount num_packets_received_; |
| 159 // Number of times a truncated ACK frame was sent. | |
| 160 size_t num_truncated_acks_sent_; | |
| 161 // Number of times a truncated ACK frame was received. | |
| 162 size_t num_truncated_acks_received_; | |
| 163 // The kCADR value provided by the server in ServerHello. | 153 // The kCADR value provided by the server in ServerHello. |
| 164 IPEndPoint local_address_from_shlo_; | 154 IPEndPoint local_address_from_shlo_; |
| 165 // The first local address from which a packet was received. | 155 // The first local address from which a packet was received. |
| 166 IPEndPoint local_address_from_self_; | 156 IPEndPoint local_address_from_self_; |
| 167 // Count of the number of frames received. | 157 // Count of the number of frames received. |
| 168 int num_frames_received_; | 158 int num_frames_received_; |
| 169 // Count of the number of duplicate frames received. | 159 // Count of the number of duplicate frames received. |
| 170 int num_duplicate_frames_received_; | 160 int num_duplicate_frames_received_; |
| 171 // Count of the number of packets received with incorrect connection IDs. | 161 // Count of the number of packets received with incorrect connection IDs. |
| 172 int num_incorrect_connection_ids_; | 162 int num_incorrect_connection_ids_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 192 // Receives notifications regarding the performance of the underlying socket | 182 // Receives notifications regarding the performance of the underlying socket |
| 193 // for the QUIC connection. May be null. | 183 // for the QUIC connection. May be null. |
| 194 const std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher_; | 184 const std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher_; |
| 195 | 185 |
| 196 DISALLOW_COPY_AND_ASSIGN(QuicConnectionLogger); | 186 DISALLOW_COPY_AND_ASSIGN(QuicConnectionLogger); |
| 197 }; | 187 }; |
| 198 | 188 |
| 199 } // namespace net | 189 } // namespace net |
| 200 | 190 |
| 201 #endif // NET_QUIC_QUIC_CONNECTION_LOGGER_H_ | 191 #endif // NET_QUIC_QUIC_CONNECTION_LOGGER_H_ |
| OLD | NEW |