2019-01-25 11:03:02 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Core/Types.h>
|
|
|
|
#include <limits>
|
|
|
|
#include <Common/Stopwatch.h>
|
|
|
|
#include <AggregateFunctions/ReservoirSampler.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
struct TestStats
|
|
|
|
{
|
2019-01-30 11:48:23 +00:00
|
|
|
TestStats();
|
2019-01-25 11:03:02 +00:00
|
|
|
Stopwatch watch;
|
|
|
|
Stopwatch watch_per_query;
|
|
|
|
Stopwatch min_time_watch;
|
|
|
|
|
|
|
|
bool last_query_was_cancelled = false;
|
2019-07-05 16:50:44 +00:00
|
|
|
std::string query_id;
|
2019-01-25 11:03:02 +00:00
|
|
|
|
|
|
|
size_t queries = 0;
|
|
|
|
|
|
|
|
size_t total_rows_read = 0;
|
|
|
|
size_t total_bytes_read = 0;
|
|
|
|
|
|
|
|
size_t last_query_rows_read = 0;
|
|
|
|
size_t last_query_bytes_read = 0;
|
|
|
|
|
|
|
|
using Sampler = ReservoirSampler<double>;
|
|
|
|
Sampler sampler{1 << 16};
|
|
|
|
|
|
|
|
/// min_time in ms
|
|
|
|
UInt64 min_time = std::numeric_limits<UInt64>::max();
|
|
|
|
double total_time = 0;
|
|
|
|
|
2019-01-28 16:20:29 +00:00
|
|
|
UInt64 max_rows_speed = 0;
|
|
|
|
UInt64 max_bytes_speed = 0;
|
2019-01-25 11:03:02 +00:00
|
|
|
|
|
|
|
double avg_rows_speed_value = 0;
|
|
|
|
double avg_rows_speed_first = 0;
|
2019-05-13 14:09:11 +00:00
|
|
|
static inline double avg_rows_speed_precision = 0.005;
|
2019-01-25 11:03:02 +00:00
|
|
|
|
|
|
|
double avg_bytes_speed_value = 0;
|
|
|
|
double avg_bytes_speed_first = 0;
|
2019-05-13 14:09:11 +00:00
|
|
|
static inline double avg_bytes_speed_precision = 0.005;
|
2019-01-25 11:03:02 +00:00
|
|
|
|
|
|
|
size_t number_of_rows_speed_info_batches = 0;
|
|
|
|
size_t number_of_bytes_speed_info_batches = 0;
|
|
|
|
|
2019-07-08 13:23:30 +00:00
|
|
|
UInt64 memory_usage = 0;
|
2019-07-05 16:50:44 +00:00
|
|
|
|
2019-01-25 11:03:02 +00:00
|
|
|
bool ready = false; // check if a query wasn't interrupted by SIGINT
|
2019-01-28 16:20:29 +00:00
|
|
|
std::string exception;
|
2019-01-25 11:03:02 +00:00
|
|
|
|
2019-01-28 16:20:29 +00:00
|
|
|
/// Hack, actually this field doesn't required for statistics
|
2019-01-25 18:35:16 +00:00
|
|
|
bool got_SIGINT = false;
|
|
|
|
|
2019-01-28 16:20:29 +00:00
|
|
|
std::string getStatisticByName(const std::string & statistic_name);
|
2019-01-25 11:03:02 +00:00
|
|
|
|
|
|
|
void update_min_time(UInt64 min_time_candidate);
|
|
|
|
|
|
|
|
void add(size_t rows_read_inc, size_t bytes_read_inc);
|
|
|
|
|
|
|
|
void updateQueryInfo();
|
|
|
|
|
|
|
|
void setTotalTime()
|
|
|
|
{
|
|
|
|
total_time = watch.elapsedSeconds();
|
|
|
|
}
|
|
|
|
|
2019-01-30 11:48:23 +00:00
|
|
|
void startWatches();
|
2019-01-25 11:03:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|