Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
/*
* For now, only a single clock per trace is supported.
*/
/*
* For now, only a single clock per trace is supported.
*/
- file_stream->parent.current_clock = td->single_clock;
+ file_stream->parent.current_clock = td->parent.single_clock;
ret = create_stream_packet_index(td, file_stream);
if (ret)
goto error_index;
ret = create_stream_packet_index(td, file_stream);
if (ret)
goto error_index;
/*
* For now, only a single clock per trace is supported.
*/
/*
* For now, only a single clock per trace is supported.
*/
- file_stream->parent.current_clock = td->single_clock;
+ file_stream->parent.current_clock = td->parent.single_clock;
/* Add stream file to stream class */
g_ptr_array_add(file_stream->parent.stream_class->streams,
/* Add stream file to stream class */
g_ptr_array_add(file_stream->parent.stream_class->streams,
if (tc->clock_use_offset_avg)
tc_offset = tc->single_clock_offset_avg;
else
if (tc->clock_use_offset_avg)
tc_offset = tc->single_clock_offset_avg;
else
- tc_offset = trace->single_clock->offset;
+ tc_offset = trace->parent.single_clock->offset;
ts_nsec = clock_cycles_to_ns(stream->current_clock, timestamp);
ts_nsec += tc_offset; /* Add offset */
ts_nsec = clock_cycles_to_ns(stream->current_clock, timestamp);
ts_nsec += tc_offset; /* Add offset */
static
struct ctf_clock *trace_clock_lookup(struct ctf_trace *trace, GQuark clock_name)
{
static
struct ctf_clock *trace_clock_lookup(struct ctf_trace *trace, GQuark clock_name)
{
- return g_hash_table_lookup(trace->clocks, (gpointer) (unsigned long) clock_name);
+ return g_hash_table_lookup(trace->parent.clocks, (gpointer) (unsigned long) clock_name);
fprintf(fd, "[error] %s: missing name field in clock declaration\n", __func__);
goto error;
}
fprintf(fd, "[error] %s: missing name field in clock declaration\n", __func__);
goto error;
}
- if (g_hash_table_size(trace->clocks) > 0) {
+ if (g_hash_table_size(trace->parent.clocks) > 0) {
fprintf(fd, "[error] Only CTF traces with a single clock description are supported by this babeltrace version.\n");
ret = -EINVAL;
goto error;
}
fprintf(fd, "[error] Only CTF traces with a single clock description are supported by this babeltrace version.\n");
ret = -EINVAL;
goto error;
}
- trace->single_clock = clock;
- g_hash_table_insert(trace->clocks, (gpointer) (unsigned long) clock->name, clock);
+ trace->parent.single_clock = clock;
+ g_hash_table_insert(trace->parent.clocks, (gpointer) (unsigned long) clock->name, clock);
clock->absolute = 0; /* Not an absolute reference across traces */
}
clock->absolute = 0; /* Not an absolute reference across traces */
}
- trace->single_clock = clock;
- g_hash_table_insert(trace->clocks, (gpointer) (unsigned long) clock->name, clock);
+ trace->parent.single_clock = clock;
+ g_hash_table_insert(trace->parent.clocks, (gpointer) (unsigned long) clock->name, clock);
printf_verbose("CTF visitor: metadata construction...\n");
trace->byte_order = byte_order;
printf_verbose("CTF visitor: metadata construction...\n");
trace->byte_order = byte_order;
- trace->clocks = g_hash_table_new_full(g_direct_hash, g_direct_equal,
- NULL, clock_free);
+ trace->parent.clocks = g_hash_table_new_full(g_direct_hash,
+ g_direct_equal, NULL, clock_free);
trace->callsites = g_hash_table_new_full(g_direct_hash, g_direct_equal,
NULL, callsite_free);
trace->callsites = g_hash_table_new_full(g_direct_hash, g_direct_equal,
NULL, callsite_free);
error:
bt_free_declaration_scope(trace->root_declaration_scope);
g_hash_table_destroy(trace->callsites);
error:
bt_free_declaration_scope(trace->root_declaration_scope);
g_hash_table_destroy(trace->callsites);
- g_hash_table_destroy(trace->clocks);
+ g_hash_table_destroy(trace->parent.clocks);
bt_free_declaration_scope(trace->declaration_scope);
g_hash_table_destroy(trace->callsites);
bt_free_declaration_scope(trace->declaration_scope);
g_hash_table_destroy(trace->callsites);
- g_hash_table_destroy(trace->clocks);
+ g_hash_table_destroy(trace->parent.clocks);
metadata_stream = container_of(trace->metadata, struct ctf_file_stream, parent);
g_free(metadata_stream);
metadata_stream = container_of(trace->metadata, struct ctf_file_stream, parent);
g_free(metadata_stream);
struct ctf_stream_definition *metadata;
char *metadata_string;
int metadata_packetized;
struct ctf_stream_definition *metadata;
char *metadata_string;
int metadata_packetized;
- struct ctf_clock *single_clock; /* currently supports only one clock */
GPtrArray *event_declarations; /* Array of all the struct bt_ctf_event_decl */
struct declaration_struct *packet_header_decl;
GPtrArray *event_declarations; /* Array of all the struct bt_ctf_event_decl */
struct declaration_struct *packet_header_decl;
struct bt_context *ctx;
struct bt_trace_handle *handle;
struct trace_collection *collection; /* Container of this trace */
struct bt_context *ctx;
struct bt_trace_handle *handle;
struct trace_collection *collection; /* Container of this trace */
+ GHashTable *clocks;
+ struct ctf_clock *single_clock; /* currently supports only one clock */
* convert the index from cycles to real time.
*/
int bt_trace_collection_add(struct trace_collection *tc,
* convert the index from cycles to real time.
*/
int bt_trace_collection_add(struct trace_collection *tc,
- struct bt_trace_descriptor *td)
+ struct bt_trace_descriptor *trace)
- struct ctf_trace *trace;
-
- if (!tc || !td)
- trace = container_of(td, struct ctf_trace, parent);
-
if (tc->array->len > 1) {
struct clock_match clock_match = {
.clocks = tc->clocks,
if (tc->array->len > 1) {
struct clock_match clock_match = {
.clocks = tc->clocks,
- g_ptr_array_add(tc->array, td);
- trace->parent.collection = tc;
+ g_ptr_array_add(tc->array, trace);
+ trace->collection = tc;
{
struct clock_match clock_match = {
{
struct clock_match clock_match = {