@@ -7,6 +7,7 @@ local RestHttpHandler = require('jls.net.http.handler.RestHttpHandler')
77local HttpExchange = require (' jls.net.http.HttpExchange' )
88local json = require (' jls.util.json' )
99local Date = require (' jls.util.Date' )
10+ local Map = require (' jls.util.Map' )
1011local ZipFile = require (' jls.util.zip.ZipFile' )
1112
1213local utils = require (' lha.utils' )
@@ -89,6 +90,7 @@ local REST_ADMIN = {
8990 [' restart?method=POST' ] = function (exchange )
9091 event :setTimeout (function ()
9192 exchange .attributes .engine :stop ()
93+ runtime .gc ()
9294 exchange .attributes .engine :start ()
9395 end , 100 )
9496 return ' In progress'
@@ -105,21 +107,18 @@ local REST_ADMIN = {
105107 return ' Done'
106108 end ,
107109 info = function (exchange )
108- -- local engine = exchange:getAttribute('engine')
109- -- local ip, port = engine:getHTTPServer():getAddress()
110+ local engine = exchange :getAttribute (' engine' )
111+ local httpServer = engine :getHTTPServer ()
112+ -- local ip, port = httpServer:getAddress()
110113 return {
111- clock = os.clock (),
112- memory = math.floor (collectgarbage (' count' ) * 1024 ),
113- time = Date .now () // 1000
114+ [' CPU Time' ] = os.clock (),
115+ [' Server Time' ] = os.time (),
116+ [' Lua Memory Size' ] = math.floor (collectgarbage (' count' ) * 1024 ),
117+ [' Lua Registry Entries' ] = Map .size (debug.getregistry ()),
118+ [' Loaded Packages' ] = Map .size (package.loaded ),
119+ [' HTTP Clients' ] = Map .size (httpServer .pendings ),
114120 }
115121 end ,
116- mem = function (exchange )
117- local report = ' '
118- require (' jls.util.memprof' ).printReport (function (data )
119- report = data
120- end , false , false , ' csv' )
121- return report
122- end ,
123122 backup = {
124123 [' create?method=POST' ] = function (exchange )
125124 local engine = exchange :getAttribute (' engine' )
0 commit comments