text output: wire up clock options, error checking
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 24 Nov 2016 22:33:16 +0000 (17:33 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 27 May 2017 18:09:07 +0000 (14:09 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
plugins/text/print.c
plugins/text/text.c

index 97c526ff71bde0a139d8d0dac0a351ec120e3d53..b227e399d219fa9510c16cd558822f995d95d05c 100644 (file)
@@ -4,6 +4,7 @@
  * Babeltrace CTF Text Output Plugin Event Printing
  *
  * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
  * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
@@ -136,7 +137,7 @@ void print_timestamp_wall(struct text_component *text,
                ts_nsec_abs = -ts_nsec;
        }
 
-       if (/*!opt_clock_seconds*/true) {
+       if (!text->options.clock_seconds) {
                struct tm tm;
                time_t time_s = (time_t) ts_sec_abs;
 
@@ -145,7 +146,7 @@ void print_timestamp_wall(struct text_component *text,
                        goto seconds;
                }
 
-               if (/*!opt_clock_gmt*/true) {
+               if (!text->options.clock_gmt) {
                        struct tm *res;
 
                        res = localtime_r(&time_s, &tm);
@@ -162,7 +163,7 @@ void print_timestamp_wall(struct text_component *text,
                                goto seconds;
                        }
                }
-               if (/*opt_clock_date*/false) {
+               if (text->options.clock_date) {
                        char timestr[26];
                        size_t res;
 
@@ -207,10 +208,21 @@ enum bt_component_status print_event_timestamp(struct text_component *text,
                goto end;
        }
 
-       /* FIXME - error checking */
        stream_class = bt_ctf_stream_get_class(stream);
+       if (!stream_class) {
+               ret = BT_COMPONENT_STATUS_ERROR;
+               goto end;
+       }
        trace = bt_ctf_stream_class_get_trace(stream_class);
+       if (!trace) {
+               ret = BT_COMPONENT_STATUS_ERROR;
+               goto end;
+       }
        clock = bt_ctf_trace_get_clock(trace, 0);
+       if (!clock) {
+               ret = BT_COMPONENT_STATUS_ERROR;
+               goto end;
+       }
 
        fputs(print_names ? "timestamp = " : "[", out);
        if (text->options.print_timestamp_cycles) {
@@ -226,6 +238,9 @@ enum bt_component_status print_event_timestamp(struct text_component *text,
        if (!text->options.print_delta_field) {
                goto end;
        }
+
+       //TODO delta
+
 end:
        bt_put(stream);
        bt_put(clock);
index 720c431f3de893c397befec3198f132f02017a35..f5a62c63aeaa69ea82fb8758d7548f92e40c9589 100644 (file)
@@ -4,6 +4,7 @@
  * Babeltrace CTF Text Output Plugin
  *
  * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
  * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
This page took 0.027844 seconds and 4 git commands to generate.