From f0a704145b96b19b479432a05a344475c647e6b8 Mon Sep 17 00:00:00 2001 From: Cedric Roux <cedric.roux@eurecom.fr> Date: Wed, 27 Apr 2016 12:13:53 +0200 Subject: [PATCH] add get_format to database --- common/utils/T/tracer/database.c | 17 +++++++++++++++++ common/utils/T/tracer/database.h | 12 ++++++++++++ 2 files changed, 29 insertions(+) diff --git a/common/utils/T/tracer/database.c b/common/utils/T/tracer/database.c index 5ea178141..5e7c9ec8f 100644 --- a/common/utils/T/tracer/database.c +++ b/common/utils/T/tracer/database.c @@ -409,3 +409,20 @@ void on_off(void *_d, char *item, int *a, int onoff) exit(1); } } + +database_event_format get_format(void *_database, int event_id) +{ + database *d = _database; + database_event_format ret; + + if (event_id < 0 || event_id >= d->isize) { + printf("%s:%d: bad event ID (%d)\n", __FILE__, __LINE__, event_id); + abort(); + } + + ret.type = d->i[event_id].arg_type; + ret.name = d->i[event_id].arg_name; + ret.count = d->i[event_id].asize; + + return ret; +} diff --git a/common/utils/T/tracer/database.h b/common/utils/T/tracer/database.h index 4ca4606c1..544f0ad06 100644 --- a/common/utils/T/tracer/database.h +++ b/common/utils/T/tracer/database.h @@ -8,4 +8,16 @@ void list_ids(void *database); void list_groups(void *database); void on_off(void *d, char *item, int *a, int onoff); +/****************************************************************************/ +/* get format of an event */ +/****************************************************************************/ + +typedef struct { + char **type; + char **name; + int count; +} database_event_format; + +database_event_format get_format(void *database, int event_id); + #endif /* _DATABASE_H_ */ -- GitLab