From 5d3baeaf1d46c1735eb7f457bdd5088ccbf4bf29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sat, 1 Oct 2022 00:37:14 +0800 Subject: #1595 add some logs --- script/vm/global.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'script/vm/global.lua') diff --git a/script/vm/global.lua b/script/vm/global.lua index 3a045b22..590264bd 100644 --- a/script/vm/global.lua +++ b/script/vm/global.lua @@ -53,6 +53,7 @@ function mt:getSets(suri) if self.setsCache[cacheUri] then return self.setsCache[cacheUri] end + local clock = os.clock() self.setsCache[cacheUri] = {} local cache = self.setsCache[cacheUri] for uri, link in pairs(self.links) do @@ -64,6 +65,10 @@ function mt:getSets(suri) end end end + local cost = os.clock() - clock + if cost > 0.1 then + log.warn('global-manager getSets costs', cost, self.name) + end return cache end @@ -77,6 +82,7 @@ function mt:getGets(suri) if self.getsCache[cacheUri] then return self.getsCache[cacheUri] end + local clock = os.clock() self.getsCache[cacheUri] = {} local cache = self.getsCache[cacheUri] for uri, link in pairs(self.links) do @@ -88,6 +94,10 @@ function mt:getGets(suri) end end end + local cost = os.clock() - clock + if cost > 0.1 then + log.warn('global-manager getGets costs', cost, self.name) + end return cache end @@ -431,7 +441,7 @@ function vm.getGlobalFields(cate, name) end local cost = os.clock() - clock if cost > 0.1 then - log.warn('global-manager getFields cost %.3f', cost) + log.warn('global-manager getFields costs', cost) end return globals @@ -451,7 +461,7 @@ function vm.getGlobals(cate) end local cost = os.clock() - clock if cost > 0.1 then - log.warn('global-manager getGlobals cost %.3f', cost) + log.warn('global-manager getGlobals costs', cost) end return globals -- cgit v1.2.3