Commit 91250eb0 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

The "updates" field now counts incremental updates of avenrun.

(update_history): Adjusted.
(update_one_stat): Adjusted.
(check_one_stat): Adjusted.
parent 7648495a
......@@ -187,9 +187,13 @@ update_history(struct avg_status *s,
for (; s->when.tv_sec < end; s->when.tv_sec++)
{
for (i = 0; i < N_FACTS; i++)
{
s->avenrun[i] += (value - s->avg_history[ind(s->when.tv_sec,
factors[i])])
/ (double)factors[i];
s->updates[i]++;
}
s->avg_history[ind(s->when.tv_sec, 0)] = value;
}
......@@ -247,7 +251,10 @@ update_one_stat(enum stat_type st,
s->value = 0;
}
for (i = 0; i < N_FACTS; i++)
{
s->avenrun[i] = s->value;
s->updates[i] = 0;
}
for (i = 0; i < HISTORY_LENGTH; i++)
s->avg_history[i] = s->value;
if (vt == VT_AVG)
......@@ -256,8 +263,6 @@ update_one_stat(enum stat_type st,
}
s->value += delta;
for (i = 0; i < N_FACTS; i++)
s->updates[i]++;
if (s->value < 0)
{
kom_log("update_stat(%d, %ld): current value became negative: %ld\n",
......@@ -347,9 +352,9 @@ check_one_stat(enum stat_type st,
when,
s->updates[f], st, vt, f, factors[f],
s->avenrun[f], acc);
s->updates[f] = 0;
}
s->avenrun[f] = acc;
s->updates[f] = 0;
s->max_seen[f] = acc;
changes++;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment