ClickHouse/dbms/programs/performance-test/PerformanceTest.h

65 lines
1.4 KiB
C++
Raw Normal View History

#pragma once
#include <Client/Connection.h>
#include <Common/InterruptListener.h>
2019-01-28 11:20:44 +00:00
#include <common/logger_useful.h>
#include <Poco/Util/XMLConfiguration.h>
#include "PerformanceTestInfo.h"
namespace DB
{
using XMLConfiguration = Poco::Util::XMLConfiguration;
using XMLConfigurationPtr = Poco::AutoPtr<XMLConfiguration>;
using QueriesWithIndexes = std::vector<std::pair<std::string, size_t>>;
class PerformanceTest
{
public:
PerformanceTest(
const XMLConfigurationPtr & config_,
Connection & connection_,
InterruptListener & interrupt_listener_,
2019-01-28 11:20:44 +00:00
const PerformanceTestInfo & test_info_,
2019-02-04 17:37:55 +00:00
Context & context_,
const std::vector<size_t> & queries_to_run_);
bool checkPreconditions() const;
void prepare() const;
std::vector<TestStats> execute();
void finish() const;
const PerformanceTestInfo & getTestInfo() const
{
return test_info;
}
bool checkSIGINT() const
{
return got_SIGINT;
}
private:
void runQueries(
const QueriesWithIndexes & queries_with_indexes,
std::vector<TestStats> & statistics_by_run);
UInt64 calculateMaxExecTime() const;
private:
XMLConfigurationPtr config;
Connection & connection;
InterruptListener & interrupt_listener;
PerformanceTestInfo test_info;
2019-01-28 11:20:44 +00:00
Context & context;
2019-02-04 17:37:55 +00:00
std::vector<size_t> queries_to_run;
2019-01-28 11:20:44 +00:00
Poco::Logger * log;
bool got_SIGINT = false;
};
}