Skip to content

Instantly share code, notes, and snippets.

@bloatfan
Created January 7, 2018 12:30
Show Gist options
  • Save bloatfan/5159d04c330c7f3131eac65b7aeaea67 to your computer and use it in GitHub Desktop.
Save bloatfan/5159d04c330c7f3131eac65b7aeaea67 to your computer and use it in GitHub Desktop.
local threads = {}
setup = function (thread)
table.insert(threads, thread)
end
init = function (args)
results = {}
end
response = function (status, headers, body)
if (results[status] == nil) then
results[status] = 1
else
results[status] = results[status] + 1
end
end
done = function (summary, latency, requests)
local output = {}
for index, thread in ipairs(threads) do
local results = thread:get('results')
for status, count in pairs(results) do
if (output[status] == nil) then
output[status] = results[status]
else
output[status] = output[status] + results[status]
end
end
end
for status, count in pairs(output) do
print(status, ':', count)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment