mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
hist: use hist_{last,highest,lowest,mean} functions
This commit is contained in:
parent
26b0cc6d19
commit
402f38d526
2 changed files with 9 additions and 7 deletions
|
@ -58,6 +58,8 @@ struct hist {
|
|||
};
|
||||
|
||||
#define hist_last(h) ((h)->last)
|
||||
#define hist_highest(h) ((h)->highest)
|
||||
#define hist_lowest(h) ((h)->lowest)
|
||||
#define hist_total(h) ((h)->total)
|
||||
|
||||
/** Initialize struct hist with supplied values and allocate memory for buckets. */
|
||||
|
|
14
lib/stats.c
14
lib/stats.c
|
@ -143,10 +143,10 @@ json_t * stats_json_periodic(struct stats *s, struct path *p)
|
|||
{
|
||||
return json_pack("{ s: s, s: f, s: f, s: i, s: i }"
|
||||
"path", path_name(p),
|
||||
"owd", s->histograms[STATS_OWD].last,
|
||||
"rate", 1.0 / s->histograms[STATS_GAP_SAMPLE].last,
|
||||
"dropped", s->histograms[STATS_REORDERED].total,
|
||||
"skipped", s->histograms[STATS_SKIPPED].total
|
||||
"owd", hist_last(&s->histograms[STATS_OWD])
|
||||
"rate", 1.0 / hist_last(&s->histograms[STATS_GAP_SAMPLE]),
|
||||
"dropped", hist_total(&s->histograms[STATS_REORDERED]),
|
||||
"skipped", host_ttotal(&s->histograms[STATS_SKIPPED])
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -252,9 +252,9 @@ void stats_send(struct stats *s, struct node *n)
|
|||
int i = 0;
|
||||
|
||||
for (int j = 0; j < STATS_COUNT; j++) {
|
||||
smp->data[i++].f = s->histograms[j].last;
|
||||
smp->data[i++].f = s->histograms[j].highest;
|
||||
smp->data[i++].f = s->histograms[j].lowest;
|
||||
smp->data[i++].f = hist_last(&s->histograms[j]);
|
||||
smp->data[i++].f = hist_highest(&s->histograms[j]);
|
||||
smp->data[i++].f = hist_lowest(&s->histograms[j]);
|
||||
smp->data[i++].f = hist_mean(&s->histograms[j]);
|
||||
smp->data[i++].f = hist_var(&s->histograms[j]);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue