pipeline.lua 592 B

12345678910111213141516171819202122232425262728293031323334
  1. local pipelineDepth = 1
  2. local counter = 0
  3. local maxRequests = -1
  4. function init(args)
  5. if args[1] ~= nil then
  6. pipelineDepth = tonumber(args[1])
  7. end
  8. local r = {}
  9. for i = 1, pipelineDepth, 1 do
  10. r[i] = wrk.format(nil)
  11. end
  12. print("Pipeline depth: " .. pipelineDepth)
  13. if args[2] ~= nil then
  14. maxRequests = tonumber(args[2])
  15. print("Max requests: " .. maxRequests)
  16. end
  17. req = table.concat(r)
  18. end
  19. function request()
  20. return req
  21. end
  22. function response()
  23. if counter == maxRequests then
  24. wrk.thread:stop()
  25. end
  26. counter = counter + 1
  27. end