This commit is contained in:
Alexander Kuzmenkov 2020-09-28 21:43:47 +03:00
parent 3d1456a55d
commit 6671b26f20
2 changed files with 15 additions and 7 deletions

View File

@ -198,7 +198,8 @@ function run_tests
echo test "$test_name"
# Don't profile if we're past the time limit.
profile_seconds=$((profile_seconds_left > 0 ? 10 : 0))
# Use awk because bash doesn't support floating point arithmetics.
profile_seconds=$(awk "BEGIN { print $profile_seconds_left > 0 ? 10 : 0 }")
TIMEFORMAT=$(printf "$test_name\t%%3R\t%%3U\t%%3S\n")
# The grep is to filter out set -x output and keep only time output.

View File

@ -130,17 +130,19 @@ if not args.long:
sys.exit(0)
# Print report threshold for the test if it is set.
ignored_change = 0.05
if 'max_ignored_relative_change' in root.attrib:
print(f'report-threshold\t{root.attrib["max_ignored_relative_change"]}')
ignored_change = float(root.attrib["max_ignored_relative_change"])
print(f'report-threshold\t{ignored_change}')
reportStageEnd('before-connect')
# Open connections
servers = [{'host': host, 'port': port} for (host, port) in zip(args.host, args.port)]
servers = [{'host': host or args.host[0], 'port': port or args.port[0]} for (host, port) in itertools.zip_longest(args.host, args.port)]
all_connections = [clickhouse_driver.Client(**server) for server in servers]
for s in servers:
print('server\t{}\t{}'.format(s['host'], s['port']))
for i, s in enumerate(servers):
print(f'server\t{i}\t{s["host"]}\t{s["port"]}')
reportStageEnd('connect')
@ -361,9 +363,14 @@ for query_index in queries_to_run:
if len(all_server_times) != 2:
continue
if len(all_server_times[0]) < 3:
# Don't fail if for some reason there are not enough measurements.
continue
pvalue = stats.ttest_ind(all_server_times[0], all_server_times[1], equal_var = False).pvalue
print(f'pvalue\t{pvalue}')
if pvalue > 0.05:
diff = statistics.median(all_server_times[1]) - statistics.median(all_server_times[0])
print(f'diff\t{diff}\t{pvalue}')
if abs(diff) < ignored_change or pvalue > 0.05:
continue
# Perform profile runs for fixed amount of time. Don't limit the number