File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -408,9 +408,9 @@ static void LinuxMachine_scanCPUTime(LinuxMachine* this) {
408408 if (!file )
409409 CRT_fatalError ("Cannot open " PROCSTATFILE );
410410
411- // Add an extra phantom thread for a later loop
412- assert (super -> existingCPUs < UINT_MAX - 2 );
413- bool adjCpuIdProcessed [super -> existingCPUs + 2 ];
411+ // One thread per CPU thread + one for the average
412+ assert (super -> existingCPUs < UINT_MAX - 1 );
413+ bool adjCpuIdProcessed [super -> existingCPUs + 1 ];
414414 memset (adjCpuIdProcessed , 0 , sizeof (adjCpuIdProcessed ));
415415
416416 for (unsigned int i = 0 ; i <= super -> existingCPUs ; i ++ ) {
@@ -485,9 +485,7 @@ static void LinuxMachine_scanCPUTime(LinuxMachine* this) {
485485 adjCpuIdProcessed [adjCpuId ] = true;
486486 }
487487
488- // Set the extra phantom thread as checked to make sure to mark trailing offline threads correctly in the loop
489- adjCpuIdProcessed [super -> existingCPUs + 1 ] = true;
490- for (unsigned int i = 0 ; i <= super -> existingCPUs + 1 ; i ++ ) {
488+ for (unsigned int i = 0 ; i <= super -> existingCPUs ; i ++ ) {
491489 if (!adjCpuIdProcessed [i ]) {
492490 // Skipped an ID, but /proc/stat is ordered => threads in between are offline
493491 memset (& this -> cpuData [i ], 0 , sizeof (CPUData ));
You can’t perform that action at this time.
0 commit comments