summaryrefslogtreecommitdiff
path: root/cesar/bsu/aclf
diff options
context:
space:
mode:
authorNélio Laranjeiro2011-01-28 09:45:32 +0100
committerNélio Laranjeiro2011-02-07 16:15:33 +0100
commit2bd01b5e3f6a743c76c4538e5c41bab0d94dbb89 (patch)
treee895fdda2c7500d6468e38f7117451e6dfedcabe /cesar/bsu/aclf
parent9d4af2b967ff358aae1744d473175f472df07cf6 (diff)
cesar/bsu/aclf: add stats for beacon period, refs #2213
Diffstat (limited to 'cesar/bsu/aclf')
-rw-r--r--cesar/bsu/aclf/aclf.h1
-rw-r--r--cesar/bsu/aclf/src/aclf.c18
-rw-r--r--cesar/bsu/aclf/test/utest/src/aclf.c2
3 files changed, 21 insertions, 0 deletions
diff --git a/cesar/bsu/aclf/aclf.h b/cesar/bsu/aclf/aclf.h
index 19b873694d..c135dcc862 100644
--- a/cesar/bsu/aclf/aclf.h
+++ b/cesar/bsu/aclf/aclf.h
@@ -19,6 +19,7 @@
#include "mac/common/config.h"
#include "mac/common/timings.h"
#include "common/defs/homeplugAV.h"
+#include "lib/stats.h"
/** Number of beacon period start date handled.
* The value is computed to allow the CCo to compute the four next BTOs. */
diff --git a/cesar/bsu/aclf/src/aclf.c b/cesar/bsu/aclf/src/aclf.c
index 38f2a68490..8a4d382fe4 100644
--- a/cesar/bsu/aclf/src/aclf.c
+++ b/cesar/bsu/aclf/src/aclf.c
@@ -235,6 +235,23 @@ bsu_aclf_clear (bsu_aclf_t *ctx)
ctx->aclsc = false;
}
+/**
+ * Initialise stats.
+ * \param ctx the module context.
+ */
+void
+bsu_aclf_stats_init (bsu_aclf_t *ctx)
+{
+#if CONFIG_STATS
+ dbg_assert (ctx);
+ /* Register our statistics. */
+ lib_stats_set_stat_value_notype ("beacon_period_tck",
+ &ctx->beacon_period_tck,
+ LIB_STATS_ACCESS_READ_ONLY,
+ LIB_STATS_USER);
+#endif
+}
+
bsu_aclf_t*
bsu_aclf_init (phy_t *phy, mac_config_t *mac_config, hal_timer_t *timer)
{
@@ -246,6 +263,7 @@ bsu_aclf_init (phy_t *phy, mac_config_t *mac_config, hal_timer_t *timer)
ctx->mac_config = mac_config;
ctx->hal_timer = timer;
hal_timer_instance_init (timer, &ctx->timer, ctx, bsu_aclf_timer_event);
+ bsu_aclf_stats_init (ctx);
return ctx;
}
diff --git a/cesar/bsu/aclf/test/utest/src/aclf.c b/cesar/bsu/aclf/test/utest/src/aclf.c
index 651669ffb8..57193987e7 100644
--- a/cesar/bsu/aclf/test/utest/src/aclf.c
+++ b/cesar/bsu/aclf/test/utest/src/aclf.c
@@ -28,9 +28,11 @@ main (int argc, char **argv)
{
test_t test;
test_init (test, argc, argv);
+ lib_stats_init ();
test_suite_aclf__frequency (test);
test_suite_aclf__bpsd_accurate (test);
test_suite_aclf__misc (test);
+ lib_stats_uninit ();
test_result (test);
return test_nb_failed (test) == 0 ? 0 : 1;
}