From 0415404ae424d9fbf08d10e291d5a73c2ed821e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 26 Mar 2019 11:27:01 +0800 Subject: =?UTF-8?q?=E5=86=85=E5=AD=98=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/service.lua | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'server/src/service.lua') 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 -- cgit v1.2.3