Skip to content

Commit

Permalink
Add battery ID to the the battery Entry IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
xllora committed Mar 11, 2016
1 parent bea56ff commit c182397
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions tools/benchmark/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,19 @@ func RepetitionDurationStats(reps int, f func() error) (time.Duration, int64, er
// BenchEntry cotains the bench entry id, the function to run, and the number
// of repetitions to run.
type BenchEntry struct {
ID string
Reps int
F func() error
BatteryID string
ID string
Reps int
F func() error
}

// BenchResult contains the results of running a bench mark.
type BenchResult struct {
ID string
Err error
Mean time.Duration
StdDev int64
BatteryID string
ID string
Err error
Mean time.Duration
StdDev int64
}

// RunBenchmarkBatterySequentially runs all the bench entries and returns the
Expand All @@ -88,10 +90,11 @@ func RunBenchmarkBatterySequentially(entries []*BenchEntry) []*BenchResult {
for _, entry := range entries {
m, d, err := RepetitionDurationStats(entry.Reps, entry.F)
res = append(res, &BenchResult{
ID: entry.ID,
Err: err,
Mean: m,
StdDev: d,
BatteryID: entry.BatteryID,
ID: entry.ID,
Err: err,
Mean: m,
StdDev: d,
})
}
return res
Expand All @@ -113,10 +116,11 @@ func RunBenchmarkBatteryConcurrently(entries []*BenchEntry) []*BenchResult {
defer mu.Unlock()
defer wg.Done()
res = append(res, &BenchResult{
ID: entry.ID,
Err: err,
Mean: m,
StdDev: d,
BatteryID: entry.BatteryID,
ID: entry.ID,
Err: err,
Mean: m,
StdDev: d,
})
}(entry)
}
Expand Down

0 comments on commit c182397

Please sign in to comment.