summaryrefslogtreecommitdiff
path: root/caching-tests/bench.lua
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2015-12-20 14:18:52 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2015-12-20 14:18:52 -0500
commit68b355524cc20056d8c059138be225aaa9762e0a (patch)
tree6c9a407a965d2cdd5f30815cc3e642a6f9b3d451 /caching-tests/bench.lua
parent7bf4f9f063dcdc9fc50ad6ac6143b113535b68f0 (diff)
parent0271786bacdf9c12a142367a479b24ba111ebd17 (diff)
Merge Sqlcache
Diffstat (limited to 'caching-tests/bench.lua')
-rw-r--r--caching-tests/bench.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/caching-tests/bench.lua b/caching-tests/bench.lua
new file mode 100644
index 00000000..6799ca87
--- /dev/null
+++ b/caching-tests/bench.lua
@@ -0,0 +1,25 @@
+math.randomseed(os.time())
+
+p = 0.25
+n = 2000
+
+function init(args)
+ if args[1] then
+ p = tonumber(args[1])
+ end
+ if args[2] then
+ n = tonumber(args[2])
+ end
+end
+
+function request()
+ path = "/Bench/"
+ if math.random() < p then
+ path = path .. "flush"
+ else
+ path = path .. "check"
+ end
+ id = math.random(n)
+ path = path .. "/" .. id
+ return wrk.format(nil, path)
+end