lib: add aliases for Babeltrace enumeration types
[babeltrace.git] / plugins / text / pretty / print.c
index 3c3988827df02d15dd081e7bc62cfe0daf477277..32719cbaec5a5e6ab4bced0763cc1ad530212701 100644 (file)
@@ -46,7 +46,7 @@
 
 struct timestamp {
        int64_t real_timestamp; /* Relative to UNIX epoch. */
-       uint64_t clock_value;   /* In cycles. */
+       uint64_t clock_snapshot;        /* In cycles. */
 };
 
 static
@@ -80,17 +80,17 @@ static
 void print_timestamp_cycles(struct pretty_component *pretty,
                const bt_event *event)
 {
-       const bt_clock_value *clock_value;
+       const bt_clock_snapshot *clock_snapshot;
        uint64_t cycles;
-       enum bt_clock_value_status cv_status;
+       bt_clock_snapshot_state cs_state;
 
-       cv_status = bt_event_borrow_default_clock_value_const(event, &clock_value);
-       if (cv_status != BT_CLOCK_VALUE_STATUS_KNOWN || !clock_value) {
+       cs_state = bt_event_borrow_default_clock_snapshot_const(event, &clock_snapshot);
+       if (cs_state != BT_CLOCK_SNAPSHOT_STATE_KNOWN || !clock_snapshot) {
                g_string_append(pretty->string, "????????????????????");
                return;
        }
 
-       cycles = bt_clock_value_get_value(clock_value);
+       cycles = bt_clock_snapshot_get_value(clock_snapshot);
        g_string_append_printf(pretty->string, "%020" PRIu64, cycles);
 
        if (pretty->last_cycles_timestamp != -1ULL) {
@@ -101,7 +101,7 @@ void print_timestamp_cycles(struct pretty_component *pretty,
 
 static
 void print_timestamp_wall(struct pretty_component *pretty,
-               const bt_clock_value *clock_value)
+               const bt_clock_snapshot *clock_snapshot)
 {
        int ret;
        int64_t ts_nsec = 0;    /* add configurable offset */
@@ -109,12 +109,12 @@ void print_timestamp_wall(struct pretty_component *pretty,
        uint64_t ts_sec_abs, ts_nsec_abs;
        bool is_negative;
 
-       if (!clock_value) {
+       if (!clock_snapshot) {
                g_string_append(pretty->string, "??:??:??.?????????");
                return;
        }
 
-       ret = bt_clock_value_get_ns_from_origin(clock_value, &ts_nsec);
+       ret = bt_clock_snapshot_get_ns_from_origin(clock_snapshot, &ts_nsec);
        if (ret) {
                // TODO: log, this is unexpected
                g_string_append(pretty->string, "Error");
@@ -222,8 +222,8 @@ int print_event_timestamp(struct pretty_component *pretty,
        int ret = 0;
        const bt_stream *stream = NULL;
        const bt_stream_class *stream_class = NULL;
-       const bt_clock_value *clock_value = NULL;
-       enum bt_clock_value_status cv_status;
+       const bt_clock_snapshot *clock_snapshot = NULL;
+       bt_clock_snapshot_state cs_state;
 
        stream = bt_event_borrow_stream_const(event);
        if (!stream) {
@@ -237,9 +237,9 @@ int print_event_timestamp(struct pretty_component *pretty,
                goto end;
        }
 
-       cv_status = bt_event_borrow_default_clock_value_const(event,
-               &clock_value);
-       if (cv_status != BT_CLOCK_VALUE_STATUS_KNOWN || !clock_value) {
+       cs_state = bt_event_borrow_default_clock_snapshot_const(event,
+               &clock_snapshot);
+       if (cs_state != BT_CLOCK_SNAPSHOT_STATE_KNOWN || !clock_snapshot) {
                /* No default clock value: skip the timestamp without an error */
                goto end;
        }
@@ -255,10 +255,10 @@ int print_event_timestamp(struct pretty_component *pretty,
        if (pretty->options.print_timestamp_cycles) {
                print_timestamp_cycles(pretty, event);
        } else {
-               clock_value = NULL;
-               cv_status = bt_event_borrow_default_clock_value_const(event,
-                       &clock_value);
-               print_timestamp_wall(pretty, clock_value);
+               clock_snapshot = NULL;
+               cs_state = bt_event_borrow_default_clock_snapshot_const(event,
+                       &clock_snapshot);
+               print_timestamp_wall(pretty, clock_snapshot);
        }
        if (pretty->use_colors) {
                g_string_append(pretty->string, COLOR_RST);
@@ -319,7 +319,7 @@ int print_event_header(struct pretty_component *pretty,
        const bt_stream *stream = NULL;
        const bt_trace *trace = NULL;
        int dom_print = 0;
-       enum bt_property_availability prop_avail;
+       bt_property_availability prop_avail;
 
        event_class = bt_event_borrow_class_const(event);
        stream_class = bt_event_class_borrow_stream_class_const(event_class);
@@ -451,7 +451,7 @@ int print_event_header(struct pretty_component *pretty,
                        [ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE ] = "TRACE_DEBUG_LINE",
                        [ BT_EVENT_CLASS_LOG_LEVEL_DEBUG ] = "TRACE_DEBUG",
                };
-               enum bt_event_class_log_level log_level;
+               bt_event_class_log_level log_level;
                const char *log_level_str = NULL;
 
                prop_avail = bt_event_class_get_log_level(event_class,
@@ -525,14 +525,14 @@ int print_integer(struct pretty_component *pretty,
                const bt_field *field)
 {
        int ret = 0;
-       enum bt_field_class_integer_preferred_display_base base;
+       bt_field_class_integer_preferred_display_base base;
        const bt_field_class *int_fc;
        union {
                uint64_t u;
                int64_t s;
        } v;
        bool rst_color = false;
-       enum bt_field_class_type ft_type;
+       bt_field_class_type ft_type;
 
        int_fc = bt_field_borrow_class_const(field);
        BT_ASSERT(int_fc);
@@ -986,7 +986,7 @@ int print_field(struct pretty_component *pretty,
                const bt_field *field, bool print_names,
                GQuark *filter_fields, int filter_array_len)
 {
-       enum bt_field_class_type class_id;
+       bt_field_class_type class_id;
 
        class_id = bt_field_get_class_type(field);
        switch (class_id) {
@@ -1196,11 +1196,11 @@ end:
 
 BT_HIDDEN
 int pretty_print_event(struct pretty_component *pretty,
-               const bt_notification *event_notif)
+               const bt_message *event_msg)
 {
        int ret;
        const bt_event *event =
-               bt_notification_event_borrow_event_const(event_notif);
+               bt_message_event_borrow_event_const(event_msg);
 
        BT_ASSERT(event);
        pretty->start_line = true;
@@ -1262,8 +1262,8 @@ int print_discarded_elements_msg(
        const unsigned char *trace_uuid;
        int64_t stream_class_id;
        int64_t stream_id;
-       bt_clock_value *begin_clock_value = NULL;
-       bt_clock_value *end_clock_value = NULL;
+       bt_clock_snapshot *begin_clock_snapshot = NULL;
+       bt_clock_snapshot *end_clock_snapshot = NULL;
 
        /* Stream name */
        BT_ASSERT(packet);
@@ -1291,10 +1291,10 @@ int print_discarded_elements_msg(
        trace_uuid = bt_trace_get_uuid(trace);
 
        /* Beginning and end times */
-       (void) bt_packet_borrow_previous_packet_default_end_clock_value_const(
-               packet, &begin_clock_value);
-       (void) bt_packet_borrow_default_end_clock_value_const(packet,
-               &end_clock_value);
+       (void) bt_packet_borrow_previous_packet_default_end_clock_snapshot_const(
+               packet, &begin_clock_snapshot);
+       (void) bt_packet_borrow_default_end_clock_snapshot_const(packet,
+               &end_clock_snapshot);
 
        /* Format message */
        g_string_assign(pretty->string, "");
@@ -1306,11 +1306,11 @@ int print_discarded_elements_msg(
                bt_common_color_fg_yellow(),
                count, elem_type, count == 1 ? "" : "s");
 
-       if (begin_clock_value && end_clock_value) {
+       if (begin_clock_snapshot && end_clock_snapshot) {
                g_string_append(pretty->string, "between [");
-               print_timestamp_wall(pretty, begin_clock_value);
+               print_timestamp_wall(pretty, begin_clock_snapshot);
                g_string_append(pretty->string, "] and [");
-               print_timestamp_wall(pretty, end_clock_value);
+               print_timestamp_wall(pretty, end_clock_snapshot);
                g_string_append(pretty->string, "]");
        } else {
                g_string_append(pretty->string, "(unknown time range)");
@@ -1370,11 +1370,11 @@ int print_discarded_elements_msg(
 
 BT_HIDDEN
 int pretty_print_packet(struct pretty_component *pretty,
-               const bt_notification *packet_beginning_notif)
+               const bt_message *packet_beginning_msg)
 {
 #if 0
-       const bt_packet *packet = bt_notification_packet_beginning_borrow_packet_const(
-               packet_beginning_notif);
+       const bt_packet *packet = bt_message_packet_beginning_borrow_packet_const(
+               packet_beginning_msg);
        uint64_t count;
        int status = 0;
 
This page took 0.029336 seconds and 4 git commands to generate.