summaryrefslogtreecommitdiff
path: root/script-beta/service
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-09-28 02:01:47 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-09-28 02:01:47 +0800
commit6032d2ad73bd583b7077a15a38f515494068698e (patch)
treec5efcc038c19250d779ece352990e646508f5502 /script-beta/service
parent24a8b40a37b8a80355b3d29c2e04c91c14d4c71b (diff)
downloadlua-language-server-6032d2ad73bd583b7077a15a38f515494068698e.zip
统计挂起的rpc
Diffstat (limited to 'script-beta/service')
-rw-r--r--script-beta/service/service.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/script-beta/service/service.lua b/script-beta/service/service.lua
index 3f0005ad..119e70aa 100644
--- a/script-beta/service/service.lua
+++ b/script-beta/service/service.lua
@@ -98,6 +98,24 @@ function m.reportCache()
return table.concat(lines, '\n')
end
+function m.reportProto()
+ local holdon = 0
+ local waiting = 0
+
+ for _ in pairs(proto.holdon) do
+ holdon = holdon + 1
+ end
+ for _ in pairs(proto.waiting) do
+ waiting = waiting + 1
+ end
+
+ local lines = {}
+ lines[#lines+1] = ' --------------- Cache ---------------'
+ lines[#lines+1] = (' Holdon: %d'):format(holdon)
+ lines[#lines+1] = (' Waiting: %d'):format(waiting)
+ return table.concat(lines, '\n')
+end
+
function m.report()
local t = timer.loop(60.0, function ()
local lines = {}
@@ -106,6 +124,7 @@ function m.report()
lines[#lines+1] = m.reportMemory()
lines[#lines+1] = m.reportTask()
lines[#lines+1] = m.reportCache()
+ lines[#lines+1] = m.reportProto()
lines[#lines+1] = '=============================================='
log.debug(table.concat(lines, '\n'))