From 68d7e5ccada52c1c9171e8d12c7c14b955d84aa0 Mon Sep 17 00:00:00 2001 From: He Xian Date: Thu, 6 Jun 2024 15:30:58 +0800 Subject: [PATCH] metric: add GC CPU Fraction Signed-off-by: He Xian --- v2/metric.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/v2/metric.go b/v2/metric.go index 2f35245..ad16c84 100644 --- a/v2/metric.go +++ b/v2/metric.go @@ -105,6 +105,8 @@ func printMemStats(w io.Writer, lastGC bool) { fprintf(w, "%-20s: %s (+%s)\n", "Total Allocated", formats.IECBytes(float64(memstats.Sys-memstats.HeapReleased)), formats.IECBytes(float64(memstats.HeapReleased))) + fprintf(w, "%-20s: %.07f%%\n", "GC CPU Fraction", + memstats.GCCPUFraction*100.0/float64(runtime.GOMAXPROCS(0))) if !lastGC { return }