From b1dbfb4c4179a62cd4b761ebdc7a3c2de5bdc0d9 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 26 Oct 2015 11:58:38 +0100 Subject: stats: Implement timer based reporting This calls stats_flush in regular intervals which polls the statistical values and calls the active reporters when values have changed. Sponsored-by: On-Waves ehf --- include/osmocom/core/stats.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/osmocom/core/stats.h b/include/osmocom/core/stats.h index b4fb727c..489e0e41 100644 --- a/include/osmocom/core/stats.h +++ b/include/osmocom/core/stats.h @@ -32,7 +32,6 @@ struct stats_reporter { /* config */ int enabled; - int interval; char *name_prefix; char *dest_addr_str; char *bind_addr_str; @@ -50,9 +49,17 @@ struct stats_reporter { struct llist_head list; }; +struct stats_config { + int interval; +}; + +extern struct stats_config *stats_config; + void stats_init(void *ctx); int stats_report(); +int stats_set_interval(int interval); + struct stats_reporter *stats_reporter_alloc(enum stats_reporter_type type, const char *name); void stats_reporter_free(struct stats_reporter *srep); @@ -64,7 +71,6 @@ struct stats_reporter *stats_reporter_find(enum stats_reporter_type type, int stats_reporter_set_remote_addr(struct stats_reporter *srep, const char *addr); int stats_reporter_set_remote_port(struct stats_reporter *srep, int port); int stats_reporter_set_local_addr(struct stats_reporter *srep, const char *addr); -int stats_reporter_set_interval(struct stats_reporter *srep, int interval); int stats_reporter_set_name_prefix(struct stats_reporter *srep, const char *prefix); int stats_reporter_enable(struct stats_reporter *srep); int stats_reporter_disable(struct stats_reporter *srep); -- cgit v1.2.3