Removed some garbage from PerformanceTest [#CLICKHOUSE-3281].

This commit is contained in:
Alexey Milovidov 2017-09-06 05:25:01 +03:00 committed by alexey-milovidov
parent e1e0d517aa
commit 9290d26c58

View File

@ -74,7 +74,7 @@ public:
bool reserved = (value[0] == '[' || value[0] == '{' || value == "null"); bool reserved = (value[0] == '[' || value[0] == '{' || value == "null");
if (!reserved && wrap) if (!reserved && wrap)
value = '\"' + value + '\"'; value = '"' + value + '"';
content[key] = value; content[key] = value;
} }
@ -115,7 +115,7 @@ public:
if (it != content.begin()) if (it != content.begin())
repr += ','; repr += ',';
/// construct "key": "value" string with padding /// construct "key": "value" string with padding
repr += "\n" + pad(padding) + '\"' + it->first + '\"' + ": " + it->second; repr += "\n" + pad(padding) + '"' + it->first + '"' + ": " + it->second;
} }
repr += "\n" + pad(padding - 1) + '}'; repr += "\n" + pad(padding - 1) + '}';
@ -380,7 +380,8 @@ struct Stats
double & avg_speed_value) double & avg_speed_value)
{ {
avg_speed_value = ((avg_speed_value * number_of_info_batches) + new_speed_info); avg_speed_value = ((avg_speed_value * number_of_info_batches) + new_speed_info);
avg_speed_value /= (++number_of_info_batches); ++number_of_info_batches;
avg_speed_value /= number_of_info_batches;
if (avg_speed_first == 0) if (avg_speed_first == 0)
{ {
@ -670,12 +671,14 @@ private:
for (const String & precondition : preconditions) for (const String & precondition : preconditions)
{ {
if (precondition == "flush_disk_cache") if (precondition == "flush_disk_cache")
{
if (system( if (system(
"(>&2 echo 'Flushing disk cache...') && (sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches') && (>&2 echo 'Flushed.')")) "(>&2 echo 'Flushing disk cache...') && (sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches') && (>&2 echo 'Flushed.')"))
{ {
std::cerr << "Failed to flush disk cache" << std::endl; std::cerr << "Failed to flush disk cache" << std::endl;
return false; return false;
} }
}
if (precondition == "ram_size") if (precondition == "ram_size")
{ {
@ -753,7 +756,7 @@ private:
{ {
if (!checkPreconditions(test_config)) if (!checkPreconditions(test_config))
{ {
std::cerr << "Preconditions are not fulfilled for test \"" + test_config->getString("name", "") + "\" "; std::cerr << "Preconditions are not fulfilled for test '" + test_config->getString("name", "") + "' ";
continue; continue;
} }
@ -1222,7 +1225,7 @@ public:
String array_string = "["; String array_string = "[";
for (size_t i = 0; i != values.size(); ++i) for (size_t i = 0; i != values.size(); ++i)
{ {
array_string += '\"' + values[i] + '\"'; array_string += '"' + values[i] + '"';
if (i != values.size() - 1) if (i != values.size() - 1)
{ {
array_string += ", "; array_string += ", ";
@ -1360,7 +1363,7 @@ public:
static void getFilesFromDir(const FS::path & dir, std::vector<String> & input_files, const bool recursive = false) static void getFilesFromDir(const FS::path & dir, std::vector<String> & input_files, const bool recursive = false)
{ {
if (dir.extension().string() == ".xml") if (dir.extension().string() == ".xml")
std::cerr << "Warning: \"" + dir.string() + "\" is a directory, but has .xml extension" << std::endl; std::cerr << "Warning: '" + dir.string() + "' is a directory, but has .xml extension" << std::endl;
FS::directory_iterator end; FS::directory_iterator end;
for (FS::directory_iterator it(dir); it != end; ++it) for (FS::directory_iterator it(dir); it != end; ++it)
@ -1445,7 +1448,7 @@ int mainEntryClickHousePerformanceTest(int argc, char ** argv)
FS::path file(filename); FS::path file(filename);
if (!FS::exists(file)) if (!FS::exists(file))
throw DB::Exception("File \"" + filename + "\" does not exist", 1); throw DB::Exception("File '" + filename + "' does not exist", 1);
if (FS::is_directory(file)) if (FS::is_directory(file))
{ {
@ -1455,7 +1458,7 @@ int mainEntryClickHousePerformanceTest(int argc, char ** argv)
else else
{ {
if (file.extension().string() != ".xml") if (file.extension().string() != ".xml")
throw DB::Exception("File \"" + filename + "\" does not have .xml extension", 1); throw DB::Exception("File '" + filename + "' does not have .xml extension", 1);
} }
} }
} }