sar: Softnet stats: Improve support for offline/online CPUs
When a CPU goes offline, the corresponding line in the
/proc/net/softnet_stat file disappears. The problem is that there is no
immediate solution to know which line goes with which CPU.
To fix this, we now use the /proc/stat file to know which CPU are online
and which ones are not.
Moreover, when a CPU comes back online, its counters get their original
values, which makes sar think they have just jumped from 0:
This is what sar displayed before (in this example, CPU 5 goes offline):
10:19:39 CPU total/s dropd/s squeezd/s rx_rps/s flw_lim/s
10:19:41 all 4.00 0.00 0.00 0.00 0.00
10:19:41 0 4.00 0.00 0.00 0.00 0.00
10:19:41 1 0.00 0.00 0.00 0.00 0.00
10:19:41 2 0.00 0.00 0.00 0.00 0.00
10:19:41 3 0.00 0.00 0.00 0.00 0.00
10:19:41 4 0.00 0.00 0.00 0.00 0.00
10:19:41 5 3.00 0.00 0.00 0.00 0.00
10:19:41 6
2147483647.50 0.00 0.00 0.00
0.00
There is a shift in the display resulting in wrong values displayed for
CPU 5 and 6. CPU 7 disappears from the list.
This commit fixes those problems.
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>