diff options
author | rbuj <[email protected]> | 2020-12-15 06:19:38 +0100 |
---|---|---|
committer | Victor Kareh <[email protected]> | 2020-12-17 07:29:54 -0500 |
commit | 99d8c51f427590660ac0c023b90ccf9009db0b17 (patch) | |
tree | c762e2fcdd42ca016d8b7552623942101d0add52 /multiload/src/linux-proc.c | |
parent | 60cb54fb957857fb64dd93b878b46710948de750 (diff) | |
download | mate-applets-99d8c51f427590660ac0c023b90ccf9009db0b17.tar.bz2 mate-applets-99d8c51f427590660ac0c023b90ccf9009db0b17.tar.xz |
multiload: compute combined network data on GetNet once
Diffstat (limited to 'multiload/src/linux-proc.c')
-rw-r--r-- | multiload/src/linux-proc.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/multiload/src/linux-proc.c b/multiload/src/linux-proc.c index 7e4da605..95d2599c 100644 --- a/multiload/src/linux-proc.c +++ b/multiload/src/linux-proc.c @@ -411,24 +411,20 @@ GetNet (int Maximum, if(ticks < 2) /* avoid initial spike */ { ticks++; - memset(data, 0, COUNT_TYPES * sizeof data[0]); + memset(data, 0, (COUNT_TYPES + 1) * sizeof data[0]); } else { - int delta[COUNT_TYPES]; - + data[COUNT_TYPES] = 0; for (i = 0; i < COUNT_TYPES; i++) { /* protect against weirdness */ if (present[i] >= past[i]) - delta[i] = (present[i] - past[i]); + data[i] = (present[i] - past[i]); else - delta[i] = 0; + data[i] = 0; + data[COUNT_TYPES] += data[i]; } - - for (i = 0; i < COUNT_TYPES; i++) - data[i] = delta[i]; - } memcpy(past, present, sizeof past); |