blkparse: Print time when trace was started
authorJan Kara <jack@suse.cz>
Wed, 13 Jan 2021 11:26:43 +0000 (12:26 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 19 Apr 2021 17:55:04 +0000 (11:55 -0600)
For correlating blktrace data with other information, it is useful to
know when the trace has been captured. Since the absolute timestamp
is contained in the blktrace file, just output it.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Link: https://lore.kernel.org/r/20210113112643.12893-1-jack@suse.cz
Signed-off-by: Jens Axboe <axboe@kernel.dk>
blkparse.c

index 33dd02374ea8f9cde5bc643eb015f471ca4a2b13..1d7ae9536c065dfcd3170b2e0d19d71f426e5536 100644 (file)
@@ -32,6 +32,7 @@
 #include <signal.h>
 #include <locale.h>
 #include <libgen.h>
+#include <time.h>
 
 #include "blktrace.h"
 #include "rbtree.h"
@@ -2888,6 +2889,7 @@ static void show_stats(void)
 
        if (per_device_and_cpu_stats)
                show_device_and_cpu_stats();
+       fprintf(ofp, "Trace started at %s\n", ctime(&abs_start_time.tv_sec));
 
        fflush(ofp);
 }