X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=plugins%2Ftext%2Fprint.c;h=3a683a8388a12984729e71a4cd574437970f3773;hp=b227e399d219fa9510c16cd558822f995d95d05c;hb=3af83b5a0b18de8603239be8d7d50020d76c3d21;hpb=f504043cde2c53406808a400a5e5e7d84cba3c04 diff --git a/plugins/text/print.c b/plugins/text/print.c index b227e399..3a683a83 100644 --- a/plugins/text/print.c +++ b/plugins/text/print.c @@ -82,6 +82,11 @@ void print_timestamp_cycles(struct text_component *text, return; } fprintf(text->out, "%020" PRIu64, cycles); + + if (text->last_cycles_timestamp != -1ULL) { + text->delta_cycles = cycles - text->last_cycles_timestamp; + } + text->last_cycles_timestamp = cycles; } static @@ -109,6 +114,11 @@ void print_timestamp_wall(struct text_component *text, return; } + if (text->last_real_timestamp != -1ULL) { + text->delta_real_timestamp = ts_nsec - text->last_real_timestamp; + } + text->last_real_timestamp = ts_nsec; + ts_sec += ts_nsec / NSEC_PER_SEC; ts_nsec = ts_nsec % NSEC_PER_SEC; if (ts_sec >= 0 && ts_nsec >= 0) { @@ -233,13 +243,36 @@ enum bt_component_status print_event_timestamp(struct text_component *text, if (!print_names) fputs("] ", out); - *start_line = !print_names; - if (!text->options.print_delta_field) { - goto end; + if (text->options.print_delta_field) { + if (print_names) + fputs(", delta = ", text->out); + else + fputs("(", text->out); + if (text->options.print_timestamp_cycles) { + if (text->delta_cycles == -1ULL) { + fputs("+??????????\?\?) ", text->out); /* Not a trigraph. */ + } else { + fprintf(text->out, "+%012" PRIu64, text->delta_cycles); + } + } else { + if (text->delta_real_timestamp != -1ULL) { + uint64_t delta_sec, delta_nsec, delta; + + delta = text->delta_real_timestamp; + delta_sec = delta / NSEC_PER_SEC; + delta_nsec = delta % NSEC_PER_SEC; + fprintf(text->out, "+%" PRIu64 ".%09" PRIu64, + delta_sec, delta_nsec); + } else { + fputs("+?.?????????", text->out); + } + } + if (!print_names) { + fputs(") ", text->out); + } } - - //TODO delta + *start_line = !print_names; end: bt_put(stream);