-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreport.lua
More file actions
48 lines (41 loc) · 946 Bytes
/
report.lua
File metadata and controls
48 lines (41 loc) · 946 Bytes
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function sum(t)
local sum = 0
for k,v in pairs(t) do
sum = sum + v
end
return sum
end
reqPerSec = function(summary)
return summary['requests'] * 1000000 / summary['duration']
end
timeoutsErrors = function(summary)
return summary['errors']['timeout']
end
allErrors = function(summary)
return sum(summary['errors'])
end
KBPerSec = function(summary)
return (summary['bytes'] / 1000) * 1000000 / summary['duration']
end
title = function()
return os.getenv("TITLE")
end
delay = function()
return os.getenv("DELAY")
end
done = function(summary, latency, requests)
line = string.format(
"\"%s\",%i,%f,%f,%f,%f,%i,%i\n",
title(),
delay(),
reqPerSec(summary),
KBPerSec(summary),
latency.mean,
latency.stdev,
timeoutsErrors(summary),
allErrors(summary)
)
file = io.open ('./artifacts/results.csv', 'a')
file:write(line)
file:close();
end