提交 3f6cccaa 编写于 作者: A alexey-milovidov 提交者: GitHub

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

Add performance test
......@@ -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 ()
此差异已折叠。
<?xml version="1.0"?>
<profiles>
<default></default>
<single_thread>
<max_threads>1</max_threads>
</single_thread>
</profiles>
\ No newline at end of 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>
......
......@@ -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);
......
......@@ -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
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册