X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;ds=sidebyside;f=formats%2Fctf-text%2Fctf-text.c;h=55158caa427ed6666c017c6259965fa568a217e9;hb=51f4bb7a60d9f073553691dd0f4a52a88592c727;hp=4f5ba73e97b22cf045bbba3294ca43a5ce953bce;hpb=4c4ba0211b25f7a4ef4f3fbd7cda9ee5a4bc6330;p=babeltrace.git diff --git a/formats/ctf-text/ctf-text.c b/formats/ctf-text/ctf-text.c index 4f5ba73e..55158caa 100644 --- a/formats/ctf-text/ctf-text.c +++ b/formats/ctf-text/ctf-text.c @@ -246,9 +246,19 @@ int ctf_text_write_event(struct stream_pos *ppos, struct ctf_stream_definition * fflush(pos->fp); fprintf(stderr, "[warning] Tracer discarded %" PRIu64 " events between [", stream->events_discarded); - ctf_print_timestamp(stderr, stream, stream->prev_timestamp); - fprintf(stderr, "] and ["); - ctf_print_timestamp(stderr, stream, stream->prev_timestamp_end); + if (opt_clock_cycles) { + ctf_print_timestamp(stderr, stream, + stream->prev_cycles_timestamp); + fprintf(stderr, "] and ["); + ctf_print_timestamp(stderr, stream, + stream->prev_cycles_timestamp_end); + } else { + ctf_print_timestamp(stderr, stream, + stream->prev_real_timestamp); + fprintf(stderr, "] and ["); + ctf_print_timestamp(stderr, stream, + stream->prev_real_timestamp_end); + } fprintf(stderr, "]. You should consider recording a new trace with larger buffers or with fewer events enabled.\n"); fflush(stderr); stream->events_discarded = 0; @@ -260,7 +270,11 @@ int ctf_text_write_event(struct stream_pos *ppos, struct ctf_stream_definition * fprintf(pos->fp, "timestamp = "); else fprintf(pos->fp, "["); - ctf_print_timestamp(pos->fp, stream, stream->timestamp); + if (opt_clock_cycles) { + ctf_print_timestamp(pos->fp, stream, stream->cycles_timestamp); + } else { + ctf_print_timestamp(pos->fp, stream, stream->real_timestamp); + } if (!pos->print_names) fprintf(pos->fp, "]"); @@ -277,8 +291,8 @@ int ctf_text_write_event(struct stream_pos *ppos, struct ctf_stream_definition * fprintf(pos->fp, "delta = "); else fprintf(pos->fp, "("); - if (pos->last_timestamp != -1ULL) { - delta = stream->timestamp - pos->last_timestamp; + if (pos->last_real_timestamp != -1ULL) { + delta = stream->real_timestamp - pos->last_real_timestamp; delta_sec = delta / NSEC_PER_SEC; delta_nsec = delta % NSEC_PER_SEC; fprintf(pos->fp, "+%" PRIu64 ".%09" PRIu64, @@ -293,7 +307,8 @@ int ctf_text_write_event(struct stream_pos *ppos, struct ctf_stream_definition * fprintf(pos->fp, ", "); else fprintf(pos->fp, " "); - pos->last_timestamp = stream->timestamp; + pos->last_real_timestamp = stream->real_timestamp; + pos->last_cycles_timestamp = stream->cycles_timestamp; } if ((opt_trace_field || opt_all_fields) && stream_class->trace->path[0] != '\0') { @@ -448,7 +463,6 @@ int ctf_text_write_event(struct stream_pos *ppos, struct ctf_stream_definition * /* newline */ fprintf(pos->fp, "\n"); pos->field_nr = 0; - stream->consumed = 1; return 0; @@ -467,7 +481,8 @@ struct trace_descriptor *ctf_text_open_trace(const char *path, int flags, pos = g_new0(struct ctf_text_stream_pos, 1); - pos->last_timestamp = -1ULL; + pos->last_real_timestamp = -1ULL; + pos->last_cycles_timestamp = -1ULL; switch (flags & O_ACCMODE) { case O_RDWR: if (!path)