blob: 5317c7a6180898e13124f33749ca763bac021f4b [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// 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 QUICHE_QUIC_CORE_QUIC_CONNECTION_STATS_H_
6#define QUICHE_QUIC_CORE_QUIC_CONNECTION_STATS_H_
7
8#include <cstdint>
9#include <ostream>
10
11#include "net/third_party/quiche/src/quic/core/quic_bandwidth.h"
12#include "net/third_party/quiche/src/quic/core/quic_packets.h"
13#include "net/third_party/quiche/src/quic/core/quic_time.h"
14#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
15
16namespace quic {
17// Structure to hold stats for a QuicConnection.
18struct QUIC_EXPORT_PRIVATE QuicConnectionStats {
19 QuicConnectionStats();
20 QuicConnectionStats(const QuicConnectionStats& other);
21 ~QuicConnectionStats();
22
23 QUIC_EXPORT_PRIVATE friend std::ostream& operator<<(
24 std::ostream& os,
25 const QuicConnectionStats& s);
26
27 QuicByteCount bytes_sent; // Includes retransmissions.
28 QuicPacketCount packets_sent;
29 // Non-retransmitted bytes sent in a stream frame.
30 QuicByteCount stream_bytes_sent;
31 // Packets serialized and discarded before sending.
32 QuicPacketCount packets_discarded;
33
34 // These include version negotiation and public reset packets, which do not
35 // have packet numbers or frame data.
36 QuicByteCount bytes_received; // Includes duplicate data for a stream.
37 // Includes packets which were not processable.
38 QuicPacketCount packets_received;
39 // Excludes packets which were not processable.
40 QuicPacketCount packets_processed;
41 QuicByteCount stream_bytes_received; // Bytes received in a stream frame.
42
43 QuicByteCount bytes_retransmitted;
44 QuicPacketCount packets_retransmitted;
45
46 QuicByteCount bytes_spuriously_retransmitted;
47 QuicPacketCount packets_spuriously_retransmitted;
48 // Number of packets abandoned as lost by the loss detection algorithm.
49 QuicPacketCount packets_lost;
50
wub967ba572019-04-01 09:27:52 -070051 // Number of times this connection went through the slow start phase.
52 uint32_t slowstart_count;
53 // Number of round trips spent in slow start.
54 uint32_t slowstart_num_rtts;
QUICHE teama6ef0a62019-03-07 20:34:33 -050055 // Number of packets sent in slow start.
56 QuicPacketCount slowstart_packets_sent;
wub967ba572019-04-01 09:27:52 -070057 // Number of bytes sent in slow start.
58 QuicByteCount slowstart_bytes_sent;
QUICHE teama6ef0a62019-03-07 20:34:33 -050059 // Number of packets lost exiting slow start.
60 QuicPacketCount slowstart_packets_lost;
61 // Number of bytes lost exiting slow start.
62 QuicByteCount slowstart_bytes_lost;
wub967ba572019-04-01 09:27:52 -070063 // Time spent in COMPLETED slow start phases.
64 QuicTime::Delta slowstart_duration;
65 // Start time of the last slow start phase.
66 QuicTime slowstart_start_time;
QUICHE teama6ef0a62019-03-07 20:34:33 -050067
68 QuicPacketCount packets_dropped; // Duplicate or less than least unacked.
dschinazi6ece5002019-05-22 06:35:49 -070069
70 // Packets that failed to decrypt when they were first received.
71 QuicPacketCount undecryptable_packets_received;
72
QUICHE teama6ef0a62019-03-07 20:34:33 -050073 size_t crypto_retransmit_count;
74 // Count of times the loss detection alarm fired. At least one packet should
75 // be lost when the alarm fires.
76 size_t loss_timeout_count;
77 size_t tlp_count;
78 size_t rto_count; // Count of times the rto timer fired.
79
80 int64_t min_rtt_us; // Minimum RTT in microseconds.
81 int64_t srtt_us; // Smoothed RTT in microseconds.
82 QuicByteCount max_packet_size;
83 QuicByteCount max_received_packet_size;
84 QuicBandwidth estimated_bandwidth;
85
86 // Reordering stats for received packets.
87 // Number of packets received out of packet number order.
88 QuicPacketCount packets_reordered;
89 // Maximum reordering observed in packet number space.
90 QuicPacketCount max_sequence_reordering;
91 // Maximum reordering observed in microseconds
92 int64_t max_time_reordering_us;
93
94 // The following stats are used only in TcpCubicSender.
95 // The number of loss events from TCP's perspective. Each loss event includes
96 // one or more lost packets.
97 uint32_t tcp_loss_events;
98
99 // Creation time, as reported by the QuicClock.
100 QuicTime connection_creation_time;
101
102 uint64_t blocked_frames_received;
103 uint64_t blocked_frames_sent;
104
105 // Number of connectivity probing packets received by this connection.
106 uint64_t num_connectivity_probing_received;
107};
108
109} // namespace quic
110
111#endif // QUICHE_QUIC_CORE_QUIC_CONNECTION_STATS_H_