Add two examples of custom lua cpu tests

This commit is contained in:
Tiago Henriques
2017-06-28 17:20:07 +02:00
parent 1788acbc47
commit 7312515be0
2 changed files with 61 additions and 0 deletions

24
src/lua/empty-test.lua Normal file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env sysbench
-- you can run this script like this:
-- $ ./empty-test.lua --cpu-max-prime=20000 --threads=8 --histogram --report-interval=1 run
sysbench.cmdline.options = {
-- the default values for built-in options are currently ignored, see
-- https://github.com/akopytov/sysbench/issues/151
["cpu-max-prime"] = {"CPU maximum prime", 10000},
["threads"] = {"Number of threads", 2},
["histogram"] = {"Show histogram", "on"},
["report-interval"] = {"Report interval", 1}
}
function event()
end
function sysbench.hooks.report_intermediate(stat)
local seconds = stat.time_interval
print(string.format("%.0f;%u;%4.2f",
stat.time_total,
stat.threads_running,
stat.events / seconds))
end