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
|
#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;
}
|