File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -205,8 +205,14 @@ func (c *CPUStats) monitorProcesses() {
205205 }
206206
207207 for pid , stat := range procStats {
208+ pidForGroup := pid
209+ for ppids [pidForGroup ] != self .PID && ppids [pidForGroup ] != 0 {
210+ // bundle usage up to first child of main go process
211+ pidForGroup = ppids [pidForGroup ]
212+ }
213+
208214 memory := stat .RSS * pageSize
209- stats .Memory [pid ] += memory
215+ stats .Memory [pidForGroup ] += memory
210216 stats .MemoryTotal += memory
211217
212218 // process usage as percent of total host cpu
@@ -215,13 +221,8 @@ func (c *CPUStats) monitorProcesses() {
215221 continue
216222 }
217223
218- for ppids [pid ] != self .PID && ppids [pid ] != 0 {
219- // bundle usage up to first child of main go process
220- pid = ppids [pid ]
221- }
222-
223224 cpu := hostCPU * procPercentUsage / 100 / (totalHostTime - prevTotalTime )
224- stats .Cpu [pid ] += cpu
225+ stats .Cpu [pidForGroup ] += cpu
225226 stats .CpuIdle -= cpu
226227 }
227228
You can’t perform that action at this time.
0 commit comments