summaryrefslogtreecommitdiff
path: root/src/metric.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/metric.c')
-rw-r--r--src/metric.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/metric.c b/src/metric.c
index f509805..f3e8d06 100644
--- a/src/metric.c
+++ b/src/metric.c
@@ -17,6 +17,9 @@ static void tmr_handler(void *arg)
tmr_start(&metric->tmr, TMR_INTERVAL * 1000, tmr_handler, metric);
+ if (!metric->started)
+ return;
+
if (now <= metric->ts_last)
return;
@@ -38,12 +41,20 @@ static void metric_start(struct metric *metric)
return;
metric->ts_start = tmr_jiffies();
- tmr_start(&metric->tmr, 1, tmr_handler, metric);
metric->started = true;
}
+void metric_init(struct metric *metric)
+{
+ if (!metric)
+ return;
+
+ tmr_start(&metric->tmr, 100, tmr_handler, metric);
+}
+
+
void metric_reset(struct metric *metric)
{
if (!metric)