aboutsummaryrefslogblamecommitdiffstats
path: root/stat.c
blob: ad40490e2077faf3a265741ca36b969115cd753e (plain) (tree)










































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