返回 DeepSeek-Reasonix
rss_unix.go
根目录 / tools / sessioncapacity / rss_unix.go
1 //go:build unix
2
3 package main
4
5 import (
6 "runtime"
7 "syscall"
8 )
9
10 func processPeakRSSBytes() uint64 {
11 var usage syscall.Rusage
12 if err := syscall.Getrusage(syscall.RUSAGE_SELF, &usage); err != nil || usage.Maxrss < 0 {
13 return 0
14 }
15 // Darwin reports bytes; Linux and the other supported Unix targets report
16 // KiB. This is the process high-water mark, not a sampled Go heap value.
17 if runtime.GOOS == "darwin" {
18 return uint64(usage.Maxrss)
19 }
20 return uint64(usage.Maxrss) * 1024
21 }
22
22 lines GO