diff options
| author | Michael Anthony Knyszek <mknyszek@google.com> | 2022-05-06 20:11:28 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-09-16 16:32:20 +0000 |
| commit | b7c28f484ddbc8267273c997e1bcc83a1391b5f7 (patch) | |
| tree | fe23dfabb05048822ab00faf36cc6aee2518f974 /src/runtime/runtime2.go | |
| parent | 87eda2a782db9b7ad2ec1fd335ed6c7472aa66bc (diff) | |
| download | go-b7c28f484ddbc8267273c997e1bcc83a1391b5f7.tar.xz | |
runtime/metrics: add CPU stats
This changes adds a breakdown for estimated CPU usage by time. These
estimates are not based on real on-CPU counters, so each metric has a
disclaimer explaining so. They can, however, be more reasonably
compared to a total CPU time metric that this change also adds.
Fixes #47216.
Change-Id: I125006526be9f8e0d609200e193da5a78d9935be
Reviewed-on: https://go-review.googlesource.com/c/go/+/404307
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Josh MacDonald <jmacd@lightstep.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/runtime/runtime2.go')
| -rw-r--r-- | src/runtime/runtime2.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 1c620bbfbe..5e0d61c058 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -838,6 +838,11 @@ type schedt struct { // as the sum of time a G spends in the _Grunnable state before // it transitions to _Grunning. timeToRun timeHistogram + + // idleTime is the total CPU time Ps have "spent" idle. + // + // Reset on each GC cycle. + idleTime atomic.Int64 } // Values for the flags field of a sigTabT. |
