timelog
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user