diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-10-01 00:37:14 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-10-01 00:37:14 +0800 |
commit | 5d3baeaf1d46c1735eb7f457bdd5088ccbf4bf29 (patch) | |
tree | 202a103a8398bdb7d4e5ce73de7ce55f58bf98fc | |
parent | 13a837cd9648711a7b8ed5802a17f6ff479be395 (diff) | |
download | lua-language-server-5d3baeaf1d46c1735eb7f457bdd5088ccbf4bf29.zip |
#1595 add some logs
-rw-r--r-- | script/vm/global.lua | 14 |
1 files changed, 12 insertions, 2 deletions
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 |