mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-09 19:30:30 +08:00
edge-node gc命令增加耗时和gc pause时长
This commit is contained in:
@@ -777,9 +777,19 @@ func (this *Node) listenSock() error {
|
||||
_ = cmd.ReplyOk()
|
||||
}
|
||||
case "gc":
|
||||
var before = time.Now()
|
||||
runtime.GC()
|
||||
debug.FreeOSMemory()
|
||||
_ = cmd.ReplyOk()
|
||||
|
||||
var costSeconds = time.Since(before).Seconds()
|
||||
var gcStats = &debug.GCStats{}
|
||||
debug.ReadGCStats(gcStats)
|
||||
_ = cmd.Reply(&gosock.Command{
|
||||
Params: map[string]any{
|
||||
"pauseMS": gcStats.PauseTotal.Seconds() * 1000,
|
||||
"costMS": costSeconds * 1000,
|
||||
},
|
||||
})
|
||||
case "reload":
|
||||
err := this.syncConfig(0)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user