Skip to content

The only tool you need to know what is happening and how to fix it.

421 B
Raw Blame
//go:build linux

package monitoring

import (
	"os"
	"strconv"
	"strings"
)

func ReadRSSBytes() (uint64, bool) {
	data, err := os.ReadFile("/proc/self/statm")
	if err != nil {
		return 0, false
	}
	fields := strings.Fields(string(data))
	if len(fields) < 2 {
		return 0, false
	}
	pages, err := strconv.ParseUint(fields[1], 10, 64)
	if err != nil {
		return 0, false
	}
	return pages * uint64(os.Getpagesize()), true
}