1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

improved statistics and debug outputs

This commit is contained in:
Steffen Vogel 2015-10-13 12:06:50 +02:00
parent cb75a2f4da
commit c5487663cc
5 changed files with 28 additions and 20 deletions

View file

@ -78,7 +78,11 @@ void info(const char *fmt, ...)
/** Printf alike warning message. */
void warn(const char *fmt, ...)
__attribute__ ((format(printf, 1, 2)));
/** Printf alike statistics message. */
void stats(const char *fmt, ...)
__attribute__ ((format(printf, 1, 2)));
/** Print error and exit. */
void error(const char *fmt, ...)
__attribute__ ((format(printf, 1, 2)));

View file

@ -103,23 +103,16 @@ double hist_stddev(struct hist *h)
void hist_print(struct hist *h)
{ INDENT
info("Total: %u values", h->total);
info("Highest value: %f", h->highest);
info("Lowest value: %f", h->lowest);
info("Mean: %f", hist_mean(h));
info("Variance: %f", hist_var(h));
info("Standard derivation: %f", hist_stddev(h));
if (h->higher > 0)
warn("Missed: %u values above %f", h->higher, h->high);
if (h->lower > 0)
warn("Missed: %u values below %f", h->lower, h->low);
stats("Counted values: %u (%u between %f and %f)", h->total, h->total-h->higher-h->lower, h->high, h->low);
stats("Highest: %f Lowest: %f", h->highest, h->lowest);
stats("Mu: %f Sigma2: %f Sigma: %f", hist_mean(h), hist_var(h), hist_stddev(h));
if (h->total - h->higher - h->lower > 0) {
hist_plot(h);
char *buf = hist_dump(h);
info("Matlab: %s", buf);
stats("Matlab: %s", buf);
free(buf);
hist_plot(h);
}
}
@ -137,13 +130,15 @@ void hist_plot(struct hist *h)
}
/* Print plot */
info("%3s | %9s | %5s | %s", "#", "Value", "Occur", "Plot");
stats("%9s | %5s | %s", "Value", "Count", "Plot");
line();
for (int i = 0; i < h->length; i++) {
int bar = HIST_HEIGHT * ((double) h->data[i] / max);
if (bar == 0)
continue;
info("%3u | %+9g | " "%5u" " | %.*s", i, VAL(h, i), h->data[i], bar, buf);
stats("%+9g | " "%5u" " | %.*s", VAL(h, i), h->data[i], bar, buf);
}
}

View file

@ -377,12 +377,12 @@ int hook_stats(struct path *p, struct hook *h, int when)
char *buf = path_print(p);
if (p->received > 0)
log_print(STATS, "%-40s|%10.2g|%10.2f|%10u|%10u|%10u|%10u|%10u|%10u|%10u|", buf,
stats("%-40s|%10.2g|%10.2f|%10u|%10u|%10u|%10u|%10u|%10u|%10u|", buf,
p->hist_owd.last, 1 / p->hist_gap_msg.last,
p->sent, p->received, p->dropped, p->skipped, p->invalid, p->overrun, list_length(p->current)
);
else
log_print(STATS, "%-40s|%10s|%10s|%10u|%10u|%10u|%10u|%10u|%10u|%10s|", buf, "", "",
stats("%-40s|%10s|%10s|%10u|%10u|%10u|%10u|%10u|%10u|%10s|", buf, "", "",
p->sent, p->received, p->dropped, p->skipped, p->invalid, p->overrun, ""
);
@ -398,7 +398,7 @@ void hook_stats_header()
{
#define UNIT(u) "(" YEL(u) ")"
log_print(STATS, "%-40s|%19s|%19s|%19s|%19s|%19s|%19s|%19s|%10s|%10s|", "Source " MAG("=>") " Destination",
stats("%-40s|%19s|%19s|%19s|%19s|%19s|%19s|%19s|%10s|%10s|", "Source " MAG("=>") " Destination",
"OWD" UNIT("S") " ",
"Rate" UNIT("p/S") " ",
"Sent" UNIT("p") " ",

View file

@ -136,6 +136,15 @@ void warn(const char *fmt, ...)
va_end(ap);
}
void stats(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
log_vprint(STATS, fmt, ap);
va_end(ap);
}
void error(const char *fmt, ...)
{
va_list ap;

View file

@ -266,7 +266,7 @@ int socket_write(struct node *n, struct msg *pool, int poolsize, int first, int
if (bytes < 0)
serror("Failed send");
debug(10, "Sent packet of %u bytes: %u samples a %u values per sample", bytes, cnt, (bytes / cnt) / 4 - 4);
debug(17, "Sent packet of %u bytes: %u samples a %u values per sample", bytes, cnt, (bytes / cnt) / 4 - 4);
return sent;
}