aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/export_test.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2022-01-10 22:59:26 +0000
committerMichael Knyszek <mknyszek@google.com>2022-04-26 22:08:00 +0000
commit79db59ded9dab276507f3a045e42b76eef5a35b4 (patch)
tree370067f9ae4dc36f151dc3410589dba6c6503b8e /src/runtime/export_test.go
parenta0f77e56b7a7ecb92dca3e2afdd56ee773c2cb07 (diff)
downloadgo-79db59ded9dab276507f3a045e42b76eef5a35b4.tar.gz
go-79db59ded9dab276507f3a045e42b76eef5a35b4.zip
runtime: make alloc count metrics truly monotonic
Right now we export alloc count metrics via the runtime/metrics package and mark them as monotonic, but that's not actually true. As an optimization, the runtime assumes a span is always fully allocated before being uncached, and updates the accounting as such. In the rare case that it's wrong, the span has enough information to back out what did not get allocated. This change uses 16 bits of padding in the mspan to house another field that represents the amount of mspan slots filled just as the mspan is cached. This is information is enough to get an exact count, allowing us to make the metrics truly monotonic. Change-Id: Iaff3ca43f8745dc1bbb0232372423e014b89b920 Reviewed-on: https://go-review.googlesource.com/c/go/+/377516 Reviewed-by: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/runtime/export_test.go')
0 files changed, 0 insertions, 0 deletions