Commit 63652f94 authored by Cedric Roux's avatar Cedric Roux

tick timeview/log

this is like timeview but the plotting is done at frame/subframe
resolution of a given reference clock signal, let's say.

The realtime information of the events is not used. It's all
logical.

It will be used to log harq processes for the moment.
parent 2b128738
CC=gcc
CFLAGS=-Wall -g -pthread -I..
OBJS=logger.o textlog.o framelog.o ttilog.o timelog.o
OBJS=logger.o textlog.o framelog.o ttilog.o timelog.o ticklog.o
logger.a: $(OBJS)
ar cr logger.a $(OBJS)
......
......@@ -11,6 +11,8 @@ 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);
logger *new_ticklog(void *event_handler, void *database,
char *event_name, char *frame_name, char *subframe_name);
void framelog_set_skip(logger *_this, int skip_delay);
......
#include "logger.h"
#include "logger_defs.h"
#include "event.h"
#include "database.h"
#include "handler.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct ticklog {
struct logger common;
void *database;
int frame_arg;
int subframe_arg;
};
static void _event(void *p, event e)
{
struct ticklog *l = p;
int i;
int frame;
int subframe;
frame = e.e[l->frame_arg].i;
subframe = e.e[l->subframe_arg].i;
for (i = 0; i < l->common.vsize; i++)
l->common.v[i]->append(l->common.v[i], e.sending_time, frame, subframe);
}
logger *new_ticklog(event_handler *h, void *database,
char *event_name, char *frame_varname, char *subframe_varname)
{
struct ticklog *ret;
int event_id;
database_event_format f;
int i;
ret = calloc(1, sizeof(struct ticklog)); if (ret == NULL) abort();
ret->common.event_name = strdup(event_name);
if (ret->common.event_name == NULL) abort();
ret->database = database;
event_id = event_id_from_name(database, event_name);
ret->common.handler_id = register_handler_function(h,event_id,_event,ret);
f = get_format(database, event_id);
/* look for frame and subframe args */
ret->frame_arg = -1;
ret->subframe_arg = -1;
for (i = 0; i < f.count; i++) {
if (!strcmp(f.name[i], frame_varname)) ret->frame_arg = i;
if (!strcmp(f.name[i], subframe_varname)) ret->subframe_arg = i;
}
if (ret->frame_arg == -1) {
printf("%s:%d: frame argument '%s' not found in event '%s'\n",
__FILE__, __LINE__, frame_varname, event_name);
abort();
}
if (ret->subframe_arg == -1) {
printf("%s:%d: subframe argument '%s' not found in event '%s'\n",
__FILE__, __LINE__, subframe_varname, event_name);
abort();
}
if (strcmp(f.type[ret->frame_arg], "int") != 0) {
printf("%s:%d: argument '%s' has wrong type (should be 'int')\n",
__FILE__, __LINE__, frame_varname);
abort();
}
if (strcmp(f.type[ret->subframe_arg], "int") != 0) {
printf("%s:%d: argument '%s' has wrong type (should be 'int')\n",
__FILE__, __LINE__, subframe_varname);
abort();
}
return ret;
}
CC=gcc
CFLAGS=-Wall -g -pthread -I..
CFLAGS=-Wall -g -pthread -I.. -I../logger
OBJS=stdout.o textlist.o xy.o tti.o time.o
OBJS=stdout.o textlist.o xy.o tti.o time.o ticktime.o
view.a: $(OBJS)
ar cr view.a $(OBJS)
......
This diff is collapsed.
......@@ -20,5 +20,8 @@ view *new_view_tti(float refresh_rate, gui *g, widget *w,
view *new_view_time(int number_of_seconds, float refresh_rate,
gui *g, widget *w);
view *new_subview_time(view *time, int line, int color, int size);
view *new_view_ticktime(float refresh_rate, gui *g, widget *w);
view *new_subview_ticktime(view *ticktime, int line, int color, int size);
void ticktime_set_tick(view *ticktime, void *logger);
#endif /* _VIEW_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment