forked from compulab/i3m-linux-daemon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.c
52 lines (39 loc) · 1008 Bytes
/
stats.c
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Copyright (C) 2015, CompuLab ltd.
* Author: Andrey Gelman <andrey.gelman@compulab.co.il>
* License: GNU GPLv2 or later, at your option
*/
#include <string.h>
#include <stdio.h>
#include "common.h"
typedef struct {
unsigned int show_counter;
unsigned long i2c_trans_write;
unsigned long i2c_trans_read;
unsigned long watchdog_list_length;
} Statistics;
static Statistics atfp_stat = {0};
void stat_reset(void)
{
memset(&atfp_stat, 0, sizeof(Statistics));
}
void stat_show(void)
{
atfp_stat.show_counter++;
slogn("ATFP Statistics: %d", atfp_stat.show_counter);
slogn("i2c write transactions: %ld", atfp_stat.i2c_trans_write);
slogn("i2c read transactions: %ld", atfp_stat.i2c_trans_read);
slogn("watchdog list length: %ld", atfp_stat.watchdog_list_length);
}
void stat_inc_i2c_write_count(void)
{
atfp_stat.i2c_trans_write++;
}
void stat_inc_i2c_read_count(void)
{
atfp_stat.i2c_trans_read++;
}
void stat_inc_watchdog_list_length(void)
{
atfp_stat.watchdog_list_length++;
}