Commit cc46d363 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

h2load: Refactor statistics hanlding to scale more upcoming new metrics

parent fa082cbd
This diff is collapsed.
......@@ -94,21 +94,21 @@ struct RequestStat {
bool completed;
};
template<typename Duration>
struct TimeStat {
// min, max, mean and sd (standard deviation)
Duration min, max, mean, sd;
// percentage of samples inside mean -/+ sd
double within_sd;
};
struct TimeStats {
// time for request: max, min, mean and sd (standard deviation)
std::chrono::microseconds request_time_max, request_time_min,
request_time_mean, request_time_sd;
// percentage of number of requests inside mean -/+ 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;
// time for request
TimeStat<std::chrono::microseconds> request;
// time for connect
TimeStat<std::chrono::microseconds> connect;
// time to first byte (TTFB)
TimeStat<std::chrono::microseconds> ttfb;
};
enum TimeStatType { STAT_REQUEST, STAT_CONNECT, STAT_FIRST_BYTE };
......@@ -148,8 +148,8 @@ struct Stats {
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;
// time to first byte (TTFB)
std::vector<std::chrono::steady_clock::time_point> ttfbs;
};
enum ClientState { CLIENT_IDLE, CLIENT_CONNECTED };
......@@ -236,7 +236,7 @@ struct Client {
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 record_ttfb(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