mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 05:19:05 +01:00
Allocate reference variables on heap
This commit is contained in:
parent
1f8c6064e2
commit
cf6c217f76
@ -82,10 +82,11 @@ func deepCopyJobData(d *JobData) schema.JobData {
|
|||||||
mn.Series = make([]schema.Series, len(mv.Series))
|
mn.Series = make([]schema.Series, len(mv.Series))
|
||||||
|
|
||||||
for _, v := range mv.Series {
|
for _, v := range mv.Series {
|
||||||
|
var id *string = new(string)
|
||||||
var sn schema.Series
|
var sn schema.Series
|
||||||
sn.Hostname = v.Hostname
|
sn.Hostname = v.Hostname
|
||||||
id := fmt.Sprint(*v.Id)
|
*id = fmt.Sprint(*v.Id)
|
||||||
sn.Id = &id
|
sn.Id = id
|
||||||
sn.Statistics = schema.MetricStatistics{
|
sn.Statistics = schema.MetricStatistics{
|
||||||
Avg: v.Statistics.Avg,
|
Avg: v.Statistics.Avg,
|
||||||
Min: v.Statistics.Min,
|
Min: v.Statistics.Min,
|
||||||
@ -120,15 +121,16 @@ func deepCopyClusterConfig(co *Cluster) schema.Cluster {
|
|||||||
scn.SocketsPerNode = sco.SocketsPerNode
|
scn.SocketsPerNode = sco.SocketsPerNode
|
||||||
scn.CoresPerSocket = sco.CoresPerSocket
|
scn.CoresPerSocket = sco.CoresPerSocket
|
||||||
scn.ThreadsPerCore = sco.ThreadsPerCore
|
scn.ThreadsPerCore = sco.ThreadsPerCore
|
||||||
prefix := "G"
|
var prefix *string = new(string)
|
||||||
|
*prefix = "G"
|
||||||
scn.FlopRateScalar = schema.MetricValue{
|
scn.FlopRateScalar = schema.MetricValue{
|
||||||
Unit: schema.Unit{Base: "F/s", Prefix: &prefix},
|
Unit: schema.Unit{Base: "F/s", Prefix: prefix},
|
||||||
Value: float64(sco.FlopRateScalar)}
|
Value: float64(sco.FlopRateScalar)}
|
||||||
scn.FlopRateSimd = schema.MetricValue{
|
scn.FlopRateSimd = schema.MetricValue{
|
||||||
Unit: schema.Unit{Base: "F/s", Prefix: &prefix},
|
Unit: schema.Unit{Base: "F/s", Prefix: prefix},
|
||||||
Value: float64(sco.FlopRateSimd)}
|
Value: float64(sco.FlopRateSimd)}
|
||||||
scn.MemoryBandwidth = schema.MetricValue{
|
scn.MemoryBandwidth = schema.MetricValue{
|
||||||
Unit: schema.Unit{Base: "B/s", Prefix: &prefix},
|
Unit: schema.Unit{Base: "B/s", Prefix: prefix},
|
||||||
Value: float64(sco.MemoryBandwidth)}
|
Value: float64(sco.MemoryBandwidth)}
|
||||||
scn.Topology = *sco.Topology
|
scn.Topology = *sco.Topology
|
||||||
cn.SubClusters = append(cn.SubClusters, &scn)
|
cn.SubClusters = append(cn.SubClusters, &scn)
|
||||||
|
Loading…
Reference in New Issue
Block a user