2017-12-11 18:23:10 -08:00
|
|
|
local modpath = minetest.get_modpath("benchmark")
|
|
|
|
|
2017-12-12 11:47:13 -08:00
|
|
|
local printall = function(string)
|
|
|
|
minetest.chat_send_all(string)
|
|
|
|
print(string)
|
|
|
|
end
|
|
|
|
|
2017-12-11 18:23:10 -08:00
|
|
|
minetest.register_chatcommand("benchmark", {
|
|
|
|
params = "",
|
|
|
|
description = "Benchmark the server (will stop everything for ~15 seconds)",
|
|
|
|
func = function(name, param)
|
|
|
|
if minetest.check_player_privs(name, {server=true}) then
|
2017-12-12 11:47:13 -08:00
|
|
|
printall("Starting Pi Benchmark")
|
|
|
|
local calpi = dofile(modpath .. "/calpi.lua")
|
|
|
|
printall("Pi took " .. calpi .. " seconds.")
|
|
|
|
|
|
|
|
--printall("Starting Mapgen Benchmark")
|
|
|
|
--local mapgen = dofile(modpath .. "/mapgen.lua")
|
|
|
|
--printall("Mapgen took: " .. mapgen .. "seconds.")
|
|
|
|
|
2017-12-11 18:23:10 -08:00
|
|
|
return true, "Done."
|
|
|
|
else return false, "Operation not permitted"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|