]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: move goroutine stack exists events after span events
authorMichael Anthony Knyszek <mknyszek@google.com>
Tue, 21 May 2024 04:15:40 +0000 (04:15 +0000)
committerGopher Robot <gobot@golang.org>
Wed, 22 May 2024 20:32:51 +0000 (20:32 +0000)
Preserving an ordering wherein spans are always named before their
constituents makes parsing much more straightforward.

Change-Id: Ida8764801a6c516d672ba343e4ce01b66ce9b427
Reviewed-on: https://go-review.googlesource.com/c/go/+/586999
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/runtime/traceallocfree.go

index 67c6f40926ff1ee6a12a6b28f1ef8882f91bec06..e6a2a79c691bb8993dfb668d8e57ba784b620769 100644 (file)
@@ -49,11 +49,6 @@ func traceSnapshotMemory(gen uintptr) {
                throw("traceSnapshotMemory: tracing is not enabled")
        }
 
-       // Write out all the goroutine stacks.
-       forEachGRace(func(gp *g) {
-               trace.GoroutineStackExists(gp.stack.lo, gp.stack.hi-gp.stack.lo)
-       })
-
        // Write out all the heap spans and heap objects.
        for _, s := range mheap_.allspans {
                if s.state.get() == mSpanDead {
@@ -77,6 +72,11 @@ func traceSnapshotMemory(gen uintptr) {
                        abits.advance()
                }
        }
+
+       // Write out all the goroutine stacks.
+       forEachGRace(func(gp *g) {
+               trace.GoroutineStackExists(gp.stack.lo, gp.stack.hi-gp.stack.lo)
+       })
        traceRelease(trace)
 }