]> Cypherpunks repositories - gostls13.git/commitdiff
Revert "internal/trace: change Less to make sorting events deterministice"
authorPeter Weinberger <pjw@google.com>
Thu, 24 May 2018 16:28:32 +0000 (16:28 +0000)
committerPeter Weinberger <pjw@google.com>
Thu, 24 May 2018 18:03:21 +0000 (18:03 +0000)
This reverts commit 1764609b8b245323210eab39c4b586291d3a45a5.

Reason for revert: It breaks the dragonfly trybot, in which there are sometimes (non-deterministically) Events with the same timestamp that have to occur in a specific order.

Change-Id: I714e640c6ab5ccb23d5577e8aa98c7716ede7ad2
Reviewed-on: https://go-review.googlesource.com/114356
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/internal/trace/order.go

index d0b58301d62d6e7a0ecb24daf85dbc9fd5f576a6..36ed58d675aa7aa104079543a2314f403df5f9dd 100644 (file)
@@ -133,7 +133,7 @@ func order1007(m map[int][]*Event) (events []*Event, err error) {
                        ev.Ts = ts
                }
        }
-       sort.Sort(eventList(events))
+       sort.Stable(eventList(events))
 
        return
 }
@@ -243,20 +243,7 @@ func (l orderEventList) Len() int {
 }
 
 func (l orderEventList) Less(i, j int) bool {
-       a, b := l[i].ev, l[j].ev
-       if a.Ts != b.Ts {
-               return a.Ts < b.Ts
-       }
-       if a.Type != b.Type {
-               return a.Type < b.Type
-       }
-       if a.P != b.P {
-               return a.P < b.P
-       }
-       if a.G != b.G {
-               return a.G < b.G
-       }
-       return a.Args[0] < b.Args[0]
+       return l[i].ev.Ts < l[j].ev.Ts
 }
 
 func (l orderEventList) Swap(i, j int) {