diff mbox series

[babeltrace-1.5] lttng-live: print discarded event and packet lost warnings on stderr

Message ID 20170928140032.29879-1-mathieu.desnoyers@efficios.com
State Accepted, archived
Headers show
Series [babeltrace-1.5] lttng-live: print discarded event and packet lost warnings on stderr | expand

Commit Message

Mathieu Desnoyers Sept. 28, 2017, 2 p.m. UTC
Reported-by: Liguang Li <liguang.lee6 at gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 formats/ctf/ctf.c                    |  1 -
 formats/lttng-live/lttng-live-comm.c | 10 ++++++++++
 include/babeltrace/ctf/types.h       |  1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

Comments

Jérémie Galarneau Oct. 5, 2017, 3:59 p.m. UTC | #1
Merged in stable-1.5 and stable-1.4.

Thanks!
Jérémie

On 28 September 2017 at 10:00, Mathieu Desnoyers
<mathieu.desnoyers at efficios.com> wrote:
> Reported-by: Liguang Li <liguang.lee6 at gmail.com>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> ---
>  formats/ctf/ctf.c                    |  1 -
>  formats/lttng-live/lttng-live-comm.c | 10 ++++++++++
>  include/babeltrace/ctf/types.h       |  1 +
>  3 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
> index d6d078f5..36424de5 100644
> --- a/formats/ctf/ctf.c
> +++ b/formats/ctf/ctf.c
> @@ -434,7 +434,6 @@ void print_uuid(FILE *fp, unsigned char *uuid)
>   * consumer had time to extract them. We keep track of those gaps with the
>   * packet sequence number in each packet.
>   */
> -static
>  void ctf_print_discarded_lost(FILE *fp, struct ctf_stream_definition *stream)
>  {
>         if ((!stream->events_discarded && !stream->packets_lost) ||
> diff --git a/formats/lttng-live/lttng-live-comm.c b/formats/lttng-live/lttng-live-comm.c
> index a1c95bbc..77bf34ac 100644
> --- a/formats/lttng-live/lttng-live-comm.c
> +++ b/formats/lttng-live/lttng-live-comm.c
> @@ -1297,6 +1297,16 @@ retry:
>                 ctf_update_current_packet_index(&file_stream->parent,
>                                 prev_index, cur_index);
>
> +               /*
> +                * We need to check if we are in trace read or called
> +                * from packet indexing.  In this last case, the
> +                * collection is not there, so we cannot print the
> +                * timestamps.
> +                */
> +               if ((&file_stream->parent)->stream_class->trace->parent.collection) {
> +                       ctf_print_discarded_lost(stderr, &file_stream->parent);
> +               }
> +
>                 file_stream->parent.cycles_timestamp =
>                                 cur_index->ts_cycles.timestamp_begin;
>                 file_stream->parent.real_timestamp =
> diff --git a/include/babeltrace/ctf/types.h b/include/babeltrace/ctf/types.h
> index cc8acbf5..574f97b3 100644
> --- a/include/babeltrace/ctf/types.h
> +++ b/include/babeltrace/ctf/types.h
> @@ -249,5 +249,6 @@ void ctf_print_timestamp(FILE *fp, struct ctf_stream_definition *stream,
>                         uint64_t timestamp);
>  int ctf_append_trace_metadata(struct bt_trace_descriptor *tdp,
>                         FILE *metadata_fp);
> +void ctf_print_discarded_lost(FILE *fp, struct ctf_stream_definition *stream);
>
>  #endif /* _BABELTRACE_CTF_TYPES_H */
> --
> 2.11.0
>
diff mbox series

Patch

diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
index d6d078f5..36424de5 100644
--- a/formats/ctf/ctf.c
+++ b/formats/ctf/ctf.c
@@ -434,7 +434,6 @@  void print_uuid(FILE *fp, unsigned char *uuid)
  * consumer had time to extract them. We keep track of those gaps with the
  * packet sequence number in each packet.
  */
-static
 void ctf_print_discarded_lost(FILE *fp, struct ctf_stream_definition *stream)
 {
 	if ((!stream->events_discarded && !stream->packets_lost) ||
diff --git a/formats/lttng-live/lttng-live-comm.c b/formats/lttng-live/lttng-live-comm.c
index a1c95bbc..77bf34ac 100644
--- a/formats/lttng-live/lttng-live-comm.c
+++ b/formats/lttng-live/lttng-live-comm.c
@@ -1297,6 +1297,16 @@  retry:
 		ctf_update_current_packet_index(&file_stream->parent,
 				prev_index, cur_index);
 
+		/*
+		 * We need to check if we are in trace read or called
+		 * from packet indexing.  In this last case, the
+		 * collection is not there, so we cannot print the
+		 * timestamps.
+		 */
+		if ((&file_stream->parent)->stream_class->trace->parent.collection) {
+			ctf_print_discarded_lost(stderr, &file_stream->parent);
+		}
+
 		file_stream->parent.cycles_timestamp =
 				cur_index->ts_cycles.timestamp_begin;
 		file_stream->parent.real_timestamp =
diff --git a/include/babeltrace/ctf/types.h b/include/babeltrace/ctf/types.h
index cc8acbf5..574f97b3 100644
--- a/include/babeltrace/ctf/types.h
+++ b/include/babeltrace/ctf/types.h
@@ -249,5 +249,6 @@  void ctf_print_timestamp(FILE *fp, struct ctf_stream_definition *stream,
 			uint64_t timestamp);
 int ctf_append_trace_metadata(struct bt_trace_descriptor *tdp,
 			FILE *metadata_fp);
+void ctf_print_discarded_lost(FILE *fp, struct ctf_stream_definition *stream);
 
 #endif /* _BABELTRACE_CTF_TYPES_H */