aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/trace/pprof.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2025-01-27 21:42:34 +0000
committerGopher Robot <gobot@golang.org>2025-02-11 11:23:26 -0800
commit0be3701cb618713611fe3c21c13b2aee34020fff (patch)
treeee5d822a9f9872e8b872a7bd90156aa3ba5bee9e /src/cmd/trace/pprof.go
parentb5f34aa4abc1ae49b9f97355deb5ab097d0c68a9 (diff)
downloadgo-0be3701cb618713611fe3c21c13b2aee34020fff.tar.xz
internal/trace: clean up parser.go
parser.go is an old file that contains trace v1 definitions and a second equivalent definition for stack frames. These are redundant and useless. Delete these definitions and rename the file to fakep.go, which describes the only thing left in this file, a bunch of fake P IDs used by the trace viewer. We should consider moving the fake P definitions elsewhere, too. Change-Id: Ifd0768bd73c39009069445afe0155f1e352f00c3 Reviewed-on: https://go-review.googlesource.com/c/go/+/644875 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd/trace/pprof.go')
-rw-r--r--src/cmd/trace/pprof.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/cmd/trace/pprof.go b/src/cmd/trace/pprof.go
index d27dfa7aa3..a66419aedf 100644
--- a/src/cmd/trace/pprof.go
+++ b/src/cmd/trace/pprof.go
@@ -306,18 +306,15 @@ func (m *stackMap) profile() []traceviewer.ProfileRecord {
prof := make([]traceviewer.ProfileRecord, 0, len(m.stacks))
for stack, record := range m.stacks {
rec := *record
- for i, frame := range slices.Collect(stack.Frames()) {
- rec.Stack = append(rec.Stack, &trace.Frame{
- PC: frame.PC,
- Fn: frame.Func,
- File: frame.File,
- Line: int(frame.Line),
- })
+ var i int
+ for frame := range stack.Frames() {
+ rec.Stack = append(rec.Stack, frame)
// Cut this off at pprofMaxStack because that's as far
// as our deduplication goes.
if i >= pprofMaxStack {
break
}
+ i++
}
prof = append(prof, rec)
}