mapgen profiler

master
NatureFreshMilk 2019-05-09 14:00:30 +02:00
parent 92f23a35e9
commit 4b17fbf119
2 changed files with 10 additions and 1 deletions

View File

@ -2,7 +2,8 @@
planetoidgen = {
miny = tonumber(minetest.settings:get("planetoidgen.miny")) or 6000,
maxy = tonumber(minetest.settings:get("planetoidgen.maxy")) or 10000,
planets = {}
planets = {},
profile_mapgen = minetest.settings:get("planetoidgen.profile_mapgen")
}

View File

@ -42,6 +42,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
return
end
local t0 = minetest.get_us_time()
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local data = vm:get_data()
@ -95,4 +96,11 @@ minetest.register_on_generated(function(minp, maxp, seed)
vm:set_data(data)
vm:write_to_map()
local t1 = minetest.get_us_time()
local micros = t1 -t0
if planetoidgen.profile_mapgen then
print("[planetoidgen] mapgen for " .. minetest.pos_to_string(minp) .. " took " .. micros .. " us")
end
end)