summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-04-29 20:26:51 +0800
committersumneko <sumneko@hotmail.com>2019-04-29 20:26:51 +0800
commitba5e88985b5344789100b1e8d91b68fe1f2cab1a (patch)
tree39e681ca7b947666cbdbffa8eb183213b5f1940e /server
parenteec1da3f170a0fc90844860f0c877e38765466b1 (diff)
downloadlua-language-server-ba5e88985b5344789100b1e8d91b68fe1f2cab1a.zip
统计一下emmy
Diffstat (limited to 'server')
-rw-r--r--server/src/emmy/manager.lua13
-rw-r--r--server/src/service.lua29
2 files changed, 28 insertions, 14 deletions
diff --git a/server/src/emmy/manager.lua b/server/src/emmy/manager.lua
index 5213e2f6..ce766988 100644
--- a/server/src/emmy/manager.lua
+++ b/server/src/emmy/manager.lua
@@ -143,11 +143,22 @@ end
function mt:remove()
end
+function mt:count()
+ local count = 0
+ for _, list in pairs(self._class) do
+ for k in pairs(list) do
+ if k ~= 'version' then
+ count = count + 1
+ end
+ end
+ end
+ return count
+end
+
return function ()
---@class emmyMgr
local self = setmetatable({
_class = {},
- _type = {},
}, mt)
return self
end
diff --git a/server/src/service.lua b/server/src/service.lua
index bc8ca141..42178c99 100644
--- a/server/src/service.lua
+++ b/server/src/service.lua
@@ -742,17 +742,6 @@ function mt:_testMemory()
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 totalFunction = 0
local alivedFunction = 0
local deadFunction = 0
for _, id in pairs(functionMgr.watch) do
@@ -763,6 +752,18 @@ function mt:_testMemory()
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 totalEmmy = self.emmy:count()
+
local mem = collectgarbage 'count'
local threadInfo = async.info
local threadBuf = {}
@@ -792,7 +793,8 @@ function mt:_testMemory()
DeadFunc: [%d]\n\z
-------------------\n\z
TotalLoc: [%d]\n\z
- TotalVal: [%d]\n\z'):format(
+ TotalVal: [%d]\n\z
+ TotalEmmy: [%d]\n\z'):format(
mem,
table.concat(threadBuf, '\n'),
@@ -809,7 +811,8 @@ function mt:_testMemory()
deadFunction,
totalLocal,
- totalValue
+ totalValue,
+ totalEmmy
))
log.debug('test memory: ', ('%.3f'):format(os.clock() - clock))
end