From 4fd0c6ec626295844470e544264a1b3607f485b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 19 Nov 2020 18:39:22 +0800 Subject: =?UTF-8?q?=E5=8A=A0=E4=B8=AA=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-beta/await.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'script-beta') diff --git a/script-beta/await.lua b/script-beta/await.lua index 50406918..d8e2a9ad 100644 --- a/script-beta/await.lua +++ b/script-beta/await.lua @@ -161,6 +161,23 @@ function m.delay() return coroutine.yield() end +local function warnStepTime(passed, waker) + if passed < 1 then + log.warn(('Await step takes [%.3f] sec.'):format(passed)) + return + end + for i = 1, 100 do + local name, v = debug.getupvalue(waker, i) + if not name then + return + end + if name == 'co' then + log.warn(debug.traceback(v, ('[fire]Await step takes [%.3f] sec.'):format(passed))) + return + end + end +end + --- 步进 function m.step() local waker = m.delayQueue[m.delayQueueIndex] @@ -171,7 +188,7 @@ function m.step() waker() local passed = os.clock() - clock if passed > 0.1 then - log.warn(('Await step takes [%.3f] sec.'):format(passed)) + warnStepTime(passed, waker) end return true else -- cgit v1.2.3