From c829a65c9ea7621755f2d0acd39dad6dba00b44e Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sat, 23 Mar 2013 13:19:52 -0400 Subject: [PATCH] Reinsert "at end of stream" message for discarded events Ref #469 Signed-off-by: Mathieu Desnoyers --- formats/ctf-text/ctf-text.c | 2 +- formats/ctf/ctf.c | 12 ++++++++---- include/babeltrace/ctf/events-internal.h | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/formats/ctf-text/ctf-text.c b/formats/ctf-text/ctf-text.c index f60fde62..d6bafd31 100644 --- a/formats/ctf-text/ctf-text.c +++ b/formats/ctf-text/ctf-text.c @@ -265,7 +265,7 @@ int ctf_text_write_event(struct bt_stream_pos *ppos, struct ctf_stream_definitio /* Print events discarded */ if (stream->events_discarded) { fflush(pos->fp); - ctf_print_discarded(stderr, stream); + ctf_print_discarded(stderr, stream, 0); stream->events_discarded = 0; } diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 8f8af525..137c11ec 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -400,10 +400,12 @@ void print_uuid(FILE *fp, unsigned char *uuid) fprintf(fp, "%x", (unsigned int) uuid[i]); } -void ctf_print_discarded(FILE *fp, struct ctf_stream_definition *stream) +void ctf_print_discarded(FILE *fp, struct ctf_stream_definition *stream, + int end_stream) { - fprintf(fp, "[warning] Tracer discarded %" PRIu64 " events between [", - stream->events_discarded); + fprintf(fp, "[warning] Tracer discarded %" PRIu64 " events %sbetween [", + stream->events_discarded, + end_stream ? "at end of stream " : ""); if (opt_clock_cycles) { ctf_print_timestamp(fp, stream, stream->prev_cycles_timestamp); @@ -781,7 +783,9 @@ void ctf_packet_seek(struct bt_stream_pos *stream_pos, size_t index, int whence) */ if (file_stream->parent.events_discarded) { fflush(stdout); - ctf_print_discarded(stderr, &file_stream->parent); + ctf_print_discarded(stderr, + &file_stream->parent, + 1); file_stream->parent.events_discarded = 0; } } diff --git a/include/babeltrace/ctf/events-internal.h b/include/babeltrace/ctf/events-internal.h index c7c28a1e..be111c17 100644 --- a/include/babeltrace/ctf/events-internal.h +++ b/include/babeltrace/ctf/events-internal.h @@ -79,6 +79,7 @@ struct bt_ctf_iter { uint64_t events_lost; }; -void ctf_print_discarded(FILE *fp, struct ctf_stream_definition *stream); +void ctf_print_discarded(FILE *fp, struct ctf_stream_definition *stream, + int end_stream); #endif /*_BABELTRACE_CTF_EVENTS_INTERNAL_H */ -- 2.34.1