move struct ctf_stream -> struct ctf_stream_class
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 9 May 2011 15:28:56 +0000 (11:28 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 9 May 2011 15:28:56 +0000 (11:28 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
converter/babeltrace-lib.c
formats/ctf-text/ctf-text.c
formats/ctf/ctf.c
formats/ctf/metadata/ctf-visitor-generate-io-struct.c
include/babeltrace/ctf/metadata.h
include/babeltrace/types.h

index 8f29c5a87d8c818c7dca8ffa2d6513bf45380ddd..cc3d8d3b922235c31184951e41fa347feb86cc6f 100644 (file)
@@ -66,7 +66,7 @@ int convert_trace(struct trace_descriptor *td_write,
 
        /* For each stream (TODO: order events by timestamp) */
        for (stream_id = 0; stream_id < tin->streams->len; stream_id++) {
-               struct ctf_stream *stream = g_ptr_array_index(tin->streams, stream_id);
+               struct ctf_stream_class *stream = g_ptr_array_index(tin->streams, stream_id);
 
                if (!stream)
                        continue;
index 423cb10fe07da22eac99b4d113c2731aebbd777c..2ec71c56765b872a30c2ab040f865356227d75a6 100644 (file)
@@ -55,7 +55,7 @@ struct format ctf_text_format = {
 
 static
 int ctf_text_write_event(struct stream_pos *ppos,
-                        struct ctf_stream *stream_class)
+                        struct ctf_stream_class *stream_class)
 {
        struct ctf_text_stream_pos *pos =
                container_of(ppos, struct ctf_text_stream_pos, parent);
@@ -63,6 +63,7 @@ int ctf_text_write_event(struct stream_pos *ppos,
        uint64_t id = 0;
        int len_index;
        int ret;
+       int field_nr = 0;
 
        /* print event header */
        if (stream_class->event_header) {
@@ -91,16 +92,27 @@ int ctf_text_write_event(struct stream_pos *ppos,
                return -EINVAL;
        }
 
+       if (field_nr++ != 0)
+               fprintf(pos->fp, ", ");
+       if (pos->print_names)
+               fprintf(pos->fp, "timestamp = ");
+       else
+               fprintf(pos->fp, "[");
+       fprintf(pos->fp, "%" PRIu64, (uint64_t) 0);     /* TODO */
+       if (!pos->print_names)
+               fprintf(pos->fp, "]");
+
+       if (field_nr++ != 0)
+               fprintf(pos->fp, ", ");
        if (pos->print_names)
                fprintf(pos->fp, "name = ");
-       fprintf(pos->fp, "%s", g_quark_to_string(event_class->name));
+       fprintf(pos->fp, "%s", g_quark_to_string(event_class->name));
 
        if (stream_class->event_header) {
+               if (field_nr++ != 0)
+                       fprintf(pos->fp, ", ");
                if (pos->print_names)
-                       fprintf(pos->fp, ", stream.event.header =");
-               else
-                       fprintf(pos->fp, ",");
-               fprintf(pos->fp, " ");
+                       fprintf(pos->fp, "stream.event.header = ");
                ret = generic_rw(ppos, &stream_class->event_header->p);
                if (ret)
                        goto error;
@@ -108,10 +120,10 @@ int ctf_text_write_event(struct stream_pos *ppos,
 
        /* print stream-declared event context */
        if (stream_class->event_context) {
+               if (field_nr++ != 0)
+                       fprintf(pos->fp, ", ");
                if (pos->print_names)
-                       fprintf(pos->fp, ", stream.event.context =");
-               else
-                       fprintf(pos->fp, ",");
+                       fprintf(pos->fp, "stream.event.context = ");
                fprintf(pos->fp, " ");
                ret = generic_rw(ppos, &stream_class->event_context->p);
                if (ret)
@@ -120,10 +132,10 @@ int ctf_text_write_event(struct stream_pos *ppos,
 
        /* print event-declared event context */
        if (event_class->context) {
+               if (field_nr++ != 0)
+                       fprintf(pos->fp, ", ");
                if (pos->print_names)
-                       fprintf(pos->fp, ", event.context =");
-               else
-                       fprintf(pos->fp, ",");
+                       fprintf(pos->fp, "event.context = ");
                fprintf(pos->fp, " ");
                ret = generic_rw(ppos, &event_class->context->p);
                if (ret)
@@ -132,10 +144,10 @@ int ctf_text_write_event(struct stream_pos *ppos,
 
        /* Read and print event payload */
        if (event_class->fields) {
+               if (field_nr++ != 0)
+                       fprintf(pos->fp, ", ");
                if (pos->print_names)
-                       fprintf(pos->fp, ", event.fields =");
-               else
-                       fprintf(pos->fp, ",");
+                       fprintf(pos->fp, "event.fields = ");
                fprintf(pos->fp, " ");
                ret = generic_rw(ppos, &event_class->fields->p);
                if (ret)
index 50cc93de1d866b83a3302767871707ff3c4e5799..441d2bb491d2567e6eb2a54d5e9d394fa89d469c 100644 (file)
@@ -80,7 +80,7 @@ struct format ctf_format = {
 };
 
 static
-int ctf_read_event(struct stream_pos *ppos, struct ctf_stream *stream_class)
+int ctf_read_event(struct stream_pos *ppos, struct ctf_stream_class *stream_class)
 {
        struct ctf_stream_pos *pos =
                container_of(ppos, struct ctf_stream_pos, parent);
@@ -151,7 +151,7 @@ error:
 }
 
 static
-int ctf_write_event(struct stream_pos *pos, struct ctf_stream *stream_class)
+int ctf_write_event(struct stream_pos *pos, struct ctf_stream_class *stream_class)
 {
        struct ctf_event *event_class;
        uint64_t id = 0;
@@ -424,7 +424,7 @@ static
 int create_stream_packet_index(struct ctf_trace *td,
                               struct ctf_file_stream *file_stream)
 {
-       struct ctf_stream *stream;
+       struct ctf_stream_class *stream;
        int len_index;
        struct ctf_stream_pos *pos;
        struct stat filestats;
@@ -776,7 +776,7 @@ void ctf_close_trace(struct trace_descriptor *tdp)
 
        if (td->streams) {
                for (i = 0; i < td->streams->len; i++) {
-                       struct ctf_stream *stream;
+                       struct ctf_stream_class *stream;
                        int j;
                        stream = g_ptr_array_index(td->streams, i);
                        for (j = 0; j < stream->files->len; j++) {
index 033537e67d06325dde8de438c0a183005b148714..9da7d0d8322d8aecd55590db613de4bdab2388d2 100644 (file)
@@ -125,7 +125,7 @@ int get_unary_uuid(struct cds_list_head *head, uuid_t *uuid)
 }
 
 static
-struct ctf_stream *trace_stream_lookup(struct ctf_trace *trace, uint64_t stream_id)
+struct ctf_stream_class *trace_stream_lookup(struct ctf_trace *trace, uint64_t stream_id)
 {
        if (trace->streams->len <= stream_id)
                return NULL;
@@ -1515,7 +1515,7 @@ error:
 
  
 static
-int ctf_stream_declaration_visit(FILE *fd, int depth, struct ctf_node *node, struct ctf_stream *stream, struct ctf_trace *trace)
+int ctf_stream_declaration_visit(FILE *fd, int depth, struct ctf_node *node, struct ctf_stream_class *stream, struct ctf_trace *trace)
 {
        int ret = 0;
 
@@ -1637,10 +1637,10 @@ int ctf_stream_visit(FILE *fd, int depth, struct ctf_node *node,
 {
        int ret = 0;
        struct ctf_node *iter;
-       struct ctf_stream *stream;
+       struct ctf_stream_class *stream;
        struct definition_scope *parent_def_scope;
 
-       stream = g_new0(struct ctf_stream, 1);
+       stream = g_new0(struct ctf_stream_class, 1);
        stream->declaration_scope = new_declaration_scope(parent_declaration_scope);
        stream->events_by_id = g_ptr_array_new();
        stream->event_quark_to_id = g_hash_table_new(g_direct_hash, g_direct_equal);
index 5e7fd30e11dc4f66373fcdf2cf1a2b9f2fed688f..de1a70d101b921975a5f10fb23b183ff9e558adb 100644 (file)
 #define CTF_MAGIC      0xC1FC1FC1
 
 struct ctf_trace;
-struct ctf_stream;
+struct ctf_stream_class;
 struct ctf_event;
 
 struct ctf_file_stream {
        uint64_t stream_id;
-       struct ctf_stream *stream;
-       struct ctf_stream_pos pos;                      /* current stream position */
+       struct ctf_stream_class *stream;
+       struct ctf_stream_pos pos;      /* current stream position */
 };
 
 #define CTF_TRACE_SET_FIELD(ctf_trace, field)                          \
@@ -63,7 +63,7 @@ struct ctf_trace {
        struct declaration_scope *declaration_scope;
        /* innermost definition scope. to be used as parent of stream. */
        struct definition_scope *definition_scope;
-       GPtrArray *streams;                     /* Array of struct ctf_stream pointers */
+       GPtrArray *streams;                     /* Array of struct ctf_stream_class pointers */
        struct ctf_file_stream metadata;
 
        /* Declarations only used when parsing */
@@ -105,7 +105,7 @@ struct ctf_trace {
                (ctf_stream)->(field);                                  \
        })
 
-struct ctf_stream {
+struct ctf_stream_class {
        struct ctf_trace *trace;
        /* parent is lexical scope conaining the stream scope */
        struct declaration_scope *declaration_scope;
@@ -149,7 +149,7 @@ struct ctf_stream {
 
 struct ctf_event {
        /* stream mapped by stream_id */
-       struct ctf_stream *stream;
+       struct ctf_stream_class *stream;
        /* parent is lexical scope conaining the event scope */
        struct declaration_scope *declaration_scope;
 
index 6bfd703d4bad08eb8dcac12671175a44752cd184..fa543bf2ddaed57323aea6d4331ce2ce7586e477 100644 (file)
@@ -31,7 +31,7 @@
 /* Preallocate this many fields for structures */
 #define DEFAULT_NR_STRUCT_FIELDS 8
 
-struct ctf_stream;
+struct ctf_stream_class;
 struct stream_pos;
 struct format;
 struct definition;
@@ -114,7 +114,7 @@ struct stream_pos {
        /* read/write dispatch table. Specific to plugin used for stream. */
        rw_dispatch *rw_table;  /* rw dispatch table */
        int (*event_cb)(struct stream_pos *pos,
-                       struct ctf_stream *stream_class);
+                       struct ctf_stream_class *stream_class);
 };
 
 static inline
This page took 0.029081 seconds and 4 git commands to generate.