Commit 1af90683 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(struct avg_status): New field: max_seen.

(dump_stats): Print the max_seen field.
(init_stats): Initialize it.
(update_history): Update it.
(check_one_stat): Take max_seen into account when deciding if a
	message should be logged or not.  Reset max_seen if a new
	value is stored.
parent 28e763ab
......@@ -72,6 +72,7 @@ struct avg_status {
float avg_history[HISTORY_LENGTH];
double avenrun[N_FACTS];
long updates[N_FACTS];
float max_seen[N_FACTS];
};
static struct avg_status status[NUM_STAT][NUM_VT];
......@@ -129,6 +130,9 @@ dump_stats(struct avg_status s[NUM_STAT][NUM_VT])
fprintf(stderr, "\n updates:");
for (i = 0; i < N_FACTS; i++)
fprintf(stderr, " %ld", s[st][vt].updates[i]);
fprintf(stderr, "\n max_seen:");
for (i = 0; i < N_FACTS; i++)
fprintf(stderr, " %g", s[st][vt].max_seen[i]);
fprintf(stderr, "\n history:");
for (i = 0; i < HISTORY_LENGTH; i++)
fprintf(stderr, " %f", s[st][vt].avg_history[i]);
......@@ -163,6 +167,7 @@ init_stats(void)
{
status[st][vt].avenrun[i] = 0.0;
status[st][vt].updates[i] = 0;
status[st][vt].max_seen[i] = 0.0;
}
}
}
......@@ -175,6 +180,10 @@ update_history(struct avg_status *s,
{
int i;
for (i = 0; i < N_FACTS; i++)
if (value > s->max_seen[i])
s->max_seen[i] = value;
for (; s->when.tv_sec < end; s->when.tv_sec++)
{
for (i = 0; i < N_FACTS; i++)
......@@ -339,7 +348,7 @@ check_one_stat(enum stat_type st,
|| (acc >= 1 && err / acc > 1e-5))
{
/* Don't bother logging assignments to 0. */
if (is_nonzero(acc) || err > 1e-10)
if (is_nonzero(acc) || err > 1e-7 * s->max_seen[f])
{
kom_log("Accumulated rounding errors fixed (%s) after"
" %ld updates (st=%d, vt=%d, f=%d, factor=%d):"
......@@ -350,6 +359,7 @@ check_one_stat(enum stat_type st,
s->updates[f] = 0;
}
s->avenrun[f] = acc;
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