diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-01-07 14:05:47 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-01-07 14:05:47 +0800 |
commit | b5dec09b49117ddbd22479b1d8a2603761392027 (patch) | |
tree | 73669330f3fab9fb1be39ae2a0506b0934b7c35f /server/src | |
parent | ead4c5d4b13c71be990bf66f07365e8d457a011d (diff) | |
download | lua-language-server-b5dec09b49117ddbd22479b1d8a2603761392027.zip |
更详细的耗时统计
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/service.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/server/src/service.lua b/server/src/service.lua index 80f2ba14..528bc644 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -153,12 +153,29 @@ function mt:compileAll() local passed = os.clock() - clock if passed > 0.1 then + local astCost = 0 + local vmCost = 0 + local lineCost = 0 + for _, uri in ipairs(list) do + local obj = self._file[uri] + if obj and obj.astCost and obj.vmCost and obj.lineCost then + astCost = astCost + obj.astCost + vmCost = vmCost + obj.vmCost + lineCost = lineCost + obj.lineCost + end + end log.debug(('\n\z Cache completion\n\z Cost: [%.3f]sec\n\z + Ast: [%.3f]sec\n\z + VM: [%.3f]sec\n\z + Line: [%.3f]sec\n\z Num: [%d]\n\z Size: [%.3f]kb'):format( passed, + astCost, + vmCost, + lineCost, #list, size / 1000 )) @@ -325,11 +342,18 @@ function mt:compileVM(uri) end local compiled = self:_markCompiled(uri) + local clock = os.clock() local ast = self:compileAst(obj) + obj.astCost = os.clock() - clock self:_clearChainNode(obj, uri) + local clock = os.clock() obj.vm = core.vm(ast, self, uri) + obj.vmCost = os.clock() - clock + + local clock = os.clock() obj.lines = parser:lines(obj.text, 'utf8') + obj.lineCost = os.clock() - clock self._needDiagnostics[uri] = true if not obj.vm then |