diff options
author | FreeArtMan <dos21h@gmail.com> | 2017-09-07 22:37:43 +0100 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2017-09-07 22:37:43 +0100 |
commit | 08f96759f9b1d5e8b1dd300971d23f833b819e7c (patch) | |
tree | aa3a4010910b7a0b70e6f551a82911708c001547 /stat.c | |
parent | d8d0925669d1e015f7290caf1a34ad756895b151 (diff) | |
download | agni-08f96759f9b1d5e8b1dd300971d23f833b819e7c.tar.gz agni-08f96759f9b1d5e8b1dd300971d23f833b819e7c.zip |
Added stat command
Diffstat (limited to 'stat.c')
-rw-r--r-- | stat.c | 43 |
1 files changed, 43 insertions, 0 deletions
@@ -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 |