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 { ...@@ -94,21 +94,21 @@ struct RequestStat {
bool completed; 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 { struct TimeStats {
// time for request: max, min, mean and sd (standard deviation) // time for request
std::chrono::microseconds request_time_max, request_time_min, TimeStat<std::chrono::microseconds> request;
request_time_mean, request_time_sd; // time for connect
// percentage of number of requests inside mean -/+ sd TimeStat<std::chrono::microseconds> connect;
double request_within_sd; // time to first byte (TTFB)
// time for connect: max, min, mean and sd (standard deviation) TimeStat<std::chrono::microseconds> ttfb;
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 }; enum TimeStatType { STAT_REQUEST, STAT_CONNECT, STAT_FIRST_BYTE };
...@@ -148,8 +148,8 @@ struct Stats { ...@@ -148,8 +148,8 @@ struct Stats {
std::vector<std::chrono::steady_clock::time_point> start_times; std::vector<std::chrono::steady_clock::time_point> start_times;
// time to connect // time to connect
std::vector<std::chrono::steady_clock::time_point> connect_times; std::vector<std::chrono::steady_clock::time_point> connect_times;
// time to first byte // time to first byte (TTFB)
std::vector<std::chrono::steady_clock::time_point> time_to_first_bytes; std::vector<std::chrono::steady_clock::time_point> ttfbs;
}; };
enum ClientState { CLIENT_IDLE, CLIENT_CONNECTED }; enum ClientState { CLIENT_IDLE, CLIENT_CONNECTED };
...@@ -236,7 +236,7 @@ struct Client { ...@@ -236,7 +236,7 @@ struct Client {
void record_request_time(RequestStat *req_stat); void record_request_time(RequestStat *req_stat);
void record_start_time(Stats *stat); void record_start_time(Stats *stat);
void record_connect_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(); 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