Commit 555d5aba authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Merge branch 'finer_stats' of https://github.com/ericcarlschwartz/nghttp2 into...

Merge branch 'finer_stats' of https://github.com/ericcarlschwartz/nghttp2 into ericcarlschwartz-finer_stats
parents 7b3a33a3 4bba4bf6
This diff is collapsed.
......@@ -87,7 +87,7 @@ struct RequestStat {
std::chrono::steady_clock::time_point request_time;
// time point when stream was closed
std::chrono::steady_clock::time_point stream_close_time;
// upload data length sent so far
// upload data length sent so far
int64_t data_offset;
// true if stream was successfully closed. This means stream was
// not reset, but it does not mean HTTP level error (e.g., 404).
......@@ -96,11 +96,21 @@ struct RequestStat {
struct TimeStats {
// time for request: max, min, mean and sd (standard deviation)
std::chrono::microseconds time_max, time_min, time_mean, time_sd;
std::chrono::microseconds request_time_max, request_time_min, request_time_mean, request_time_sd;
// percentage of number of requests inside mean -/+ sd
double within_sd;
double request_within_sd;
// time for connect: max, min, mean and sd (standard deviation)
std::chrono::microseconds connect_time_max, connect_time_min, connect_time_mean, connect_time_sd;
// percentage of number of connects inside mean -/+ sd
double connect_within_sd;
// time to first byte: max, min, mean and sd (standard deviation)
std::chrono::microseconds ttfb_max, ttfb_min, ttfb_mean, ttfb_sd;
// percentage of number of connects inside mean -/+ sd
double ttfb_within_sd;
};
enum TimeStatType { STAT_REQUEST, STAT_CONNECT, STAT_FIRST_BYTE };
struct Stats {
Stats(size_t req_todo);
// The total number of requests
......@@ -132,6 +142,12 @@ struct Stats {
std::array<size_t, 6> status;
// The statistics per request
std::vector<RequestStat> req_stats;
// time connect starts
std::vector<std::chrono::steady_clock::time_point> start_times;
// time to connect
std::vector<std::chrono::steady_clock::time_point> connect_times;
// time to first byte
std::vector<std::chrono::steady_clock::time_point> time_to_first_bytes;
};
enum ClientState { CLIENT_IDLE, CLIENT_CONNECTED };
......@@ -171,6 +187,7 @@ struct Client {
addrinfo *next_addr;
size_t reqidx;
ClientState state;
bool first_byte_received;
// The number of requests this client has to issue.
size_t req_todo;
// The number of requests this client has issued so far.
......@@ -215,6 +232,9 @@ struct Client {
void on_stream_close(int32_t stream_id, bool success, RequestStat *req_stat);
void record_request_time(RequestStat *req_stat);
void record_start_time(Stats *stat);
void record_connect_time(Stats *stat);
void record_time_to_first_byte(Stats *stat);
void signal_write();
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment