File: stats.h

package info (click to toggle)
rauc 1.15-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,336 kB
  • sloc: ansic: 36,989; python: 3,354; sh: 1,391; xml: 53; makefile: 41
file content (29 lines) | stat: -rw-r--r-- 654 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once

#include <glib.h>

typedef struct {
	gchar *label;
	gdouble values[64];
	guint64 count, next;
	gdouble sum;
	gdouble min, max;
} RaucStats;

RaucStats *r_stats_new(const gchar *label);

void r_stats_add(RaucStats *stats, gdouble value);

gdouble r_stats_get_avg(const RaucStats *stats);

gdouble r_stats_get_recent_avg(const RaucStats *stats);

void r_stats_show(const RaucStats *stats, const gchar *prefix);

void r_stats_free(RaucStats *stats);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(RaucStats, r_stats_free);

/* additional functions for testing */
void r_test_stats_start(void);
void r_test_stats_stop(void);
RaucStats *r_test_stats_next(void);