mpstat: Fix missing sample after physically hotplugging vCPU
When a vCPU is physically hotplugged, mpstat with its option -H skips
one line of statistics:
$ ./mpstat -H -P ALL 5 5
Linux 5.4.17-2136.310.7.1.el8uek.x86_64 (localhost.localdomain) 10/10/2022 x86_64 (3 CPU)
10:11:22 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
10:11:27 AM all 0.07 0.00 0.07 0.00 0.07 0.00 0.00 0.00 0.00 99.80
10:11:27 AM 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
10:11:27 AM 1 0.20 0.00 0.20 0.00 0.20 0.00 0.00 0.00 0.00 99.40
10:11:27 AM 2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
10:11:27 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
10:11:32 AM all 0.00 0.00 0.07 0.00 0.07 0.00 0.00 0.00 0.00 99.87
10:11:32 AM 0 0.00 0.00 0.00 0.00 0.20 0.00 0.00 0.00 0.00 99.80
10:11:32 AM 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
10:11:32 AM 2 0.00 0.00 0.20 0.00 0.00 0.00 0.00 0.00 0.00 99.80
[ 1154.848226] CPU3 has been hot-added
[ 1154.862315] smpboot: Booting Node 0 Processor 3 APIC 0x3
[ 1154.863956] kvm-clock: cpu 3, msr
adc010c1, secondary cpu clock
[ 1154.884436] KVM setup async PF for cpu 3
[ 1154.886055] kvm-stealtime: cpu 3, msr
13b9b2040
[ 1154.887657] Will online and init hotplugged CPU: 3
10:11:32 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
<<<<<<< No sample for 10:11:37 >>>>>>>
10:11:42 AM all 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
10:11:42 AM 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
10:11:42 AM 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
10:11:42 AM 2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
10:11:42 AM 3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
This patch makes sure that we get a line of stats for every interval of
time, even when a vCPU is physically hotplugged.
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>