diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-26 11:27:01 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-26 11:27:01 +0800 |
commit | 0415404ae424d9fbf08d10e291d5a73c2ed821e6 (patch) | |
tree | 3566c0f894603db92f1294be75c96626f1f85c9c /server/src/service.lua | |
parent | 02c05d770711b0d1edc3cb42a74fe6d03214903c (diff) | |
download | lua-language-server-0415404ae424d9fbf08d10e291d5a73c2ed821e6.zip |
内存测试
Diffstat (limited to 'server/src/service.lua')
-rw-r--r-- | server/src/service.lua | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/server/src/service.lua b/server/src/service.lua index 85d55543..7f22732e 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -8,7 +8,9 @@ local core = require 'core' local lang = require 'language' local updateTimer= require 'timer' local buildVM = require 'vm' -local source = require 'vm.source' +local sourceMgr = require 'vm.source' +local localMgr = require 'vm.local' +local valueMgr = require 'vm.value' local ErrorCodes = { -- Defined by JSON RPC @@ -622,13 +624,24 @@ function mt:_testMemory() local alivedSource = 0 local deadSource = 0 - for src, id in pairs(source.watch) do - if source.list[id] then + for _, id in pairs(sourceMgr.watch) do + if sourceMgr.list[id] then alivedSource = alivedSource + 1 else deadSource = deadSource + 1 end end + + local totalLocal = 0 + for _ in pairs(localMgr.watch) do + totalLocal = totalLocal + 1 + end + + local totalValue = 0 + for _ in pairs(valueMgr.watch) do + totalValue = totalValue + 1 + end + local mem = collectgarbage 'count' log.debug(('\n\z State\n\z @@ -638,14 +651,18 @@ function mt:_testMemory() DeadVM: [%d]\n\z CachedSrc:[%d]\n\z AlivedSrc:[%d]\n\z - DeadSrc: [%d]'):format( + DeadSrc: [%d]\n\z + TotalLoc: [%d]\n\z + TotalVal: [%d]'):format( mem, cachedVM, aliveVM, deadVM, cachedSource, alivedSource, - deadSource + deadSource, + totalLocal, + totalValue )) end |