From 4248b89b10c88503e6a2c1e3a476571973b309d6 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 30 Apr 2016 16:02:30 +0100 Subject: [PATCH] tests/qemu: boot-analysis: Dump pass data times in ms, with diffs. When (in --verbose mode) we dump the pass data, dump the times in milliseconds (instead of nanoseconds) so they are consistent with other output. Also dump the time difference from the previous event. Useful for detailed debugging/analysis of problems. (cherry picked from commit 2fd05203e461445c8053116b4276beb81b4d95d8) --- tests/qemu/boot-analysis.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/qemu/boot-analysis.c b/tests/qemu/boot-analysis.c index ace4653..a203f94 100644 --- a/tests/qemu/boot-analysis.c +++ b/tests/qemu/boot-analysis.c @@ -863,12 +863,18 @@ dump_pass_data (void) printf (" number of events collected %zu\n", pass_data[i].nr_events); printf (" elapsed time %" PRIi64 " ns\n", pass_data[i].elapsed_ns); for (j = 0; j < pass_data[i].nr_events; ++j) { - int64_t ns; + int64_t ns, diff_ns; CLEANUP_FREE char *event_str = NULL; ns = timespec_diff (&pass_data[i].start_t, &pass_data[i].events[j].t); event_str = guestfs_event_to_string (pass_data[i].events[j].source); - printf (" #%zu: +%" PRIi64 " [%s] \"", j, ns, event_str); + printf (" %.1fms ", ns / 1000000.0); + if (j > 0) { + diff_ns = timespec_diff (&pass_data[i].events[j-1].t, + &pass_data[i].events[j].t); + printf ("(+%.1f) ", diff_ns / 1000000.0); + } + printf ("[%s] \"", event_str); print_escaped_string (pass_data[i].events[j].message); printf ("\"\n"); } -- 1.8.3.1