1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef NET_QUIC_QUIC_CONNECTION_STATS_H_
6#define NET_QUIC_QUIC_CONNECTION_STATS_H_
7
8#include <ostream>
9
10#include "base/basictypes.h"
11#include "net/base/net_export.h"
12#include "net/quic/quic_time.h"
13
14namespace net {
15// Structure to hold stats for a QuicConnection.
16struct NET_EXPORT_PRIVATE QuicConnectionStats {
17  QuicConnectionStats();
18  ~QuicConnectionStats();
19
20  NET_EXPORT_PRIVATE friend std::ostream& operator<<(
21      std::ostream& os, const QuicConnectionStats& s);
22
23  uint64 bytes_sent;  // Includes retransmissions, fec.
24  uint32 packets_sent;
25  uint64 stream_bytes_sent;  // non-retransmitted bytes sent in a stream frame.
26  uint32 packets_discarded;  // Packets serialized and discarded before sending.
27
28  // These include version negotiation and public reset packets, which do not
29  // have sequence numbers or frame data.
30  uint64 bytes_received;  // Includes duplicate data for a stream, fec.
31  uint32 packets_received;  // Includes packets which were not processable.
32  uint32 packets_processed;  // Excludes packets which were not processable.
33  uint64 stream_bytes_received;  // Bytes received in a stream frame.
34
35  uint64 bytes_retransmitted;
36  uint32 packets_retransmitted;
37
38  uint64 bytes_spuriously_retransmitted;
39  uint32 packets_spuriously_retransmitted;
40  // Number of packets abandoned as lost by the loss detection algorithm.
41  uint32 packets_lost;
42  uint32 slowstart_packets_lost;  // Number of packets lost exiting slow start.
43
44  uint32 packets_revived;
45  uint32 packets_dropped;  // Duplicate or less than least unacked.
46  uint32 crypto_retransmit_count;
47  // Count of times the loss detection alarm fired.  At least one packet should
48  // be lost when the alarm fires.
49  uint32 loss_timeout_count;
50  uint32 tlp_count;
51  uint32 rto_count;  // Count of times the rto timer fired.
52  uint32 spurious_rto_count;
53
54  uint32 min_rtt_us;  // Minimum RTT in microseconds.
55  uint32 srtt_us;  // Smoothed RTT in microseconds.
56  uint32 max_packet_size;  // In bytes.
57  uint64 estimated_bandwidth;  // In bytes per second.
58  uint32 congestion_window;  // In bytes
59  uint32 slow_start_threshold;  // In bytes
60
61  // Reordering stats for received packets.
62  // Number of packets received out of sequence number order.
63  uint32 packets_reordered;
64  // Maximum reordering observed in sequence space.
65  uint32 max_sequence_reordering;
66  // Maximum reordering observed in microseconds
67  uint32 max_time_reordering_us;
68
69  // The following stats are used only in TcpCubicSender.
70  // The number of loss events from TCP's perspective.  Each loss event includes
71  // one or more lost packets.
72  uint32 tcp_loss_events;
73  // Total amount of cwnd increase by TCPCubic in congestion avoidance.
74  uint32 cwnd_increase_congestion_avoidance;
75  // Total amount of cwnd increase by TCPCubic in cubic mode.
76  uint32 cwnd_increase_cubic_mode;
77
78  // Creation time, as reported by the QuicClock.
79  QuicTime connection_creation_time;
80};
81
82}  // namespace net
83
84#endif  // NET_QUIC_QUIC_CONNECTION_STATS_H_
85