Fix: assign the current clock for mmap traces
[babeltrace.git] / formats / ctf / ctf.c
index f33fa3394ec52be5d11c4dd102ffb468025156ca..69600d1f8ca1b6e21e858eee326a2c236e0b2165 100644 (file)
@@ -167,6 +167,9 @@ uint64_t ctf_timestamp_begin(struct trace_descriptor *descriptor,
                        if (!stream_pos->packet_real_index)
                                goto error;
 
+                       if (stream_pos->packet_real_index->len <= 0)
+                               continue;
+
                        if (type == BT_CLOCK_REAL) {
                                index = &g_array_index(stream_pos->packet_real_index,
                                                struct packet_index,
@@ -225,6 +228,9 @@ uint64_t ctf_timestamp_end(struct trace_descriptor *descriptor,
                        if (!stream_pos->packet_real_index)
                                goto error;
 
+                       if (stream_pos->packet_real_index->len <= 0)
+                               continue;
+
                        if (type == BT_CLOCK_REAL) {
                                index = &g_array_index(stream_pos->packet_real_index,
                                                struct packet_index,
@@ -1740,6 +1746,11 @@ int ctf_open_mmap_stream_read(struct ctf_trace *td,
        if (ret)
                goto error_index;
 
+       /*
+        * For now, only a single slock is supported.
+        */
+       file_stream->parent.current_clock = td->single_clock;
+
        /* Add stream file to stream class */
        g_ptr_array_add(file_stream->parent.stream_class->streams,
                        &file_stream->parent);
@@ -1845,6 +1856,9 @@ int ctf_convert_index_timestamp(struct trace_descriptor *tdp)
                        stream_pos->packet_real_index = g_array_new(FALSE, TRUE,
                                        sizeof(struct packet_index));
 
+                       if (!stream_pos->packet_cycles_index)
+                               continue;
+
                        for (k = 0; k < stream_pos->packet_cycles_index->len; k++) {
                                struct packet_index *index;
                                struct packet_index new_index;
This page took 0.025573 seconds and 4 git commands to generate.