aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/pprof
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2022-03-10 09:28:09 +0100
committerTobias Klauser <tobias.klauser@gmail.com>2022-03-11 06:03:26 +0000
commitc1f22134f22158ebeebf450357f711eb22fab202 (patch)
tree4fe46483d6010f87e145a53b78c069bf641ce59c /src/runtime/pprof
parentfe75fe3c7ae99713ed4e452ea8a4fcb589517dd9 (diff)
downloadgo-c1f22134f22158ebeebf450357f711eb22fab202.tar.xz
runtime/pprof, syscall: report MaxRSS on all unix platforms
All unix platforms currently supported by Go provide the getrusage syscall. On aix and solaris the Getrusage syscall wrapper is not available yet, so add and use it to report MaxRSS in memory profiles. Change-Id: Ie880a3058171031fd2e12ccf9adfb85ce18858b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/391434 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> Trust: Michael Pratt <mpratt@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/pprof')
-rw-r--r--src/runtime/pprof/pprof_norusage.go2
-rw-r--r--src/runtime/pprof/pprof_rusage.go6
-rw-r--r--src/runtime/pprof/rusage_test.go2
3 files changed, 6 insertions, 4 deletions
diff --git a/src/runtime/pprof/pprof_norusage.go b/src/runtime/pprof/pprof_norusage.go
index cbc5176cfa..3d6052519c 100644
--- a/src/runtime/pprof/pprof_norusage.go
+++ b/src/runtime/pprof/pprof_norusage.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build !darwin && !linux
+//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris
package pprof
diff --git a/src/runtime/pprof/pprof_rusage.go b/src/runtime/pprof/pprof_rusage.go
index 46263fedd9..7df81eca23 100644
--- a/src/runtime/pprof/pprof_rusage.go
+++ b/src/runtime/pprof/pprof_rusage.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build darwin || linux
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
package pprof
@@ -17,10 +17,12 @@ import (
func addMaxRSS(w io.Writer) {
var rssToBytes uintptr
switch runtime.GOOS {
- case "linux", "android":
+ case "aix", "android", "dragonfly", "freebsd", "linux", "netbsd", "openbsd":
rssToBytes = 1024
case "darwin", "ios":
rssToBytes = 1
+ case "illumos", "solaris":
+ rssToBytes = uintptr(syscall.Getpagesize())
default:
panic("unsupported OS")
}
diff --git a/src/runtime/pprof/rusage_test.go b/src/runtime/pprof/rusage_test.go
index b0d651e0eb..f274d0caa3 100644
--- a/src/runtime/pprof/rusage_test.go
+++ b/src/runtime/pprof/rusage_test.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build darwin || freebsd || linux || netbsd || openbsd
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
package pprof