The existing code just used timestamps. The new code uses more fields
when timestamps are equal.
Revised to shorten code per reviewer comments.
Change-Id: Ibd0824d0acd7644484d536b1a754a0da156fac3d
Reviewed-on: https://go-review.googlesource.com/113721
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
ev.Ts = ts
}
}
- sort.Stable(eventList(events))
+ sort.Sort(eventList(events))
return
}
}
func (l orderEventList) Less(i, j int) bool {
- return l[i].ev.Ts < l[j].ev.Ts
+ 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]
}
func (l orderEventList) Swap(i, j int) {