aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mstats.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2020-07-01 16:02:42 +0000
committerMichael Knyszek <mknyszek@google.com>2020-10-26 18:29:05 +0000
commitb08dfbaa439e4e396b979e02ea2e7d36972e8b7a (patch)
tree20fbf60331aeb10a72f74625c45f4b0bcb3ca527 /src/runtime/mstats.go
parent79781e8dd382ac34e502ed6a088dff6860a08c05 (diff)
downloadgo-b08dfbaa439e4e396b979e02ea2e7d36972e8b7a.tar.xz
runtime,runtime/metrics: add memory metrics
This change adds support for a variety of runtime memory metrics and contains the base implementation of Read for the runtime/metrics package, which lives in the runtime. It also adds testing infrastructure for the metrics package, and a bunch of format and documentation tests. For #37112. Change-Id: I16a2c4781eeeb2de0abcb045c15105f1210e2d8a Reviewed-on: https://go-review.googlesource.com/c/go/+/247041 Run-TryBot: Michael Knyszek <mknyszek@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> Trust: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/mstats.go')
-rw-r--r--src/runtime/mstats.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/runtime/mstats.go b/src/runtime/mstats.go
index a8eca85fe6..512a06cffa 100644
--- a/src/runtime/mstats.go
+++ b/src/runtime/mstats.go
@@ -882,7 +882,8 @@ func (m *consistentHeapStats) unsafeClear() {
// heapStatsDelta, the resulting values should be complete and
// valid statistic values.
//
-// Not safe to call concurrently.
+// Not safe to call concurrently. The world must be stopped
+// or metricsSema must be held.
func (m *consistentHeapStats) read(out *heapStatsDelta) {
// Getting preempted after this point is not safe because
// we read allp. We need to make sure a STW can't happen