-
Notifications
You must be signed in to change notification settings - Fork 4
/
wrk.lua
21 lines (17 loc) · 1.06 KB
/
wrk.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
done = function(summary, latency, requests)
io.write("--------------------------\n")
local durations=summary.duration / 1000000 -- 执行时间,单位是秒
local errors=summary.errors.status -- http status不是200,300开头的
local total=summary.requests -- 总的请求数
local valid=total-errors -- 有效请求数=总请求数-error请求数
io.write("Durations: "..string.format("%.2f",durations).."s".."\n")
io.write("Requests: "..summary.requests.."\n")
io.write("Avg RT: "..string.format("%.2f",latency.mean / 1000).."ms".."\n")
io.write("Max RT: "..(latency.max / 1000).."ms".."\n")
io.write("Min RT: "..(latency.min / 1000).."ms".."\n")
io.write("Error requests: "..errors.."\n")
io.write("Valid requests: "..valid.."\n")
io.write("MAX-QPS/THREAD: "..string.format("%.2f",requests.max).."\n")
io.write("AVG-QPS: "..string.format("%.2f",valid / durations).."\n")
io.write("--------------------------\n")
end