Skip to content

Commit

Permalink
Update benchmark tool to make outputs easier to work with
Browse files Browse the repository at this point in the history
  • Loading branch information
banks committed Nov 29, 2022
1 parent 2591688 commit d654248
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
19 changes: 6 additions & 13 deletions bench/append_requestor.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,12 @@ func (r *appendRequester) Setup() error {
return err
}
}
if r.opts.truncatePeriod == 0 {
// Now truncate all, but one of those back out. We leave one to be more
// realistic since raft always leaves some recent logs. Note r.index is
// already at the next index after the one we just wrote so the inclusive
// delete range is not one but two before that to leave the one before
// intact.
fmt.Fprintf(r.output, "Truncating 1 - %d\n", r.index-2)
err := r.store.DeleteRange(1, r.index-2)
if err != nil {
return err
}
} else {
fmt.Fprintf(r.output, "Done preloading, will leave truncate for background process\n")

// Now truncate back to trailingLogs.
fmt.Fprintf(r.output, "Truncating 1 - %d\n", r.index-uint64(r.opts.truncateTrailingLogs))
err := r.store.DeleteRange(1, r.index-uint64(r.opts.truncateTrailingLogs))
if err != nil {
return err
}
r.dumpStats()
}
Expand Down
8 changes: 7 additions & 1 deletion bench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ func main() {
}
}
}

// Make the results dir if it doesn't exist
if err := os.MkdirAll(filepath.Join(o.dir, filepath.Dir(outFileName(o, "blah"))), 0755); err != nil {
panic(err)
}

r := &appendRequesterFactory{
opts: o,
output: teeOut,
Expand All @@ -104,7 +110,7 @@ func outFileName(o opts, suffix string) string {
if o.version == "bolt" && o.noFreelistSync {
version += "-nfls"
}
return fmt.Sprintf("bench-result-%s-s%d-n%d-r%d-seg%dm-pre%d-trail%d-tp%s-%s-%s.txt",
return fmt.Sprintf("bench-result-%s-s%d-n%d-r%d-seg%dm-pre%d-trail%d-tp%s/%s-%s.txt",
o.duration, o.logSize, o.batchSize, o.rate, o.segSize, o.preLoadN,
o.truncateTrailingLogs, o.truncatePeriod, version, suffix)
}
Expand Down

0 comments on commit d654248

Please sign in to comment.