-
Notifications
You must be signed in to change notification settings - Fork 354
/
Copy pathreport.lua
34 lines (30 loc) · 1007 Bytes
/
report.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
done = function(summary, latency, requests)
local report="result.csv"
local f=io.open(report,"r")
if f~=nil then
io.close(f)
else
f = io.open(report, "a+")
f:write("min,max,mean,stdev,p50,p90,p99,p99999,duration,requests,bytes\n")
io.close(f)
end
-- open output file
f = io.open(report, "a+")
-- write below results to file
-- minimum latency
-- max latency
-- mean of latency
-- standard deviation of latency
-- 50percentile latency
-- 90percentile latency
-- 99percentile latency
-- 99.999percentile latency
-- duration of the benchmark
-- total requests during the benchmark
-- total received bytes during the benchmark
f:write(string.format("%f,%f,%f,%f,%f,%f,%f,%f,%d,%d,%d\n",
latency.min, latency.max, latency.mean, latency.stdev, latency:percentile(50),
latency:percentile(90), latency:percentile(99), latency:percentile(99.999),
summary["duration"], summary["requests"], summary["bytes"]))
f:close()
end