Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit acbac5a

Browse files
committed
Show statistics in bench results
1 parent 65b32d2 commit acbac5a

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

test/bench/bench.lua

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ local function workload(shard, bench_prepare, bench_iter, opts)
4949

5050
-- first iteration; print result and update checksum
5151
local result = bench_iter(state)
52+
local statistics = result.meta.statistics
5253
local result_str = yaml.encode(result.data)
5354
checksum:update(result_str .. '1')
5455

@@ -88,6 +89,7 @@ local function workload(shard, bench_prepare, bench_iter, opts)
8889
duration_successive = duration,
8990
latency_successive_avg = latency_avg,
9091
rps_successive_avg = rps_avg,
92+
statistics = statistics,
9193
}
9294
end
9395

@@ -98,13 +100,33 @@ local function write_result(test_name, conf_name, bench_result, to_file)
98100
result_name = ('%s.%s'):format(result_name, result_suffix)
99101
end
100102

103+
local metrics = {
104+
'duration_successive',
105+
'latency_successive_avg',
106+
'rps_successive_avg',
107+
'statistics.resulting_object_cnt',
108+
'statistics.fetches_cnt',
109+
'statistics.fetched_object_cnt',
110+
'statistics.full_scan_cnt',
111+
'statistics.index_lookup_cnt',
112+
'statistics.cache_hits_cnt',
113+
'statistics.cache_hit_objects_cnt',
114+
}
115+
101116
local result = ''
102-
result = result .. ('%s.duration_successive: %f\n'):format(
103-
result_name, bench_result.duration_successive)
104-
result = result .. ('%s.latency_successive_avg: %f\n'):format(
105-
result_name, bench_result.latency_successive_avg)
106-
result = result .. ('%s.rps_successive_avg: %f\n'):format(
107-
result_name, bench_result.rps_successive_avg)
117+
for _, metric in ipairs(metrics) do
118+
local value
119+
local value_type
120+
if metric:startswith('statistics.') then
121+
value = bench_result.statistics[metric:gsub('^.-%.', '')]
122+
value_type = '%d'
123+
else
124+
value = bench_result[metric]
125+
value_type = '%f'
126+
end
127+
result = result .. ('%s.%s: ' .. value_type .. '\n'):format(
128+
result_name, metric, value)
129+
end
108130

109131
if not to_file then
110132
print(result)

0 commit comments

Comments
 (0)