summaryrefslogtreecommitdiff
path: root/multiload/src
diff options
context:
space:
mode:
Diffstat (limited to 'multiload/src')
-rw-r--r--multiload/src/linux-proc.c14
-rw-r--r--multiload/src/load-graph.c8
2 files changed, 7 insertions, 15 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);
diff --git a/multiload/src/load-graph.c b/multiload/src/load-graph.c
index d613ed59..c9ed8d03 100644
--- a/multiload/src/load-graph.c
+++ b/multiload/src/load-graph.c
@@ -96,17 +96,13 @@ load_graph_draw (LoadGraph *g)
{
guint maxnet = 1;
gint segments = 1;
- gint combined;
guint net_threshold;
for (i = 0; i < g->draw_width; i++)
{
g->pos [i] = g->draw_height - 1;
- combined = g->data[i][0] +
- g->data[i][1] +
- g->data[i][2];
- if (combined > maxnet)
- maxnet = combined;
+ if (g->data[i][3] > maxnet)
+ maxnet = g->data[i][3];
}
//printf("max = %d ", maxnet);
guint level = 0;