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 <bitset> | |
9 | |
8 #include "net/base/ip_endpoint.h" | 10 #include "net/base/ip_endpoint.h" |
11 #include "net/base/network_change_notifier.h" | |
9 #include "net/quic/quic_connection.h" | 12 #include "net/quic/quic_connection.h" |
10 #include "net/quic/quic_protocol.h" | 13 #include "net/quic/quic_protocol.h" |
11 | 14 |
12 namespace net { | 15 namespace net { |
13 | 16 |
14 class CryptoHandshakeMessage; | 17 class CryptoHandshakeMessage; |
15 | 18 |
16 // This class is a debug visitor of a QuicConnection which logs | 19 // This class is a debug visitor of a QuicConnection which logs |
17 // events to |net_log|. | 20 // events to |net_log|. |
18 class NET_EXPORT_PRIVATE QuicConnectionLogger | 21 class NET_EXPORT_PRIVATE QuicConnectionLogger |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 base::StringPiece payload) OVERRIDE; | 56 base::StringPiece payload) OVERRIDE; |
54 | 57 |
55 void OnCryptoHandshakeMessageReceived( | 58 void OnCryptoHandshakeMessageReceived( |
56 const CryptoHandshakeMessage& message); | 59 const CryptoHandshakeMessage& message); |
57 void OnCryptoHandshakeMessageSent( | 60 void OnCryptoHandshakeMessageSent( |
58 const CryptoHandshakeMessage& message); | 61 const CryptoHandshakeMessage& message); |
59 void OnConnectionClosed(QuicErrorCode error, bool from_peer); | 62 void OnConnectionClosed(QuicErrorCode error, bool from_peer); |
60 void OnSuccessfulVersionNegotiation(const QuicVersion& version); | 63 void OnSuccessfulVersionNegotiation(const QuicVersion& version); |
61 | 64 |
62 private: | 65 private: |
66 // Do a factory get for an "Ack_" or "Nack_" style histogram for recording | |
67 // packet loss stats. | |
68 base::HistogramBase* GetAckHistogram(const char* ack_or_nack); | |
69 // At destruction time, this records results of |pacaket_received_| into | |
70 // histograms for specific connection types. | |
71 void RecordAckNackHistograms(); | |
72 | |
73 // The number of packets for which status is recorded. | |
74 static const size_t kMaxPacketStatus = 100; | |
75 | |
63 BoundNetLog net_log_; | 76 BoundNetLog net_log_; |
64 // The last packet sequence number received. | 77 // The last packet sequence number received. |
65 QuicPacketSequenceNumber last_received_packet_sequence_number_; | 78 QuicPacketSequenceNumber last_received_packet_sequence_number_; |
66 // The largest packet sequence number received. In case of that a packet is | 79 // The largest packet sequence number received. In case of that a packet is |
67 // received late, this value will not be updated. | 80 // received late, this value will not be updated. |
68 QuicPacketSequenceNumber largest_received_packet_sequence_number_; | 81 QuicPacketSequenceNumber largest_received_packet_sequence_number_; |
69 // The largest packet sequence number which the peer has failed to | 82 // The largest packet sequence number which the peer has failed to |
70 // receive, according to the missing packet set in their ack frames. | 83 // receive, according to the missing packet set in their ack frames. |
71 QuicPacketSequenceNumber largest_received_missing_packet_sequence_number_; | 84 QuicPacketSequenceNumber largest_received_missing_packet_sequence_number_; |
72 // Number of times that the current received packet sequence number is | 85 // Number of times that the current received packet sequence number is |
73 // smaller than the last received packet sequence number. | 86 // smaller than the last received packet sequence number. |
74 size_t out_of_order_recieved_packet_count_; | 87 size_t out_of_order_recieved_packet_count_; |
75 // Number of times a truncated ACK frame was sent. | 88 // Number of times a truncated ACK frame was sent. |
76 size_t num_truncated_acks_sent_; | 89 size_t num_truncated_acks_sent_; |
77 // Number of times a truncated ACK frame was received. | 90 // Number of times a truncated ACK frame was received. |
78 size_t num_truncated_acks_received_; | 91 size_t num_truncated_acks_received_; |
79 // The kCADR value provided by the server in ServerHello. | 92 // The kCADR value provided by the server in ServerHello. |
80 IPEndPoint client_address_; | 93 IPEndPoint client_address_; |
94 // Vector of inital packets status' indexed by packet sequence numbers, where | |
95 // false means never received. Zero is not a valid packet sequence number, so | |
96 // that offset is never really used. | |
Ryan Hamilton
2014/03/07 17:47:05
nit: s/really//
jar (doing other things)
2014/03/07 18:01:11
Done.
| |
97 std::bitset<kMaxPacketStatus + 1> packets_received_; | |
98 // The available type of connection (WiFi, 3G, etc.) when connection was first | |
99 // used. | |
100 NetworkChangeNotifier::ConnectionType connection_type_; | |
81 DISALLOW_COPY_AND_ASSIGN(QuicConnectionLogger); | 101 DISALLOW_COPY_AND_ASSIGN(QuicConnectionLogger); |
82 }; | 102 }; |
83 | 103 |
84 } // namespace net | 104 } // namespace net |
85 | 105 |
86 #endif // NET_QUIC_QUIC_CONNECTION_LOGGER_H_ | 106 #endif // NET_QUIC_QUIC_CONNECTION_LOGGER_H_ |
OLD | NEW |