This commit is contained in:
Cedric Roux
2016-05-12 17:26:42 +02:00
parent 944dad4caa
commit 69f14c37fa
3 changed files with 39 additions and 1 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
CC=gcc
CFLAGS=-Wall -g -pthread -I..
OBJS=logger.o textlog.o framelog.o ttilog.o
OBJS=logger.o textlog.o framelog.o ttilog.o timelog.o
logger.a: $(OBJS)
ar cr logger.a $(OBJS)
+1
View File
@@ -10,6 +10,7 @@ logger *new_textlog(void *event_handler, void *database,
logger *new_ttilog(void *event_handler, void *database,
char *event_name, char *frame_varname, char *subframe_varname,
char *data_varname, int convert_to_dB);
logger *new_timelog(void *event_handler, void *database, char *event_name);
#include "view/view.h"
+37
View File
@@ -0,0 +1,37 @@
#include "logger.h"
#include "logger_defs.h"
#include "event.h"
#include "database.h"
#include "handler.h"
#include <stdlib.h>
#include <string.h>
struct timelog {
struct logger common;
};
static void _event(void *p, event e)
{
struct timelog *l = p;
int i;
for (i = 0; i < l->common.vsize; i++)
l->common.v[i]->append(l->common.v[i], e.sending_time);
}
logger *new_timelog(event_handler *h, void *database, char *event_name)
{
struct timelog *ret;
int event_id;
ret = calloc(1, sizeof(struct timelog)); if (ret == NULL) abort();
ret->common.event_name = strdup(event_name);
if (ret->common.event_name == NULL) abort();
event_id = event_id_from_name(database, event_name);
ret->common.handler_id = register_handler_function(h,event_id,_event,ret);
return ret;
}