Pretty-print 0-value timestamps
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 28 Jun 2011 22:18:01 +0000 (18:18 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 28 Jun 2011 22:18:01 +0000 (18:18 -0400)
Useful when dealing with dmesg logs which have 0-value timestamp.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/ctf-text/ctf-text.c
formats/ctf/ctf.c
include/babeltrace/ctf-ir/metadata.h

index 361c527cce7a90d491a04b08a7d71f706bc19c62..d169caac803f80ded578db162837b184c83b3997 100644 (file)
@@ -145,7 +145,7 @@ int ctf_text_write_event(struct stream_pos *ppos,
                return -EINVAL;
        }
 
-       if (stream->timestamp) {
+       if (stream->has_timestamp) {
                if (pos->print_names)
                        fprintf(pos->fp, "timestamp = ");
                else
index 6e45ea3612f603664cbee66fb5d0d90e512f215a..28be4fd0cad21357a105f9c4a6984fd7e86f5b7f 100644 (file)
@@ -156,14 +156,17 @@ int ctf_read_event(struct stream_pos *ppos, struct ctf_stream *stream)
                }
 
                /* lookup timestamp */
+               stream->has_timestamp = 0;
                integer_definition = lookup_integer(&stream->stream_event_header->p, "timestamp", FALSE);
                if (integer_definition) {
                        ctf_update_timestamp(stream, integer_definition);
+                       stream->has_timestamp = 1;
                } else {
                        if (variant) {
                                integer_definition = lookup_integer(variant, "timestamp", FALSE);
                                if (integer_definition) {
                                        ctf_update_timestamp(stream, integer_definition);
+                                       stream->has_timestamp = 1;
                                }
                        }
                }
index 9c4d4500434cd16609284c328598ff818fd5607e..14c788c6d704a3c5a1aedccc78f96d3b408f4820 100644 (file)
@@ -36,6 +36,7 @@ struct ctf_event;
 struct ctf_stream {
        struct ctf_stream_class *stream_class;
        uint64_t timestamp;                     /* Current timestamp, in ns */
+       int has_timestamp;
        uint64_t stream_id;
 
        struct definition_struct *trace_packet_header;
This page took 0.026375 seconds and 4 git commands to generate.