Skip to content

Commit

Permalink
Merge pull request #5 from idealo/last_measurement_issue
Browse files Browse the repository at this point in the history
fix: last line of measurement was missing
  • Loading branch information
manuelkasiske4idealo authored Nov 8, 2024
2 parents 8081aa9 + ce1bb42 commit 94a604a
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
)

func main() {

var threads int
var docCount int
var uri string
Expand Down Expand Up @@ -122,6 +121,24 @@ func main() {

wg.Wait()

timestamp := time.Now().Unix()
count := insertRate.Count()
mean := insertRate.RateMean()
m1Rate := insertRate.Rate1()
m5Rate := insertRate.Rate5()
m15Rate := insertRate.Rate15()

finalRecord := []string{
fmt.Sprintf("%d", timestamp),
fmt.Sprintf("%d", count),
fmt.Sprintf("%.6f", mean),
fmt.Sprintf("%.6f", m1Rate),
fmt.Sprintf("%.6f", m5Rate),
fmt.Sprintf("%.6f", m15Rate),
fmt.Sprintf("%.6f", mean), // mean_rate added to CSV
}
records = append(records, finalRecord)

filename := fmt.Sprintf("benchmark_results_%s.csv", testType)
file, err := os.Create(filename)
if err != nil {
Expand All @@ -135,5 +152,5 @@ func main() {
}
writer.Flush()

fmt.Println("Benchmarking completed. Check benchmark_results.csv for per-second rates.")
fmt.Printf("Benchmarking completed. Results saved to %s\n", filename)
}

0 comments on commit 94a604a

Please sign in to comment.