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
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) {
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);
text->out = stdout;
text->err = stderr;
+ text->delta_cycles = -1ULL;
+ text->last_cycles_timestamp = -1ULL;
+
+ text->delta_real_timestamp = -1ULL;
+ text->last_real_timestamp = -1ULL;
+
ret = apply_params(text, params);
if (ret != BT_COMPONENT_STATUS_OK) {
goto error;
struct text_options options;
FILE *out, *err;
bool processed_first_event;
- uint64_t last_real_timestamp;
int depth; /* nesting, used for tabulation alignment. */
bool start_line;
GString *string;
struct bt_value *plugin_opt_map; /* Temporary parameter map. */
+
+ uint64_t last_cycles_timestamp;
+ uint64_t delta_cycles;
+
+ uint64_t last_real_timestamp;
+ uint64_t delta_real_timestamp;
};
BT_HIDDEN