cc-backend/tools/sanitize-archive/metrics.go

66 lines
1.9 KiB
Go
Raw Normal View History

// Copyright (C) 2022 NHR@FAU, University Erlangen-Nuremberg.
// All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package main
import (
2022-11-10 13:37:53 +01:00
"github.com/ClusterCockpit/cc-backend/pkg/schema"
)
2022-11-10 13:37:53 +01:00
type JobData map[string]map[schema.MetricScope]*JobMetric
type JobMetric struct {
2022-11-10 13:37:53 +01:00
Unit string `json:"unit"`
Scope schema.MetricScope `json:"scope"`
Timestep int `json:"timestep"`
Series []Series `json:"series"`
StatisticsSeries *StatsSeries `json:"statisticsSeries"`
}
type Series struct {
Hostname string `json:"hostname"`
Id *int `json:"id,omitempty"`
Statistics *MetricStatistics `json:"statistics"`
Data []Float `json:"data"`
}
type MetricStatistics struct {
Avg float64 `json:"avg"`
Min float64 `json:"min"`
Max float64 `json:"max"`
}
type StatsSeries struct {
Mean []Float `json:"mean"`
Min []Float `json:"min"`
Max []Float `json:"max"`
Percentiles map[int][]Float `json:"percentiles,omitempty"`
}
2022-11-10 13:37:53 +01:00
// type MetricScope string
2022-11-10 13:37:53 +01:00
// const (
// MetricScopeInvalid MetricScope = "invalid_scope"
2022-11-10 13:37:53 +01:00
// MetricScopeNode MetricScope = "node"
// MetricScopeSocket MetricScope = "socket"
// MetricScopeMemoryDomain MetricScope = "memoryDomain"
// MetricScopeCore MetricScope = "core"
// MetricScopeHWThread MetricScope = "hwthread"
2022-11-10 13:37:53 +01:00
// MetricScopeAccelerator MetricScope = "accelerator"
// )
2022-11-10 13:37:53 +01:00
// var metricScopeGranularity map[MetricScope]int = map[MetricScope]int{
// MetricScopeNode: 10,
// MetricScopeSocket: 5,
// MetricScopeMemoryDomain: 3,
// MetricScopeCore: 2,
// MetricScopeHWThread: 1,
2022-11-10 13:37:53 +01:00
// MetricScopeAccelerator: 5, // Special/Randomly choosen
2022-11-10 13:37:53 +01:00
// MetricScopeInvalid: -1,
// }