1 Star 0 Fork 0

github7972/wrk

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
addr.lua 504 Bytes
一键复制 编辑 原始数据 按行查看 历史
Will 提交于 2015-02-07 16:03 +08:00 . add script setup() and thread methods
-- example script that demonstrates use of setup() to pass
-- a random server address to each thread
local addrs = nil
function setup(thread)
if not addrs then
addrs = wrk.lookup(wrk.host, wrk.port or "http")
for i = #addrs, 1, -1 do
if not wrk.connect(addrs[i]) then
table.remove(addrs, i)
end
end
end
thread.addr = addrs[math.random(#addrs)]
end
function init(args)
local msg = "thread addr: %s"
print(msg:format(wrk.thread.addr))
end
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/github7972/wrk.git
git@gitee.com:github7972/wrk.git
github7972
wrk
wrk
master

搜索帮助