Merge pull request #334 from ClusterCockpit/add_statsRounding_dataLoader

Add stats rounding data loader
This commit is contained in:
Jan Eitzinger 2025-02-25 13:07:03 +01:00 committed by GitHub
commit c0443cbec2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 0 deletions

View File

@ -170,6 +170,9 @@ func LoadData(job *schema.Job,
jd.AddNodeScope("mem_bw") jd.AddNodeScope("mem_bw")
} }
// Round Resulting Stat Values
jd.RoundMetricStats()
return jd, ttl, size return jd, ttl, size
}) })

View File

@ -291,6 +291,21 @@ func (jd *JobData) AddNodeScope(metric string) bool {
return true return true
} }
func (jd *JobData) RoundMetricStats() {
// TODO: Make Digit-Precision Configurable? (Currently: Fixed to 2 Digits)
for _, scopes := range *jd {
for _, jm := range scopes {
for index := range jm.Series {
jm.Series[index].Statistics = MetricStatistics{
Avg: (math.Round(jm.Series[index].Statistics.Avg*100) / 100),
Min: (math.Round(jm.Series[index].Statistics.Min*100) / 100),
Max: (math.Round(jm.Series[index].Statistics.Max*100) / 100),
}
}
}
}
}
func (jm *JobMetric) AddPercentiles(ps []int) bool { func (jm *JobMetric) AddPercentiles(ps []int) bool {
if jm.StatisticsSeries == nil { if jm.StatisticsSeries == nil {
jm.AddStatisticsSeries() jm.AddStatisticsSeries()