Skip to content

Commit 64e48bb

Browse files
dvyukovbradfitz
authored andcommitted
internal/trace: stable sort events
On some VMs two events can happen at the same time. For examples: 179827399 GoStart p=2 g=11 off=936359 g=11 179827399 GoUnblock p=2 g=0 off=936355 g=11 If we do non-stable sort, the events can be reordered making the trace inconsistent. Do stable sort instead. Batches are dumped in FIFO order, so if these same-time events are split into separate batches, stable sort still works. Events on different CPUs go into different batches and can be reordered. But the intention is that causally-related events on different CPUs will have larger (non-zero) time diff. Update #11320 Change-Id: Id1df96af41dff68ea1782ab4b23d5afd63b890c9 Reviewed-on: https://go-review.googlesource.com/11834 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent cd2e2f6 commit 64e48bb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/internal/trace/parser.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ func parseEvents(rawEvents []rawEvent) (events []*Event, err error) {
254254
}
255255

256256
// Sort by time and translate cpu ticks to real time.
257-
sort.Sort(eventList(events))
257+
sort.Stable(eventList(events))
258258
if ticksPerSec == 0 {
259259
err = fmt.Errorf("no EvFrequency event")
260260
return

0 commit comments

Comments
 (0)