static
void print_timestamp_cycles(struct pretty_component *pretty,
- struct bt_clock_class *clock_class,
struct bt_event *event)
{
int ret;
struct bt_clock_value *clock_value;
uint64_t cycles;
- clock_value = bt_event_borrow_clock_value(event, clock_class);
+ clock_value = bt_event_borrow_default_clock_value(event);
if (!clock_value) {
g_string_append(pretty->string, "????????????????????");
return;
static
enum bt_component_status print_event_timestamp(struct pretty_component *pretty,
- struct bt_event *event,
- struct bt_clock_class_priority_map *cc_prio_map,
- bool *start_line)
+ struct bt_event *event, bool *start_line)
{
bool print_names = pretty->options.print_header_field_names;
enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
struct bt_stream *stream = NULL;
struct bt_stream_class *stream_class = NULL;
struct bt_trace *trace = NULL;
- struct bt_clock_class *clock_class = NULL;
+ struct bt_clock_value *clock_value = NULL;
stream = bt_event_borrow_stream(event);
if (!stream) {
goto end;
}
- if (bt_clock_class_priority_map_get_clock_class_count(cc_prio_map) == 0) {
- /* No clock class: skip the timestamp without an error */
- goto end;
- }
-
- clock_class =
- bt_clock_class_priority_map_borrow_highest_priority_clock_class(
- cc_prio_map);
- if (!clock_class) {
- ret = BT_COMPONENT_STATUS_ERROR;
+ clock_value = bt_event_borrow_default_clock_value(event);
+ if (!clock_value) {
+ /* No default clock value: skip the timestamp without an error */
goto end;
}
g_string_append(pretty->string, COLOR_TIMESTAMP);
}
if (pretty->options.print_timestamp_cycles) {
- print_timestamp_cycles(pretty, clock_class, event);
+ print_timestamp_cycles(pretty, event);
} else {
struct bt_clock_value *clock_value =
- bt_event_borrow_clock_value(event, clock_class);
+ bt_event_borrow_default_clock_value(event);
print_timestamp_wall(pretty, clock_value);
}
static
enum bt_component_status print_event_header(struct pretty_component *pretty,
- struct bt_event *event,
- struct bt_clock_class_priority_map *cc_prio_map)
+ struct bt_event *event)
{
bool print_names = pretty->options.print_header_field_names;
enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
ret = BT_COMPONENT_STATUS_ERROR;
goto end;
}
- ret = print_event_timestamp(pretty, event, cc_prio_map,
- &pretty->start_line);
+ ret = print_event_timestamp(pretty, event, &pretty->start_line);
if (ret != BT_COMPONENT_STATUS_OK) {
goto end;
}
enum bt_component_status ret;
struct bt_event *event =
bt_notification_event_borrow_event(event_notif);
- struct bt_clock_class_priority_map *cc_prio_map =
- bt_notification_event_borrow_clock_class_priority_map(
- event_notif);
BT_ASSERT(event);
- BT_ASSERT(cc_prio_map);
pretty->start_line = true;
g_string_assign(pretty->string, "");
- ret = print_event_header(pretty, event, cc_prio_map);
+ ret = print_event_header(pretty, event);
if (ret != BT_COMPONENT_STATUS_OK) {
goto end;
}
end:
return ret;
}
-
-BT_HIDDEN
-enum bt_component_status pretty_print_discarded_elements(
- struct pretty_component *pretty,
- struct bt_notification *notif)
-{
- enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
- struct bt_stream *stream = NULL;
- struct bt_stream_class *stream_class = NULL;
- struct bt_trace *trace = NULL;
- const char *stream_name;
- const char *trace_name;
- const unsigned char *trace_uuid;
- int64_t stream_class_id;
- int64_t stream_id;
- bool is_discarded_events;
- int64_t count;
- struct bt_clock_value *clock_value = NULL;
-
- /* Stream name */
- switch (bt_notification_get_type(notif)) {
- case BT_NOTIFICATION_TYPE_DISCARDED_EVENTS:
- stream = bt_notification_discarded_events_borrow_stream(notif);
- count = bt_notification_discarded_events_get_count(notif);
- is_discarded_events = true;
- break;
- case BT_NOTIFICATION_TYPE_DISCARDED_PACKETS:
- stream = bt_notification_discarded_packets_borrow_stream(notif);
- count = bt_notification_discarded_packets_get_count(notif);
- is_discarded_events = false;
- break;
- default:
- abort();
- }
-
- BT_ASSERT(stream);
- stream_name = bt_stream_get_name(stream);
-
- /* Stream class ID */
- stream_class = bt_stream_borrow_class(stream);
- BT_ASSERT(stream_class);
- stream_class_id = bt_stream_class_get_id(stream_class);
-
- /* Stream ID */
- stream_id = bt_stream_get_id(stream);
-
- /* Trace path */
- trace = bt_stream_class_borrow_trace(stream_class);
- BT_ASSERT(trace);
- trace_name = bt_trace_get_name(trace);
- if (!trace_name) {
- trace_name = "(unknown)";
- }
-
- /* Trace UUID */
- trace_uuid = bt_trace_get_uuid(trace);
-
- /*
- * Print to standard error stream to remain backward compatible
- * with Babeltrace 1.
- */
- fprintf(stderr,
- "%s%sWARNING%s%s: Tracer discarded %" PRId64 " %s%s between [",
- bt_common_color_fg_yellow(),
- bt_common_color_bold(),
- bt_common_color_reset(),
- bt_common_color_fg_yellow(),
- count, is_discarded_events ? "event" : "packet",
- count == 1 ? "" : "s");
- g_string_assign(pretty->string, "");
- clock_value = is_discarded_events ?
- bt_notification_discarded_events_borrow_begin_clock_value(notif) :
- bt_notification_discarded_packets_borrow_begin_clock_value(notif);
- print_timestamp_wall(pretty, clock_value);
- fprintf(stderr, "%s] and [", pretty->string->str);
- g_string_assign(pretty->string, "");
- clock_value = is_discarded_events ?
- bt_notification_discarded_events_borrow_end_clock_value(notif) :
- bt_notification_discarded_packets_borrow_end_clock_value(notif);
- print_timestamp_wall(pretty, clock_value);
- fprintf(stderr, "%s] in trace \"%s\" ",
- pretty->string->str, trace_name);
-
- if (trace_uuid) {
- fprintf(stderr,
- "(UUID: %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x) ",
- trace_uuid[0],
- trace_uuid[1],
- trace_uuid[2],
- trace_uuid[3],
- trace_uuid[4],
- trace_uuid[5],
- trace_uuid[6],
- trace_uuid[7],
- trace_uuid[8],
- trace_uuid[9],
- trace_uuid[10],
- trace_uuid[11],
- trace_uuid[12],
- trace_uuid[13],
- trace_uuid[14],
- trace_uuid[15]);
- } else {
- fprintf(stderr, "(no UUID) ");
- }
-
- fprintf(stderr, "within stream \"%s\" (stream class ID: %" PRId64 ", ",
- stream_name, stream_class_id);
-
- if (stream_id >= 0) {
- fprintf(stderr, "stream ID: %" PRId64, stream_id);
- } else {
- fprintf(stderr, "no stream ID");
- }
-
- fprintf(stderr, ").%s\n", bt_common_color_reset());
- return ret;
-}