From 4c62e2d877007dd15b590972aece3b869820333f Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 23 Apr 2013 09:31:55 -0400 Subject: [PATCH 1/1] Move trace collection pointer to bt_trace_descriptor Signed-off-by: Mathieu Desnoyers --- formats/ctf/ctf.c | 6 +++--- formats/ctf/events-private.h | 2 +- include/babeltrace/ctf-ir/metadata.h | 1 - include/babeltrace/format-internal.h | 2 ++ lib/trace-collection.c | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index ddde5452..6bb31e55 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -781,7 +781,7 @@ void ctf_packet_seek(struct bt_stream_pos *stream_pos, size_t index, int whence) * case, the collection is not there, so we * cannot print the timestamps. */ - if ((&file_stream->parent)->stream_class->trace->collection) { + if ((&file_stream->parent)->stream_class->trace->parent.collection) { /* * When a stream reaches the end of the * file, we need to show the number of @@ -1472,7 +1472,7 @@ begin: field = bt_struct_definition_get_field_from_index(file_stream->parent.stream_packet_context, len_index); packet_index.timestamp_begin = bt_get_unsigned_int(field); - if (file_stream->parent.stream_class->trace->collection) { + if (file_stream->parent.stream_class->trace->parent.collection) { packet_index.timestamp_begin = ctf_get_real_timestamp( &file_stream->parent, @@ -1487,7 +1487,7 @@ begin: field = bt_struct_definition_get_field_from_index(file_stream->parent.stream_packet_context, len_index); packet_index.timestamp_end = bt_get_unsigned_int(field); - if (file_stream->parent.stream_class->trace->collection) { + if (file_stream->parent.stream_class->trace->parent.collection) { packet_index.timestamp_end = ctf_get_real_timestamp( &file_stream->parent, diff --git a/formats/ctf/events-private.h b/formats/ctf/events-private.h index 201b2b36..770012f4 100644 --- a/formats/ctf/events-private.h +++ b/formats/ctf/events-private.h @@ -40,7 +40,7 @@ uint64_t ctf_get_real_timestamp(struct ctf_stream_definition *stream, { uint64_t ts_nsec; struct ctf_trace *trace = stream->stream_class->trace; - struct trace_collection *tc = trace->collection; + struct trace_collection *tc = trace->parent.collection; uint64_t tc_offset; if (tc->clock_use_offset_avg) diff --git a/include/babeltrace/ctf-ir/metadata.h b/include/babeltrace/ctf-ir/metadata.h index 4fa5c0be..bc47f8bf 100644 --- a/include/babeltrace/ctf-ir/metadata.h +++ b/include/babeltrace/ctf-ir/metadata.h @@ -191,7 +191,6 @@ struct ctf_trace { GHashTable *clocks; GHashTable *callsites; struct ctf_clock *single_clock; /* currently supports only one clock */ - struct trace_collection *collection; /* Container of this trace */ GPtrArray *event_declarations; /* Array of all the struct bt_ctf_event_decl */ struct declaration_struct *packet_header_decl; diff --git a/include/babeltrace/format-internal.h b/include/babeltrace/format-internal.h index 589b68a3..880a336e 100644 --- a/include/babeltrace/format-internal.h +++ b/include/babeltrace/format-internal.h @@ -31,6 +31,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { @@ -41,6 +42,7 @@ struct bt_trace_descriptor { char path[PATH_MAX]; /* trace path */ struct bt_context *ctx; struct bt_trace_handle *handle; + struct trace_collection *collection; /* Container of this trace */ }; #ifdef __cplusplus diff --git a/lib/trace-collection.c b/lib/trace-collection.c index c5c875c9..6743ce6b 100644 --- a/lib/trace-collection.c +++ b/lib/trace-collection.c @@ -186,7 +186,7 @@ int bt_trace_collection_add(struct trace_collection *tc, } g_ptr_array_add(tc->array, td); - trace->collection = tc; + trace->parent.collection = tc; { struct clock_match clock_match = { -- 2.34.1