Skip to content

Commit

Permalink
ba: Add CPU utime and stime comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
matevz committed Mar 19, 2020
1 parent 9c2eb40 commit 80ce59f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions go/extra/ba/cmd/ba.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ or doesn't reach min_threshold.<metric>.{avg|max}_ratio, ba exits with error cod
maxThresholdAvgRatio: 1.1,
maxThresholdMaxRatio: 1.1,
},
"cpu": &Metric{
getter: getCPUTime,
maxThresholdAvgRatio: 1.05,
maxThresholdMaxRatio: 1.05,
},
}
userMetrics []string

Expand Down Expand Up @@ -146,6 +151,21 @@ func getRssAnonMemory(ctx context.Context, test string, bi *model.SampleStream)
return getSummableMetric(ctx, "oasis_worker_mem_RssAnon_bytes", test, bi)
}

// getCPUTime returns average and maximum sum of utime and stime for all workers of the given coarse benchmark instance
// ("up" metric).
func getCPUTime(ctx context.Context, test string, bi *model.SampleStream) (float64, float64, error) {
utimeAvg, utimeMax, err := getSummableMetric(ctx, "oasis_worker_cpu_utime_seconds", test, bi)
if err != nil {
return 0, 0, err
}
stimeAvg, stimeMax, err := getSummableMetric(ctx, "oasis_worker_cpu_stime_seconds", test, bi)
if err != nil {
return 0, 0, err
}

return utimeAvg + stimeAvg, utimeMax + stimeMax, nil
}

// getSummableMetric returns average and maximum sum of metrics for all workers of the given coarse benchmark instance
// ("up" metric).
func getSummableMetric(ctx context.Context, metric string, test string, bi *model.SampleStream) (float64, float64, error) {
Expand Down

0 comments on commit 80ce59f

Please sign in to comment.