summaryrefslogtreecommitdiff
path: root/multiload/src
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-12-15 08:18:27 +0100
committerVictor Kareh <[email protected]>2020-12-17 07:29:54 -0500
commit99d50b247e1ec9714ff5922cea60a29d1a864ff0 (patch)
treebd322b10b60d89c55e5231bcfef97b2d22ed63e0 /multiload/src
parent99d8c51f427590660ac0c023b90ccf9009db0b17 (diff)
downloadmate-applets-99d50b247e1ec9714ff5922cea60a29d1a864ff0.tar.bz2
mate-applets-99d50b247e1ec9714ff5922cea60a29d1a864ff0.tar.xz
multiload: use bit rate in netload graph
to avoid continuity issue when changing the update interval
Diffstat (limited to 'multiload/src')
-rw-r--r--multiload/src/linux-proc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/multiload/src/linux-proc.c b/multiload/src/linux-proc.c
index 95d2599c..5381db70 100644
--- a/multiload/src/linux-proc.c
+++ b/multiload/src/linux-proc.c
@@ -363,9 +363,9 @@ GetNet (int Maximum,
};
static int ticks = 0;
- static gulong past[COUNT_TYPES] = {0};
+ static guint64 past[COUNT_TYPES] = {0};
- gulong present[COUNT_TYPES] = {0};
+ guint64 present[COUNT_TYPES] = {0};
guint i;
gchar **devices;
@@ -416,11 +416,12 @@ GetNet (int Maximum,
else
{
data[COUNT_TYPES] = 0;
+ float seconds = (float) g->speed / 1000.0f;
for (i = 0; i < COUNT_TYPES; i++)
{
/* protect against weirdness */
if (present[i] >= past[i])
- data[i] = (present[i] - past[i]);
+ data[i] = (int) ((float) (present[i] - past[i]) / seconds);
else
data[i] = 0;
data[COUNT_TYPES] += data[i];