Skip to content

Instantly share code, notes, and snippets.

@ardentperf
Created January 19, 2023 06:34
Show Gist options
  • Save ardentperf/de7cdeec574cb31c7973b3caad5423ac to your computer and use it in GitHub Desktop.
Save ardentperf/de7cdeec574cb31c7973b3caad5423ac to your computer and use it in GitHub Desktop.
print a clear representation of a sysbench random distribution
function thread_init()
h = sysbench.histogram.new(1000, 1, 100)
end
function event()
h:update(sysbench.rand.default(1, 100))
end
function thread_done()
h:print()
end
-- command to run it
--$ sysbench /tmp/random.lua --time=1 --rand-type=zipfian --verbosity=0 run
--$ sysbench /tmp/random.lua --time=1 --rand-type=pareto --verbosity=0 run
--$ sysbench /tmp/random.lua --time=1 --rand-type=special --verbosity=0 run
--$ sysbench /tmp/random.lua --time=1 --rand-type=zipfian --rand-zipfian-exp=0 --verbosity=0 run
-- source https://github.com/Tusamarco/sysbench/blob/master/src/lua/test_random.lua
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment