fix 'timeit' in headless mode
This commit is contained in:
parent
c67f158e62
commit
b05c2fc911
@ -1,6 +1,7 @@
|
|||||||
test.new_world("demo", "2019", "core:default")
|
test.new_world("demo", "2019", "core:default")
|
||||||
|
assert(world.is_open())
|
||||||
assert(world.get_generator() == "core:default")
|
assert(world.get_generator() == "core:default")
|
||||||
coroutine.yield()
|
test.sleep(1)
|
||||||
assert(world.get_total_time() > 0.0)
|
assert(world.get_total_time() > 0.0)
|
||||||
print(world.get_total_time())
|
print(world.get_total_time())
|
||||||
test.close_world(true)
|
test.close_world(true)
|
||||||
|
|||||||
@ -15,6 +15,7 @@ if test then
|
|||||||
test.new_world = core.new_world
|
test.new_world = core.new_world
|
||||||
test.close_world = core.close_world
|
test.close_world = core.close_world
|
||||||
test.reconfig_packs = core.reconfig_packs
|
test.reconfig_packs = core.reconfig_packs
|
||||||
|
test.tick = coroutine.yield
|
||||||
end
|
end
|
||||||
|
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
|
|||||||
@ -34,11 +34,11 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function timeit(iters, func, ...)
|
function timeit(iters, func, ...)
|
||||||
local tm = time.uptime()
|
local tm = os.clock()
|
||||||
for i=1,iters do
|
for i=1,iters do
|
||||||
func(...)
|
func(...)
|
||||||
end
|
end
|
||||||
print("[time mcs]", (time.uptime()-tm) * 1000000)
|
print("[time mcs]", (os.clock()-tm) * 1000000)
|
||||||
end
|
end
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "engine.hpp"
|
#include "engine.hpp"
|
||||||
#include "window/Window.hpp"
|
|
||||||
#include "api_lua.hpp"
|
#include "api_lua.hpp"
|
||||||
|
|
||||||
using namespace scripting;
|
using namespace scripting;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user