Support ctf index version 1.1
authorJulien Desfossez <jdesfossez@efficios.com>
Thu, 20 Aug 2015 01:19:57 +0000 (21:19 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 22 Apr 2016 21:54:02 +0000 (17:54 -0400)
Produced by LTTng as of 2.8 (no compatibility breakage with 1.0)

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ctf.c
include/babeltrace/ctf/ctf-index.h
include/babeltrace/ctf/types.h

index fb9b2333cf63180a208ace408b9d9b1b90deebc4..7d51b7dc544e2a700e8be0c0512a1cc883b1f690 100644 (file)
@@ -1551,6 +1551,8 @@ begin:
        packet_index.ts_cycles.timestamp_end = 0;
        packet_index.events_discarded = 0;
        packet_index.events_discarded_len = 0;
+       packet_index.stream_instance_id = 0;
+       packet_index.packet_seq_num = 0;
 
        /* read and check header, set stream id (and check) */
        if (file_stream->parent.trace_packet_header) {
@@ -1837,7 +1839,7 @@ int import_stream_packet_index(struct ctf_trace *td,
        struct ctf_packet_index *ctf_index = NULL;
        struct ctf_packet_index_file_hdr index_hdr;
        struct packet_index index;
-       uint32_t packet_index_len;
+       uint32_t packet_index_len, index_minor;
        int ret = 0;
        int first_packet = 1;
        size_t len;
@@ -1865,6 +1867,8 @@ int import_stream_packet_index(struct ctf_trace *td,
                ret = -1;
                goto error;
        }
+       index_minor = be32toh(index_hdr.index_minor);
+
        packet_index_len = be32toh(index_hdr.packet_index_len);
        if (packet_index_len == 0) {
                fprintf(stderr, "[error] Packet index length cannot be 0.\n");
@@ -1891,6 +1895,10 @@ int import_stream_packet_index(struct ctf_trace *td,
                index.events_discarded_len = 64;
                index.data_offset = -1;
                stream_id = be64toh(ctf_index->stream_id);
+               if (index_minor >= 1) {
+                       index.stream_instance_id = be64toh(ctf_index->stream_instance_id);
+                       index.packet_seq_num = be64toh(ctf_index->packet_seq_num);
+               }
 
                if (!first_packet) {
                        /* add index to packet array */
index 0efa8887daff4435eae88fe18fee78db7373c858..97f928d96b01dcf410b9c70cb788d841eb38091f 100644 (file)
@@ -29,7 +29,7 @@
 
 #define CTF_INDEX_MAGIC 0xC1F1DCC1
 #define CTF_INDEX_MAJOR 1
-#define CTF_INDEX_MINOR 0
+#define CTF_INDEX_MINOR 1
 
 /*
  * Header at the beginning of each index file.
@@ -55,6 +55,9 @@ struct ctf_packet_index {
        uint64_t timestamp_end;
        uint64_t events_discarded;
        uint64_t stream_id;
+       /* CTF_INDEX 1.0 limit */
+       uint64_t stream_instance_id;    /* ID of the channel instance */
+       uint64_t packet_seq_num;        /* packet sequence number */
 } __attribute__((__packed__));
 
 #endif /* LTTNG_INDEX_H */
index c336632f7e6eb34b93190ae5e4d71c5f1a12d994..cc8acbf5ef173e3b3e413a21b6d528b9149d5720 100644 (file)
@@ -58,6 +58,9 @@ struct packet_index {
        uint64_t events_discarded_len;  /* length of the field, in bits */
        struct packet_index_time ts_cycles;     /* timestamp in cycles */
        struct packet_index_time ts_real;       /* realtime timestamp */
+       /* CTF_INDEX 1.0 limit */
+       uint64_t stream_instance_id;    /* ID of the channel instance */
+       uint64_t packet_seq_num;        /* packet sequence number */
 };
 
 /*
This page took 0.025726 seconds and 4 git commands to generate.