library <stat>: improve response to cpu offline/online
With the addition of those new derived SUM values, any
CPUs taken offline or brought online would distort the
historical (delta) results. So this patch just forces
a history reset when such transitions are encountered.
Reference(s):
. derived SUM provisions introduced
commit 2c86c4984a
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
f82ac70e13
commit
282ee362f0
11
proc/stat.c
11
proc/stat.c
@ -76,6 +76,7 @@ struct hist_sys {
|
||||
|
||||
struct hist_tic {
|
||||
int id;
|
||||
int id_sav;
|
||||
int numa_node;
|
||||
int count;
|
||||
struct stat_jifs new;
|
||||
@ -635,14 +636,16 @@ reap_em_again:
|
||||
, &cpu_ptr->new.idle, &cpu_ptr->new.iowait, &cpu_ptr->new.irq
|
||||
, &cpu_ptr->new.sirq, &cpu_ptr->new.stolen
|
||||
, &cpu_ptr->new.guest, &cpu_ptr->new.gnice))) {
|
||||
int id_sav = cpu_ptr->id;
|
||||
memmove(cpu_ptr, sum_ptr, sizeof(struct hist_tic));
|
||||
cpu_ptr->id = id_sav;
|
||||
cpu_ptr->id_sav = -1;
|
||||
break; // we must tolerate cpus taken offline
|
||||
}
|
||||
stat_derive_unique(cpu_ptr);
|
||||
++i;
|
||||
// don't distort deltas when a cpu is taken offline or brought online
|
||||
if (cpu_ptr->id != cpu_ptr->id_sav)
|
||||
memcpy(&cpu_ptr->old, &cpu_ptr->new, sizeof(struct stat_jifs));
|
||||
cpu_ptr->id_sav = cpu_ptr->id;
|
||||
++cpu_ptr;
|
||||
++i;
|
||||
} while (i < info->cpus.hist.n_alloc);
|
||||
|
||||
if (i == info->cpus.hist.n_alloc && rc >= 8) {
|
||||
|
Loading…
Reference in New Issue
Block a user