Skip to content

Commit

Permalink
Merge pull request #10 from lightpanda-io/reorder
Browse files Browse the repository at this point in the history
ensure sorted history
  • Loading branch information
krichprollsch authored Dec 7, 2023
2 parents 9e8788e + 719d029 commit 3e7c05f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bench/bench.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"
"sort"
"time"

"github.com/lightpanda-io/perf-fmt/git"
Expand Down Expand Up @@ -90,6 +91,11 @@ func (a *Append) Append(

allres = append(allres, outres)

// reorder slice
sort.Slice(allres, func(i, j int) bool {
return allres[i].Time.Before(allres[j].Time)
})

// encode output
enc := json.NewEncoder(out)
if err := enc.Encode(allres); err != nil {
Expand Down
6 changes: 6 additions & 0 deletions wpt/wpt.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"
"sort"
"time"

"github.com/lightpanda-io/perf-fmt/git"
Expand Down Expand Up @@ -85,6 +86,11 @@ func (a *Append) Append(

allres = append(allres, outres)

// reorder slice
sort.Slice(allres, func(i, j int) bool {
return allres[i].Time.Before(allres[j].Time)
})

// encode output
enc := json.NewEncoder(out)
if err := enc.Encode(allres); err != nil {
Expand Down

0 comments on commit 3e7c05f

Please sign in to comment.