mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-27 05:49:04 +01:00
Support for memoryDomain scoped metrics
This commit is contained in:
parent
53312c4882
commit
f738a332c1
@ -79,6 +79,34 @@ func (topo *Topology) GetCoresFromHWThreads(hwthreads []int) (cores []int, exclu
|
|||||||
return cores, exclusive
|
return cores, exclusive
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return a list of memory domain IDs given a list of hwthread IDs.
|
||||||
|
// Even if just one hwthread is in that memory domain, add it to the list.
|
||||||
|
// If no hwthreads other than those in the argument list are assigned to
|
||||||
|
// one of the memory domains in the first return value, return true as the second value.
|
||||||
|
// TODO: Optimize this, there must be a more efficient way/algorithm.
|
||||||
|
func (topo *Topology) GetMemoryDomainsFromHWThreads(hwthreads []int) (memDoms []int, exclusive bool) {
|
||||||
|
memDomsMap := map[int]int{}
|
||||||
|
for _, hwthread := range hwthreads {
|
||||||
|
for memDom, hwthreadsInmemDom := range topo.MemoryDomain {
|
||||||
|
for _, hwthreadInmemDom := range hwthreadsInmemDom {
|
||||||
|
if hwthread == hwthreadInmemDom {
|
||||||
|
memDomsMap[memDom] += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exclusive = true
|
||||||
|
hwthreadsPermemDom := len(topo.Node) / len(topo.MemoryDomain)
|
||||||
|
memDoms = make([]int, 0, len(memDomsMap))
|
||||||
|
for memDom, count := range memDomsMap {
|
||||||
|
memDoms = append(memDoms, memDom)
|
||||||
|
exclusive = exclusive && count == hwthreadsPermemDom
|
||||||
|
}
|
||||||
|
|
||||||
|
return memDoms, exclusive
|
||||||
|
}
|
||||||
|
|
||||||
func (topo *Topology) GetAcceleratorIDs() ([]int, error) {
|
func (topo *Topology) GetAcceleratorIDs() ([]int, error) {
|
||||||
accels := make([]int, 0)
|
accels := make([]int, 0)
|
||||||
for _, accel := range topo.Accelerators {
|
for _, accel := range topo.Accelerators {
|
||||||
|
@ -203,10 +203,11 @@ func (ccms *CCMetricStore) LoadData(job *schema.Job, metrics []string, scopes []
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
hwthreadString = string("cpu") // TODO/FIXME: inconsistency between cc-metric-collector and ClusterCockpit
|
hwthreadString = string("cpu") // TODO/FIXME: inconsistency between cc-metric-collector and ClusterCockpit
|
||||||
coreString = string(schema.MetricScopeCore)
|
coreString = string(schema.MetricScopeCore)
|
||||||
socketString = string(schema.MetricScopeSocket)
|
memoryDomainString = string(schema.MetricScopeMemoryDomain)
|
||||||
acceleratorString = string(schema.MetricScopeAccelerator)
|
socketString = string(schema.MetricScopeSocket)
|
||||||
|
acceleratorString = string(schema.MetricScopeAccelerator)
|
||||||
)
|
)
|
||||||
|
|
||||||
func (ccms *CCMetricStore) buildQueries(job *schema.Job, metrics []string, scopes []schema.MetricScope) ([]ApiQuery, []schema.MetricScope, error) {
|
func (ccms *CCMetricStore) buildQueries(job *schema.Job, metrics []string, scopes []schema.MetricScope) ([]ApiQuery, []schema.MetricScope, error) {
|
||||||
@ -359,6 +360,34 @@ func (ccms *CCMetricStore) buildQueries(job *schema.Job, metrics []string, scope
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MemoryDomain -> MemoryDomain
|
||||||
|
if nativeScope == schema.MetricScopeMemoryDomain && scope == schema.MetricScopeMemoryDomain {
|
||||||
|
sockets, _ := topology.GetMemoryDomainsFromHWThreads(hwthreads)
|
||||||
|
queries = append(queries, ApiQuery{
|
||||||
|
Metric: remoteName,
|
||||||
|
Hostname: host.Hostname,
|
||||||
|
Aggregate: false,
|
||||||
|
Type: &memoryDomainString,
|
||||||
|
TypeIds: sockets,
|
||||||
|
})
|
||||||
|
assignedScope = append(assignedScope, scope)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// MemoryDoman -> Node
|
||||||
|
if nativeScope == schema.MetricScopeMemoryDomain && scope == schema.MetricScopeNode {
|
||||||
|
sockets, _ := topology.GetMemoryDomainsFromHWThreads(hwthreads)
|
||||||
|
queries = append(queries, ApiQuery{
|
||||||
|
Metric: remoteName,
|
||||||
|
Hostname: host.Hostname,
|
||||||
|
Aggregate: true,
|
||||||
|
Type: &memoryDomainString,
|
||||||
|
TypeIds: sockets,
|
||||||
|
})
|
||||||
|
assignedScope = append(assignedScope, scope)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Socket -> Socket
|
// Socket -> Socket
|
||||||
if nativeScope == schema.MetricScopeSocket && scope == schema.MetricScopeSocket {
|
if nativeScope == schema.MetricScopeSocket && scope == schema.MetricScopeSocket {
|
||||||
sockets, _ := topology.GetSocketsFromHWThreads(hwthreads)
|
sockets, _ := topology.GetSocketsFromHWThreads(hwthreads)
|
||||||
|
@ -43,19 +43,21 @@ type MetricScope string
|
|||||||
const (
|
const (
|
||||||
MetricScopeInvalid MetricScope = "invalid_scope"
|
MetricScopeInvalid MetricScope = "invalid_scope"
|
||||||
|
|
||||||
MetricScopeNode MetricScope = "node"
|
MetricScopeNode MetricScope = "node"
|
||||||
MetricScopeSocket MetricScope = "socket"
|
MetricScopeSocket MetricScope = "socket"
|
||||||
MetricScopeCore MetricScope = "core"
|
MetricScopeMemoryDomain MetricScope = "memoryDomain"
|
||||||
MetricScopeHWThread MetricScope = "hwthread"
|
MetricScopeCore MetricScope = "core"
|
||||||
|
MetricScopeHWThread MetricScope = "hwthread"
|
||||||
|
|
||||||
MetricScopeAccelerator MetricScope = "accelerator"
|
MetricScopeAccelerator MetricScope = "accelerator"
|
||||||
)
|
)
|
||||||
|
|
||||||
var metricScopeGranularity map[MetricScope]int = map[MetricScope]int{
|
var metricScopeGranularity map[MetricScope]int = map[MetricScope]int{
|
||||||
MetricScopeNode: 10,
|
MetricScopeNode: 10,
|
||||||
MetricScopeSocket: 5,
|
MetricScopeSocket: 5,
|
||||||
MetricScopeCore: 2,
|
MetricScopeMemoryDomain: 3,
|
||||||
MetricScopeHWThread: 1,
|
MetricScopeCore: 2,
|
||||||
|
MetricScopeHWThread: 1,
|
||||||
|
|
||||||
MetricScopeAccelerator: 5, // Special/Randomly choosen
|
MetricScopeAccelerator: 5, // Special/Randomly choosen
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user