Improve status messages, add initial mapgen benchmark (broken, do not use)
parent
1fa725cb36
commit
b958af6424
|
@ -16,5 +16,4 @@ start = os.clock()
|
|||
calpi()
|
||||
stop = os.clock()
|
||||
|
||||
print(stop - start)
|
||||
return (stop - start)
|
15
init.lua
15
init.lua
|
@ -1,12 +1,23 @@
|
|||
local modpath = minetest.get_modpath("benchmark")
|
||||
|
||||
local printall = function(string)
|
||||
minetest.chat_send_all(string)
|
||||
print(string)
|
||||
end
|
||||
|
||||
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
|
||||
local benchmark = dofile(modpath .. "/benchmark.lua")
|
||||
minetest.chat_send_all(benchmark)
|
||||
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.")
|
||||
|
||||
return true, "Done."
|
||||
else return false, "Operation not permitted"
|
||||
end
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
local sleep = function(time)
|
||||
while os.time() ~= (start+time) do end
|
||||
end
|
||||
|
||||
local start = os.time()
|
||||
|
||||
minetest.emerge_area({x=30000, y=0, z=30000}, {x=29990, y=0, z=29990})
|
||||
|
||||
while (not minetest.get_node_or_nil({x=29990, 0, 29990})) do
|
||||
sleep(1)
|
||||
end
|
||||
|
||||
stop = os.time()
|
||||
|
||||
return (stop - start)
|
Loading…
Reference in New Issue