aboutsummaryrefslogtreecommitdiffstats
path: root/stat.c
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2017-09-07 22:37:43 +0100
committerFreeArtMan <dos21h@gmail.com>2017-09-07 22:37:43 +0100
commit08f96759f9b1d5e8b1dd300971d23f833b819e7c (patch)
treeaa3a4010910b7a0b70e6f551a82911708c001547 /stat.c
parentd8d0925669d1e015f7290caf1a34ad756895b151 (diff)
downloadagni-08f96759f9b1d5e8b1dd300971d23f833b819e7c.tar.gz
agni-08f96759f9b1d5e8b1dd300971d23f833b819e7c.zip
Added stat command
Diffstat (limited to 'stat.c')
-rw-r--r--stat.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/stat.c b/stat.c
new file mode 100644
index 0000000..ad40490
--- /dev/null
+++ b/stat.c
@@ -0,0 +1,43 @@
+#include "stat.h"
+
+char* stat_server2str(stat_server *st)
+{
+ const int sz = 128;
+ char *str = calloc(sz, 1);
+
+ if (str == NULL)
+ {
+ return NULL;
+ }
+
+ memset(str, 0, sz);
+ snprintf(str,sz,"%d,%d,%d,%d,%d",
+ st->cnt_ping,
+ st->cnt_serv_tx,
+ st->cnt_serv_rx,
+ st->cnt_ipc_tx,
+ st->cnt_ipc_rx);
+
+ return str;
+}
+
+
+char* stat_event2str(stat_event *st)
+{
+ const int sz = 128;
+ char *str = calloc(sz, 1);
+
+ if (str == NULL)
+ {
+ return NULL;
+ }
+
+ memset(str, 0, sz);
+ snprintf(str,sz,"%d %d %d %d",
+ st->cnt_cmd_succ,
+ st->cnt_cmd_err,
+ st->cnt_ipc_tx,
+ st->cnt_ipc_rx);
+
+ return str;
+} \ No newline at end of file