Skip to content

Commit

Permalink
Truncate benchmark logs on re-run
Browse files Browse the repository at this point in the history
Rerunning benchmarks did not truncate the benchmark log file before this
change. New line would overwrite old lines, but you had to scan
timestamps to figure out where exactly the new run was at. It also
prevented `tail -f` to get real-time updates.

This change truncates the benchmark file on each execution.

Signed-off-by: Kern Walster <[email protected]>
  • Loading branch information
Kern-- committed Dec 10, 2024
1 parent 388bb3b commit 3b10bf6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion benchmark/comparisonTest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func main() {
panic(err)
}

logFile, err := os.OpenFile(outputDir+"/benchmark_log", os.O_RDWR|os.O_CREATE, 0664)
logFile, err := os.OpenFile(outputDir+"/benchmark_log", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0664)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion benchmark/performanceTest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func main() {
panic(err)
}

logFile, err := os.OpenFile(outputDir+"/benchmark_log", os.O_RDWR|os.O_CREATE, 0664)
logFile, err := os.OpenFile(outputDir+"/benchmark_log", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0664)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion benchmark/stargzTest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func main() {
panic(err)
}

logFile, err := os.OpenFile(outputDir+"/benchmark_log", os.O_RDWR|os.O_CREATE, 0664)
logFile, err := os.OpenFile(outputDir+"/benchmark_log", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0664)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 3b10bf6

Please sign in to comment.