projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib: remove "unknown clock snapshot" concept
[babeltrace.git]
/
plugins
/
text
/
pretty
/
print.c
diff --git
a/plugins/text/pretty/print.c
b/plugins/text/pretty/print.c
index 25565df8b4c97a410df62b95048afe64e38ed6b1..efcf2b885d3d6523f52218e3e86fec0226f12de1 100644
(file)
--- a/
plugins/text/pretty/print.c
+++ b/
plugins/text/pretty/print.c
@@
-78,23
+78,25
@@
void print_field_name_equal(struct pretty_component *pretty, const char *name)
static
void print_timestamp_cycles(struct pretty_component *pretty,
static
void print_timestamp_cycles(struct pretty_component *pretty,
- const bt_clock_snapshot *clock_snapshot)
+ const bt_clock_snapshot *clock_snapshot
, bool update_last
)
{
uint64_t cycles;
cycles = bt_clock_snapshot_get_value(clock_snapshot);
g_string_append_printf(pretty->string, "%020" PRIu64, cycles);
{
uint64_t cycles;
cycles = bt_clock_snapshot_get_value(clock_snapshot);
g_string_append_printf(pretty->string, "%020" PRIu64, cycles);
- if (pretty->last_cycles_timestamp != -1ULL) {
- pretty->delta_cycles = cycles - pretty->last_cycles_timestamp;
- }
+ if (update_last) {
+ if (pretty->last_cycles_timestamp != -1ULL) {
+ pretty->delta_cycles = cycles - pretty->last_cycles_timestamp;
+ }
- pretty->last_cycles_timestamp = cycles;
+ pretty->last_cycles_timestamp = cycles;
+ }
}
static
void print_timestamp_wall(struct pretty_component *pretty,
}
static
void print_timestamp_wall(struct pretty_component *pretty,
- const bt_clock_snapshot *clock_snapshot)
+ const bt_clock_snapshot *clock_snapshot
, bool update_last
)
{
int ret;
int64_t ts_nsec = 0; /* add configurable offset */
{
int ret;
int64_t ts_nsec = 0; /* add configurable offset */
@@
-114,11
+116,14
@@
void print_timestamp_wall(struct pretty_component *pretty,
return;
}
return;
}
- if (pretty->last_real_timestamp != -1ULL) {
- pretty->delta_real_timestamp = ts_nsec - pretty->last_real_timestamp;
+ if (update_last) {
+ if (pretty->last_real_timestamp != -1ULL) {
+ pretty->delta_real_timestamp = ts_nsec - pretty->last_real_timestamp;
+ }
+
+ pretty->last_real_timestamp = ts_nsec;
}
}
- pretty->last_real_timestamp = ts_nsec;
ts_sec += ts_nsec / NSEC_PER_SEC;
ts_nsec = ts_nsec % NSEC_PER_SEC;
ts_sec += ts_nsec / NSEC_PER_SEC;
ts_nsec = ts_nsec % NSEC_PER_SEC;
@@
-221,14
+226,7
@@
int print_event_timestamp(struct pretty_component *pretty,
goto end;
}
goto end;
}
- if (bt_message_event_borrow_default_clock_snapshot_const(event_msg,
- &clock_snapshot) != BT_CLOCK_SNAPSHOT_STATE_KNOWN) {
- /*
- * No known default clock value: skip the timestamp
- * without an error.
- */
- goto end;
- }
+ clock_snapshot = bt_message_event_borrow_default_clock_snapshot_const(event_msg);
if (print_names) {
print_name_equal(pretty, "timestamp");
if (print_names) {
print_name_equal(pretty, "timestamp");
@@
-239,9
+237,9
@@
int print_event_timestamp(struct pretty_component *pretty,
g_string_append(pretty->string, COLOR_TIMESTAMP);
}
if (pretty->options.print_timestamp_cycles) {
g_string_append(pretty->string, COLOR_TIMESTAMP);
}
if (pretty->options.print_timestamp_cycles) {
- print_timestamp_cycles(pretty, clock_snapshot);
+ print_timestamp_cycles(pretty, clock_snapshot
, true
);
} else {
} else {
- print_timestamp_wall(pretty, clock_snapshot);
+ print_timestamp_wall(pretty, clock_snapshot
, true
);
}
if (pretty->use_colors) {
g_string_append(pretty->string, COLOR_RST);
}
if (pretty->use_colors) {
g_string_append(pretty->string, COLOR_RST);
@@
-260,7
+258,7
@@
int print_event_timestamp(struct pretty_component *pretty,
if (pretty->options.print_timestamp_cycles) {
if (pretty->delta_cycles == -1ULL) {
g_string_append(pretty->string,
if (pretty->options.print_timestamp_cycles) {
if (pretty->delta_cycles == -1ULL) {
g_string_append(pretty->string,
- "+??????????\?\?
)
"); /* Not a trigraph. */
+ "+??????????\?\?"); /* Not a trigraph. */
} else {
g_string_append_printf(pretty->string,
"+%012" PRIu64, pretty->delta_cycles);
} else {
g_string_append_printf(pretty->string,
"+%012" PRIu64, pretty->delta_cycles);
@@
-329,8
+327,8
@@
int print_event_header(struct pretty_component *pretty,
g_string_append(pretty->string, name);
g_string_append(pretty->string, name);
- if (
!
print_names) {
- g_string_append(pretty->string, " ");
+ if (print_names) {
+ g_string_append(pretty->string, "
,
");
}
}
}
}
}
}
@@
-411,7
+409,7
@@
int print_event_header(struct pretty_component *pretty,
} else if (dom_print) {
g_string_append(pretty->string, ":");
}
} else if (dom_print) {
g_string_append(pretty->string, ":");
}
- value = bt_value_integer_get(vpid_value);
+ value = bt_value_
signed_
integer_get(vpid_value);
g_string_append_printf(pretty->string,
"(%" PRId64 ")", value);
dom_print = 1;
g_string_append_printf(pretty->string,
"(%" PRId64 ")", value);
dom_print = 1;
@@
-541,10
+539,10
@@
int print_integer(struct pretty_component *pretty,
len = bt_field_class_integer_get_field_value_range(int_fc);
g_string_append(pretty->string, "0b");
len = bt_field_class_integer_get_field_value_range(int_fc);
g_string_append(pretty->string, "0b");
-
v.u = _bt_piecewis
e_lshift(v.u, 64 - len);
+
_bt_saf
e_lshift(v.u, 64 - len);
for (bitnr = 0; bitnr < len; bitnr++) {
g_string_append_printf(pretty->string, "%u", (v.u & (1ULL << 63)) ? 1 : 0);
for (bitnr = 0; bitnr < len; bitnr++) {
g_string_append_printf(pretty->string, "%u", (v.u & (1ULL << 63)) ? 1 : 0);
-
v.u = _bt_piecewis
e_lshift(v.u, 1);
+
_bt_saf
e_lshift(v.u, 1);
}
break;
}
}
break;
}
@@
-770,7
+768,7
@@
int print_struct_field(struct pretty_component *pretty,
int ret = 0;
const char *field_name;
const bt_field *field = NULL;
int ret = 0;
const char *field_name;
const bt_field *field = NULL;
- const bt_field_class
*field_class = NULL;
;
+ const bt_field_class
_structure_member *member
;
field = bt_field_structure_borrow_member_field_by_index_const(_struct, i);
if (!field) {
field = bt_field_structure_borrow_member_field_by_index_const(_struct, i);
if (!field) {
@@
-778,8
+776,9
@@
int print_struct_field(struct pretty_component *pretty,
goto end;
}
goto end;
}
- bt_field_class_structure_borrow_member_by_index_const(struct_class, i,
- &field_name, &field_class);
+ member = bt_field_class_structure_borrow_member_by_index_const(
+ struct_class, i);
+ field_name = bt_field_class_structure_member_get_name(member);
if (filter_fields && !filter_field_name(pretty, field_name,
filter_fields, filter_array_len)) {
if (filter_fields && !filter_field_name(pretty, field_name,
filter_fields, filter_array_len)) {
@@
-816,11
+815,9
@@
int print_struct(struct pretty_component *pretty,
ret = -1;
goto end;
}
ret = -1;
goto end;
}
+
nr_fields = bt_field_class_structure_get_member_count(struct_class);
nr_fields = bt_field_class_structure_get_member_count(struct_class);
- if (nr_fields < 0) {
- ret = -1;
- goto end;
- }
+
g_string_append(pretty->string, "{");
pretty->depth++;
nr_printed_fields = 0;
g_string_append(pretty->string, "{");
pretty->depth++;
nr_printed_fields = 0;
@@
-918,11
+915,6
@@
int print_sequence(struct pretty_component *pretty,
uint64_t i;
len = bt_field_array_get_length(seq);
uint64_t i;
len = bt_field_array_get_length(seq);
- if (len < 0) {
- ret = -1;
- goto end;
- }
-
g_string_append(pretty->string, "[");
pretty->depth++;
g_string_append(pretty->string, "[");
pretty->depth++;
@@
-1214,6
+1206,7
@@
int print_discarded_elements_msg(struct pretty_component *pretty,
bt_uuid trace_uuid;
int64_t stream_class_id;
int64_t stream_id;
bt_uuid trace_uuid;
int64_t stream_class_id;
int64_t stream_id;
+ const char *init_msg;
/* Stream name */
stream_name = bt_stream_get_name(stream);
/* Stream name */
stream_name = bt_stream_get_name(stream);
@@
-1243,16
+1236,22
@@
int print_discarded_elements_msg(struct pretty_component *pretty,
/* Format message */
g_string_assign(pretty->string, "");
/* Format message */
g_string_assign(pretty->string, "");
+
+ if (count == UINT64_C(-1)) {
+ init_msg = "Tracer may have discarded";
+ } else {
+ init_msg = "Tracer discarded";
+ }
+
g_string_append_printf(pretty->string,
g_string_append_printf(pretty->string,
- "%s%sWARNING%s%s:
Tracer discarded
",
+ "%s%sWARNING%s%s:
%s
",
bt_common_color_fg_yellow(),
bt_common_color_bold(),
bt_common_color_reset(),
bt_common_color_fg_yellow(),
bt_common_color_bold(),
bt_common_color_reset(),
- bt_common_color_fg_yellow());
+ bt_common_color_fg_yellow()
, init_msg
);
if (count == UINT64_C(-1)) {
if (count == UINT64_C(-1)) {
- g_string_append_printf(pretty->string, "a number of %ss",
- elem_type);
+ g_string_append_printf(pretty->string, "%ss", elem_type);
} else {
g_string_append_printf(pretty->string,
"%" PRIu64 " %s%s", count, elem_type,
} else {
g_string_append_printf(pretty->string,
"%" PRIu64 " %s%s", count, elem_type,
@@
-1261,9
+1260,9
@@
int print_discarded_elements_msg(struct pretty_component *pretty,
if (begin_clock_snapshot && end_clock_snapshot) {
g_string_append(pretty->string, " between [");
if (begin_clock_snapshot && end_clock_snapshot) {
g_string_append(pretty->string, " between [");
- print_timestamp_wall(pretty, begin_clock_snapshot);
+ print_timestamp_wall(pretty, begin_clock_snapshot
, false
);
g_string_append(pretty->string, "] and [");
g_string_append(pretty->string, "] and [");
- print_timestamp_wall(pretty, end_clock_snapshot);
+ print_timestamp_wall(pretty, end_clock_snapshot
, false
);
g_string_append(pretty->string, "]");
} else {
g_string_append(pretty->string, "(unknown time range)");
g_string_append(pretty->string, "]");
} else {
g_string_append(pretty->string, "(unknown time range)");
@@
-1361,16
+1360,16
@@
int pretty_print_discarded_items(struct pretty_component *pretty,
if (bt_stream_class_borrow_default_clock_class_const(stream_class)) {
switch (bt_message_get_type(msg)) {
case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
if (bt_stream_class_borrow_default_clock_class_const(stream_class)) {
switch (bt_message_get_type(msg)) {
case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
- bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
- msg
, &begin
);
- bt_message_discarded_events_borrow_default_end_clock_snapshot_const(
- msg
, &end
);
+ b
egin = b
t_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
+ msg);
+
end =
bt_message_discarded_events_borrow_default_end_clock_snapshot_const(
+ msg);
break;
case BT_MESSAGE_TYPE_DISCARDED_PACKETS:
break;
case BT_MESSAGE_TYPE_DISCARDED_PACKETS:
- bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
- msg
, &begin
);
- bt_message_discarded_packets_borrow_default_end_clock_snapshot_const(
- msg
, &end
);
+ b
egin = b
t_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
+ msg);
+
end =
bt_message_discarded_packets_borrow_default_end_clock_snapshot_const(
+ msg);
break;
default:
abort();
break;
default:
abort();
This page took
0.030177 seconds
and
4
git commands to generate.