From: Sebastien GODARD Date: Sun, 20 Feb 2022 08:02:10 +0000 (+0100) Subject: A_NET_SOFT: Slight optimization in get_global_soft_statistics() function X-Git-Tag: v12.5.6~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7bf60b2d73c72c8b2180140286777ffb58698ee3;p=sysstat A_NET_SOFT: Slight optimization in get_global_soft_statistics() function Signed-off-by: Sebastien GODARD --- diff --git a/sa_common.c b/sa_common.c index ff8a49d..7a116c2 100644 --- a/sa_common.c +++ b/sa_common.c @@ -3237,6 +3237,18 @@ void get_global_soft_statistics(struct activity *a, int prev, int curr, ssnc = (struct stats_softnet *) ((char *) a->buf[curr] + i * a->msize); ssnp = (struct stats_softnet *) ((char *) a->buf[prev] + i * a->msize); + if ((ssnp->processed + ssnp->dropped + ssnp->time_squeeze + + ssnp->received_rps + ssnp->flow_limit == 0) && !WANT_SINCE_BOOT(flags)) { + /* + * No previous sample for current CPU: Don't display it unless + * we want stats since last boot time. + * (CPU may be online but we don't display it because all + * its counters would appear to jump from zero...) + */ + offline_cpu_bitmap[i >> 3] |= 1 << (i & 0x07); + continue; + } + if (ssnc->processed + ssnc->dropped + ssnc->time_squeeze + ssnc->received_rps + ssnc->flow_limit == 0) { /* Assume current CPU is offline */ @@ -3244,13 +3256,6 @@ void get_global_soft_statistics(struct activity *a, int prev, int curr, offline_cpu_bitmap[i >> 3] |= 1 << (i & 0x07); } - if ((ssnp->processed + ssnp->dropped + ssnp->time_squeeze + - ssnp->received_rps + ssnp->flow_limit == 0) && !WANT_SINCE_BOOT(flags)) { - /* Current CPU back online but no previous sample for it */ - offline_cpu_bitmap[i >> 3] |= 1 << (i & 0x07); - continue; - } - ssnc_all->processed += ssnc->processed; ssnc_all->dropped += ssnc->dropped; ssnc_all->time_squeeze += ssnc->time_squeeze;