From 14b1ac277816ecf66cb6906cdbc06fc992a2e279 Mon Sep 17 00:00:00 2001 From: compudj Date: Sun, 23 Sep 2007 23:14:38 +0000 Subject: [PATCH] remove event.c and type.c git-svn-id: http://ltt.polymtl.ca/svn@2600 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/ltt/Makefile.am | 10 ++--- ltt/branches/poly/ltt/ltt-private.h | 5 ++- ltt/branches/poly/ltt/markers-field.h | 46 ++++++++++++++++++++++ ltt/branches/poly/ltt/markers.h | 40 ++++++++++--------- ltt/branches/poly/lttv/lttv/batchtest.c | 2 - ltt/branches/poly/lttv/lttv/tracecontext.h | 4 +- 6 files changed, 78 insertions(+), 29 deletions(-) create mode 100644 ltt/branches/poly/ltt/markers-field.h diff --git a/ltt/branches/poly/ltt/Makefile.am b/ltt/branches/poly/ltt/Makefile.am index 75574118..6fc70e31 100644 --- a/ltt/branches/poly/ltt/Makefile.am +++ b/ltt/branches/poly/ltt/Makefile.am @@ -10,17 +10,17 @@ AM_CFLAGS = $(GLIB_CFLAGS) LIBS += $(GLIB_LIBS) lib_LTLIBRARIES = liblttvtraceread.la -liblttvtraceread_la_SOURCES = event.c parser.c tracefile.c type.c markers.c -noinst_HEADERS = parser.h ltt-private.h +liblttvtraceread_la_SOURCES = tracefile.c markers.c +noinst_HEADERS = ltt-private.h +#event.c parser.c type.c +#parser.h lttinclude_HEADERS = \ - compiler.h\ - event.h\ + compiler.h\ markers.h\ ltt.h\ time.h\ trace.h\ - type.h\ ltt-types.h EXTRA_DIST = crc32.tab diff --git a/ltt/branches/poly/ltt/ltt-private.h b/ltt/branches/poly/ltt/ltt-private.h index 68509eab..91ee9347 100644 --- a/ltt/branches/poly/ltt/ltt-private.h +++ b/ltt/branches/poly/ltt/ltt-private.h @@ -201,6 +201,7 @@ struct ltt_block_start_header { } LTT_PACKED_STRUCT; +#if 0 struct _LttType{ // LTTV does not care about type names. Everything is a field. // GQuark type_name; //type name if it is a named type @@ -218,6 +219,7 @@ struct _LttType{ char *separator; char *footer; }; +#endif //0 #if 0 struct _LttEventType{ @@ -273,6 +275,7 @@ struct _LttEventPosition{ enum field_status { FIELD_UNKNOWN, FIELD_VARIABLE, FIELD_FIXED }; +#if 0 struct _LttField{ GQuark name; gchar *description; @@ -293,7 +296,7 @@ struct _LttField{ // each event for sequences and arrays that // contain variable length fields. }; - +#endif //0 #if 0 struct _LttFacility{ LttTrace *trace; diff --git a/ltt/branches/poly/ltt/markers-field.h b/ltt/branches/poly/ltt/markers-field.h new file mode 100644 index 00000000..a08ce5d7 --- /dev/null +++ b/ltt/branches/poly/ltt/markers-field.h @@ -0,0 +1,46 @@ +#ifndef _LTT_MARKERS_FIELD_H +#define _LTT_MARKERS_FIELD_H + +/* + * Marker field support header. + * + * Mathieu Desnoyers, August 2007 + * License: LGPL. + */ + +#include + +enum ltt_type { + LTT_TYPE_SIGNED_INT, + LTT_TYPE_UNSIGNED_INT, + LTT_TYPE_STRING, + LTT_TYPE_COMPACT, + LTT_TYPE_NONE, +}; + +struct marker_field { + GQuark name; + enum ltt_type type; + unsigned long offset; /* offset in the event data */ + unsigned long size; + unsigned long alignment; + unsigned long attributes; + int static_offset; +}; + +static inline GQuark marker_field_get_name(struct marker_field *field) +{ + return field->name; +} + +static inline enum ltt_type marker_field_get_type(struct marker_field *field) +{ + return field->type; +} + +static inline unsigned long marker_field_get_size(struct marker_field *field) +{ + return field->size; +} + +#endif //_LTT_MARKERS_FIELD_H diff --git a/ltt/branches/poly/ltt/markers.h b/ltt/branches/poly/ltt/markers.h index b5aa3125..be2f847e 100644 --- a/ltt/branches/poly/ltt/markers.h +++ b/ltt/branches/poly/ltt/markers.h @@ -12,14 +12,7 @@ #include #include #include - -enum ltt_type { - LTT_TYPE_SIGNED_INT, - LTT_TYPE_UNSIGNED_INT, - LTT_TYPE_STRING, - LTT_TYPE_COMPACT, - LTT_TYPE_NONE, -}; +#include #define LTT_ATTRIBUTE_COMPACT (1<<0) #define LTT_ATTRIBUTE_NETWORK_BYTE_ORDER (1<<1) @@ -40,16 +33,6 @@ struct marker_info { struct marker_info *next; /* Linked list of markers with the same name */ }; -struct marker_field { - GQuark name; - enum ltt_type type; - unsigned long offset; /* offset in the event data */ - unsigned long size; - unsigned long alignment; - unsigned long attributes; - int static_offset; -}; - enum marker_id { MARKER_ID_SET_MARKER_ID = 0, /* Static IDs available (range 0-7) */ MARKER_ID_SET_MARKER_FORMAT, @@ -83,6 +66,27 @@ static inline struct marker_info *marker_get_info_from_name(LttTrace *trace, return g_hash_table_lookup(trace->markers_hash, (gconstpointer)name); } +static inline struct marker_field *marker_get_field(struct marker_info *info, + guint i) +{ + return &g_array_index(info->fields, struct marker_field, i); +} + +static inline unsigned int marker_get_num_fields(struct marker_info *info) +{ + return info->fields->len; +} + +/* + * for_each_marker_field - iterate over fields of a marker + * @field: struct marker_field * to use as iterator + * @info: marker info pointer + */ +#define for_each_marker_field(field, info) \ + for (field = marker_get_field(info, 0); \ + field != marker_get_field(info, marker_get_num_fields(info)); \ + field++) + int marker_format_event(LttTrace *trace, GQuark name, const char *format); int marker_id_event(LttTrace *trace, GQuark name, guint16 id, uint8_t int_size, uint8_t long_size, uint8_t pointer_size, diff --git a/ltt/branches/poly/lttv/lttv/batchtest.c b/ltt/branches/poly/lttv/lttv/batchtest.c index 9b4184bd..0a0c519b 100644 --- a/ltt/branches/poly/lttv/lttv/batchtest.c +++ b/ltt/branches/poly/lttv/lttv/batchtest.c @@ -298,7 +298,6 @@ static void compute_tracefile(LttTracefile *tracefile, void *hook_data) FILE *fp; LttTime time, previous_time; LttEvent *event = ltt_tracefile_get_event(tracefile); - LttFacility *facility; LttEventType *event_type; int err; gchar mod_name[PATH_MAX]; @@ -328,7 +327,6 @@ static void compute_tracefile(LttTracefile *tracefile, void *hook_data) do { LttTracefile *tf_pos; - facility = ltt_event_facility(event); event_type = ltt_event_eventtype(event); time = ltt_event_time(event); ltt_event_position(event, a_event_position); diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.h b/ltt/branches/poly/lttv/lttv/tracecontext.h index be9a9514..c2791169 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.h +++ b/ltt/branches/poly/lttv/lttv/tracecontext.h @@ -272,8 +272,6 @@ void lttv_tracefile_context_add_hooks_by_id(LttvTracefileContext *self, void lttv_tracefile_context_remove_hooks_by_id(LttvTracefileContext *self, unsigned i); -/* A LttvTraceHook has two arrays of LttvTraceHookByFacility, - * indexed by facility ID and a simple array used to walk all the hooks */ typedef struct _LttvTraceHook { LttvHook h; guint id; @@ -281,7 +279,7 @@ typedef struct _LttvTraceHook { LttField *f2; LttField *f3; gpointer hook_data; -} LttvTraceHookByFacility; +} LttvTraceHook; /* Get the head of marker list correcponding to the given trace hook. -- 2.34.1