From 7b14975dbbc1a580e972939754d1b39248fff98d Mon Sep 17 00:00:00 2001 From: zhengtianbao Date: Tue, 11 Jun 2024 18:03:33 +0800 Subject: [PATCH] Use Getpagesize replace hard-coded page size --- process_metrics_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/process_metrics_linux.go b/process_metrics_linux.go index 5c793f8..22a9e6e 100644 --- a/process_metrics_linux.go +++ b/process_metrics_linux.go @@ -80,7 +80,7 @@ func writeProcessMetrics(w io.Writer) { WriteCounterUint64(w, "process_major_pagefaults_total", uint64(p.Majflt)) WriteCounterUint64(w, "process_minor_pagefaults_total", uint64(p.Minflt)) WriteGaugeUint64(w, "process_num_threads", uint64(p.NumThreads)) - WriteGaugeUint64(w, "process_resident_memory_bytes", uint64(p.Rss)*4096) + WriteGaugeUint64(w, "process_resident_memory_bytes", uint64(p.Rss)*uint64(os.Getpagesize())) WriteGaugeUint64(w, "process_start_time_seconds", uint64(startTimeSeconds)) WriteGaugeUint64(w, "process_virtual_memory_bytes", uint64(p.Vsize)) writeProcessMemMetrics(w)