From: Mathieu Desnoyers Date: Tue, 28 Jun 2011 22:18:01 +0000 (-0400) Subject: Pretty-print 0-value timestamps X-Git-Tag: v0.1~9^2~6 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=5e2eb0aebe6dd62c86d2b96030cb1ba3a0793bec;hp=39592eae8e476dbb016e2b09ef75f4a7b8cc151d Pretty-print 0-value timestamps Useful when dealing with dmesg logs which have 0-value timestamp. Signed-off-by: Mathieu Desnoyers --- diff --git a/formats/ctf-text/ctf-text.c b/formats/ctf-text/ctf-text.c index 361c527c..d169caac 100644 --- a/formats/ctf-text/ctf-text.c +++ b/formats/ctf-text/ctf-text.c @@ -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 diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 6e45ea36..28be4fd0 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -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; } } } diff --git a/include/babeltrace/ctf-ir/metadata.h b/include/babeltrace/ctf-ir/metadata.h index 9c4d4500..14c788c6 100644 --- a/include/babeltrace/ctf-ir/metadata.h +++ b/include/babeltrace/ctf-ir/metadata.h @@ -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;