Merge pull request #834 from luc1ph3r/Add-performance-test

Add performance test
This commit is contained in:
alexey-milovidov 2017-06-13 07:20:01 +03:00 committed by GitHub
commit 3f6cccaaa1
7 changed files with 1593 additions and 16 deletions

View File

@ -5,6 +5,9 @@ install (FILES config.xml DESTINATION ${CLICKHOUSE_ETC_DIR}/clickhouse-client CO
add_library (clickhouse-benchmark Benchmark.cpp)
target_link_libraries (clickhouse-benchmark dbms ${Boost_PROGRAM_OPTIONS_LIBRARY})
add_library (clickhouse-performance-test PerformanceTest.cpp)
target_link_libraries (clickhouse-performance-test dbms ${Boost_PROGRAM_OPTIONS_LIBRARY})
if (ENABLE_TESTS)
add_subdirectory (tests)
endif ()

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<profiles>
<default></default>
<single_thread>
<max_threads>1</max_threads>
</single_thread>
</profiles>

View File

@ -133,16 +133,22 @@ inline void appendToStringOrVector(PaddedPODArray<UInt8> & s, const char * begin
template <typename Vector>
void readStringInto(Vector & s, ReadBuffer & buf)
void readStringInto(Vector & s, ReadBuffer & buf, bool skip_whitespace)
{
while (!buf.eof())
{
size_t bytes = 0;
bool whitespace = false;
for (; buf.position() + bytes != buf.buffer().end(); ++bytes)
if (buf.position()[bytes] == '\t' || buf.position()[bytes] == '\n')
{
whitespace = true;
break;
}
appendToStringOrVector(s, buf.position(), buf.position() + bytes);
if (skip_whitespace && whitespace)
bytes += 1;
buf.position() += bytes;
if (buf.hasPendingData())
@ -150,13 +156,13 @@ void readStringInto(Vector & s, ReadBuffer & buf)
}
}
void readString(String & s, ReadBuffer & buf)
void readString(String & s, ReadBuffer & buf, bool skip_whitespace)
{
s.clear();
readStringInto(s, buf);
readStringInto(s, buf, skip_whitespace);
}
template void readStringInto<PaddedPODArray<UInt8>>(PaddedPODArray<UInt8> & s, ReadBuffer & buf);
template void readStringInto<PaddedPODArray<UInt8>>(PaddedPODArray<UInt8> & s, ReadBuffer & buf, bool skip_whitespace);
template <typename Vector>
@ -327,7 +333,7 @@ static void parseJSONEscapeSequence(Vector & s, ReadBuffer & buf)
template <typename Vector>
void readEscapedStringInto(Vector & s, ReadBuffer & buf)
void readEscapedStringInto(Vector & s, ReadBuffer & buf, bool skip_whitespace)
{
while (!buf.eof())
{
@ -339,22 +345,24 @@ void readEscapedStringInto(Vector & s, ReadBuffer & buf)
if (!buf.hasPendingData())
continue;
if (*buf.position() == '\t' || *buf.position() == '\n')
if (*buf.position() == '\t' || *buf.position() == '\n') {
buf.position() += 1;
return;
}
if (*buf.position() == '\\')
parseComplexEscapeSequence(s, buf);
}
}
void readEscapedString(String & s, ReadBuffer & buf)
void readEscapedString(String & s, ReadBuffer & buf, bool skip_whitespace)
{
s.clear();
readEscapedStringInto(s, buf);
readEscapedStringInto(s, buf, skip_whitespace);
}
template void readEscapedStringInto<PaddedPODArray<UInt8>>(PaddedPODArray<UInt8> & s, ReadBuffer & buf);
template void readEscapedStringInto<NullSink>(NullSink & s, ReadBuffer & buf);
template void readEscapedStringInto<PaddedPODArray<UInt8>>(PaddedPODArray<UInt8> & s, ReadBuffer & buf, bool skip_whitespace);
template void readEscapedStringInto<NullSink>(NullSink & s, ReadBuffer & buf, bool skip_whitespace);
template <char quote, typename Vector>

View File

@ -491,9 +491,9 @@ inline void readFloatText(T & x, ReadBuffer & buf)
}
/// rough; all until '\n' or '\t'
void readString(String & s, ReadBuffer & buf);
void readString(String & s, ReadBuffer & buf, bool skip_whitespace = false);
void readEscapedString(String & s, ReadBuffer & buf);
void readEscapedString(String & s, ReadBuffer & buf, bool skip_whitespace = false);
void readQuotedString(String & s, ReadBuffer & buf);
@ -522,10 +522,10 @@ void readCSVString(String & s, ReadBuffer & buf, const char delimiter = ',');
/// Read and append result to array of characters.
template <typename Vector>
void readStringInto(Vector & s, ReadBuffer & buf);
void readStringInto(Vector & s, ReadBuffer & buf, bool skip_whitespace = false);
template <typename Vector>
void readEscapedStringInto(Vector & s, ReadBuffer & buf);
void readEscapedStringInto(Vector & s, ReadBuffer & buf, bool skip_whitespace = false);
template <typename Vector>
void readQuotedStringInto(Vector & s, ReadBuffer & buf);

View File

@ -22,9 +22,9 @@ target_link_libraries(clickhouse
clickhouse-client
clickhouse-local
clickhouse-benchmark
clickhouse-performance-test
clickhouse-extract-from-config)
INSTALL(TARGETS clickhouse RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
# make symbolic links to concrete clickhouse applications
macro(install_symlink_to_clickhouse app)
INSTALL(CODE "execute_process(COMMAND ln -sf clickhouse ${app} WORKING_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}\" )" COMPONENT ${app})
@ -34,6 +34,7 @@ install_symlink_to_clickhouse(clickhouse-server)
install_symlink_to_clickhouse(clickhouse-client)
install_symlink_to_clickhouse(clickhouse-local)
install_symlink_to_clickhouse(clickhouse-benchmark)
install_symlink_to_clickhouse(clickhouse-performance-test)
INSTALL(
FILES config.xml users.xml

View File

@ -11,9 +11,9 @@ int mainEntryClickHouseServer(int argc, char ** argv);
int mainEntryClickHouseClient(int argc, char ** argv);
int mainEntryClickHouseLocal(int argc, char ** argv);
int mainEntryClickHouseBenchmark(int argc, char ** argv);
int mainEntryClickhousePerformanceTest(int argc, char ** argv);
int mainEntryClickHouseExtractFromConfig(int argc, char ** argv);
static bool isClickhouseApp(const std::string & app_suffix, std::vector<char *> & argv)
{
std::string arg_mode_app = "--" + app_suffix;
@ -54,6 +54,8 @@ int main(int argc_, char ** argv_)
main_func = mainEntryClickHouseBenchmark;
else if (isClickhouseApp("server", argv)) /// --server arg should be cut
main_func = mainEntryClickHouseServer;
else if (isClickhouseApp("performance-test", argv))
main_func = mainEntryClickhousePerformanceTest;
else if (isClickhouseApp("extract-from-config", argv))
main_func = mainEntryClickHouseExtractFromConfig;