mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 13:29:05 +01:00
Merge branch 'sample_resolution_select' of https://github.com/ClusterCockpit/cc-backend into sample_resolution_select
This commit is contained in:
commit
5cc7fc6ccb
@ -528,14 +528,14 @@ func (ccms *CCMetricStore) LoadStats(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
) (map[string]map[string]schema.MetricStatistics, error) {
|
) (map[string]map[string]schema.MetricStatistics, error) {
|
||||||
|
|
||||||
metricConfigs := archive.GetCluster(job.Cluster).MetricConfig
|
// metricConfigs := archive.GetCluster(job.Cluster).MetricConfig
|
||||||
resolution := 9000
|
// resolution := 9000
|
||||||
|
|
||||||
for _, mc := range metricConfigs {
|
// for _, mc := range metricConfigs {
|
||||||
resolution = min(resolution, mc.Timestep)
|
// resolution = min(resolution, mc.Timestep)
|
||||||
}
|
// }
|
||||||
|
|
||||||
queries, _, err := ccms.buildQueries(job, metrics, []schema.MetricScope{schema.MetricScopeNode}, resolution) // #166 Add scope shere for analysis view accelerator normalization?
|
queries, _, err := ccms.buildQueries(job, metrics, []schema.MetricScope{schema.MetricScopeNode}, 0) // #166 Add scope shere for analysis view accelerator normalization?
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn("Error while building query")
|
log.Warn("Error while building query")
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -90,6 +90,7 @@ func LargestTriangleThreeBucket(data []schema.Float, old_frequency int, new_freq
|
|||||||
maxArea := -1.0
|
maxArea := -1.0
|
||||||
|
|
||||||
var maxAreaPoint int
|
var maxAreaPoint int
|
||||||
|
flag_ := 0
|
||||||
for ; currBucketStart < currBucketEnd; currBucketStart++ {
|
for ; currBucketStart < currBucketEnd; currBucketStart++ {
|
||||||
|
|
||||||
area := calculateTriangleArea(schema.Float(pointX), pointY, avgPointX, avgPointY, schema.Float(currBucketStart), data[currBucketStart])
|
area := calculateTriangleArea(schema.Float(pointX), pointY, avgPointX, avgPointY, schema.Float(currBucketStart), data[currBucketStart])
|
||||||
@ -97,10 +98,19 @@ func LargestTriangleThreeBucket(data []schema.Float, old_frequency int, new_freq
|
|||||||
maxArea = area
|
maxArea = area
|
||||||
maxAreaPoint = currBucketStart
|
maxAreaPoint = currBucketStart
|
||||||
}
|
}
|
||||||
|
if math.IsNaN(float64(avgPointY)) {
|
||||||
|
flag_ = 1
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new_data = append(new_data, data[maxAreaPoint]) // Pick this point from the bucket
|
if flag_ == 1 {
|
||||||
prevMaxAreaPoint = maxAreaPoint // This MaxArea point is the next's prevMAxAreaPoint
|
new_data = append(new_data, schema.NaN) // Pick this point from the bucket
|
||||||
|
|
||||||
|
} else {
|
||||||
|
new_data = append(new_data, data[maxAreaPoint]) // Pick this point from the bucket
|
||||||
|
}
|
||||||
|
prevMaxAreaPoint = maxAreaPoint // This MaxArea point is the next's prevMAxAreaPoint
|
||||||
|
|
||||||
//move to the next window
|
//move to the next window
|
||||||
bucketLow = bucketMiddle
|
bucketLow = bucketMiddle
|
||||||
|
@ -12,14 +12,24 @@ func calculateTriangleArea(paX, paY, pbX, pbY, pcX, pcY schema.Float) float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func calculateAverageDataPoint(points []schema.Float, xStart int64) (avgX schema.Float, avgY schema.Float) {
|
func calculateAverageDataPoint(points []schema.Float, xStart int64) (avgX schema.Float, avgY schema.Float) {
|
||||||
|
flag := 0
|
||||||
for _, point := range points {
|
for _, point := range points {
|
||||||
avgX += schema.Float(xStart)
|
avgX += schema.Float(xStart)
|
||||||
avgY += point
|
avgY += point
|
||||||
xStart++
|
xStart++
|
||||||
|
if math.IsNaN(float64(point)) {
|
||||||
|
flag = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
l := schema.Float(len(points))
|
l := schema.Float(len(points))
|
||||||
|
|
||||||
avgX /= l
|
avgX /= l
|
||||||
avgY /= l
|
avgY /= l
|
||||||
return avgX, avgY
|
|
||||||
|
if flag == 1 {
|
||||||
|
return avgX, schema.NaN
|
||||||
|
} else {
|
||||||
|
return avgX, avgY
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user