Using named variables

This commit is contained in:
Diptanu Choudhury
2016-06-10 04:45:16 +01:00
parent 8d52390aca
commit 06e90cb6c0
2 changed files with 12 additions and 2 deletions

View File

@@ -741,7 +741,12 @@ func (e *UniversalExecutor) scanPids(parentPid int, allPids []ps.Process) ([]*no
}
res := make([]*nomadPid, 0, len(processFamily))
for pid := range processFamily {
res = append(res, &nomadPid{pid, stats.NewCpuStats(), stats.NewCpuStats(), stats.NewCpuStats()})
res = append(res, &nomadPid{
pid: pid,
cpuStatsTotal: stats.NewCpuStats(),
cpuStatsUser: stats.NewCpuStats(),
cpuStatsSys: stats.NewCpuStats(),
})
}
return res, nil
}

View File

@@ -271,7 +271,12 @@ func (e *UniversalExecutor) getAllPids() ([]*nomadPid, error) {
}
np := make([]*nomadPid, len(pids))
for idx, pid := range pids {
np[idx] = &nomadPid{pid, stats.NewCpuStats(), stats.NewCpuStats(), stats.NewCpuStats()}
np[idx] = &nomadPid{
pid: pid,
cpuStatsTotal: stats.NewCpuStats(),
cpuStatsSys: stats.NewCpuStats(),
cpuStatsUser: stats.NewCpuStats(),
}
}
return np, nil
}