mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0075-tests-qemu-boot-analysis-Dump-pass-data-times-in-ms-.patch

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