-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathh2load_stats.h
More file actions
140 lines (124 loc) · 4.03 KB
/
h2load_stats.h
File metadata and controls
140 lines (124 loc) · 4.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#ifndef H2LOAD_STAT_H
#define H2LOAD_STAT_H
#include <chrono>
#include <atomic>
#include <vector>
namespace h2load
{
struct RequestStat
{
// time point when request was sent
std::chrono::steady_clock::time_point request_time;
// same, but in wall clock reference frame
std::chrono::system_clock::time_point request_wall_time;
// time point when stream was closed
std::chrono::steady_clock::time_point stream_close_time;
// upload data length sent so far
int64_t data_offset;
// HTTP status code
int status;
// true if stream was successfully closed. This means stream was
// not reset, but it does not mean HTTP level error (e.g., 404).
bool completed;
size_t scenario_index;
size_t request_index;
explicit RequestStat(size_t scenario_id, size_t request_id):
scenario_index(scenario_id),
request_index(request_id),
status(0x1FFF)
{};
};
struct ClientStat
{
// time client started (i.e., first connect starts)
std::chrono::steady_clock::time_point client_start_time;
// time client end (i.e., client somehow processed all requests it
// is responsible for, and disconnected)
std::chrono::steady_clock::time_point client_end_time;
// The number of requests completed successful, but not necessarily
// means successful HTTP status code.
size_t req_success;
// The following 3 numbers are overwritten each time when connection
// is made.
// time connect starts
std::chrono::steady_clock::time_point connect_start_time;
// time to connect
std::chrono::steady_clock::time_point connect_time;
// time to first byte (TTFB)
std::chrono::steady_clock::time_point ttfb;
ClientStat()
{
req_success = 0;
}
};
struct SDStat
{
// min, max, mean and sd (standard deviation)
double min, max, mean, sd;
// percentage of samples inside mean -/+ sd
double within_sd;
};
struct SDStats
{
// time for request
SDStat request;
// time for connect
SDStat connect;
// time to first byte (TTFB)
SDStat ttfb;
// request per second for each client
SDStat rps;
};
struct Stats
{
Stats(size_t req_todo, size_t nclients);
// The total number of requests
size_t req_todo;
// The number of requests issued so far
size_t req_started;
// The number of requests finished
size_t req_done;
// The number of requests completed successful, but not necessarily
// means successful HTTP status code.
size_t req_success;
// The number of requests marked as success. HTTP status code is
// also considered as success. This is subset of req_done.
size_t req_status_success;
// The number of requests failed. This is subset of req_done.
size_t req_failed;
// The number of requests failed due to network errors. This is
// subset of req_failed.
size_t req_error;
// The number of requests that failed due to timeout.
size_t req_timedout;
// The number of bytes received on the "wire". If SSL/TLS is used,
// this is the number of decrypted bytes the application received.
int64_t bytes_total;
// The number of bytes received for header fields. This is
// compressed version.
int64_t bytes_head;
// The number of bytes received for header fields after they are
// decompressed.
int64_t bytes_head_decomp;
// The number of bytes received in DATA frame.
int64_t bytes_body;
// The number of each HTTP status category, status[i] is status code
// in the range [i*100, (i+1)*100).
std::array<size_t, 6> status;
// The statistics per request
std::vector<RequestStat> req_stats;
// The statistics per client
std::vector<ClientStat> client_stats;
// std::atomic<uint64_t> max_resp_time_ms;
// std::atomic<uint64_t> min_resp_time_ms;
// std::atomic<uint64_t> total_resp_time_ms;
};
struct Stream
{
RequestStat req_stat;
int status_success;
bool statistics_eligible;
Stream(size_t scenario_id, size_t request_id, bool stat_eligible);
};
}
#endif