diff options
author | Marian Gasparovic <[email protected]> | 2018-02-04 18:36:36 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-02-04 19:15:28 +0100 |
commit | e6d55cba85fc49b3dfac8150c397540bda369847 (patch) | |
tree | de6d8272b079641679b718258d4be7d9adc1594d /multiload/linux-proc.c | |
parent | 560c27fb0638d41fe39ad0e0719dd6153b17eea0 (diff) | |
download | mate-applets-e6d55cba85fc49b3dfac8150c397540bda369847.tar.bz2 mate-applets-e6d55cba85fc49b3dfac8150c397540bda369847.tar.xz |
Scaling network graph using thresholds defined by user
Diffstat (limited to 'multiload/linux-proc.c')
-rw-r--r-- | multiload/linux-proc.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/multiload/linux-proc.c b/multiload/linux-proc.c index 96754092..0e4624d6 100644 --- a/multiload/linux-proc.c +++ b/multiload/linux-proc.c @@ -373,26 +373,22 @@ GetNet (int Maximum, int data [4], LoadGraph *g) int max; int total = 0; - for (i = 0; i < COUNT_TYPES; i++) - { - /* protect against weirdness */ - if (present[i] >= past[i]) - delta[i] = (present[i] - past[i]); - else - delta[i] = 0; - total += delta[i]; - } + for (i = 0; i < COUNT_TYPES; i++) + { + /* protect against weirdness */ + if (present[i] >= past[i]) + delta[i] = (present[i] - past[i]); + else + delta[i] = 0; + total += delta[i]; + } - max = autoscaler_get_max(&scaler, total); + //max = autoscaler_get_max(&scaler, total); - for (i = 0; i < COUNT_TYPES; i++) - data[i] = rint (Maximum * (float)delta[i] / max); - } + for (i = 0; i < COUNT_TYPES; i++) + data[i] = delta[i]; - //data[4] = Maximum - data[3] - data[2] - data[1] - data[0]; - data[COUNT_TYPES] = Maximum; - for (i = 0; i < COUNT_TYPES; i++) - data[COUNT_TYPES] -= data[i]; + } memcpy(past, present, sizeof past); } |