Skip to contentSkip to conversation

blkparse: Print time when trace was started

PATCH Applied Jan Kara 3 participants 4 messages Jan 13, 2021 – Apr 19, 2021 Block layer

lore
Share & tools
lore

Jan Kara

author
#0 lore raw

PATCH 1/1 blkparse: Print time when trace was started

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.

---
 blkparse.c | 2 ++
 1 file changed, 2 insertions(+)
blkparse.c +2 -0
index 911309e26a15..dc518632ebf5 100644
@@ -31,6 +31,7 @@
 #include <signal.h>
 #include <locale.h>
 #include <libgen.h>
+#include <time.h>
 
 #include "blktrace.h"
 #include "rbtree.h"
@@ -2797,6 +2798,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);
 }
Signature · 1 line
2.26.2
author
#2 lore raw
In reply to Jan Kara
Quoted 5 lines · Jan Kara

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.

Ping Jens, can you please merge this blktrace patch? Thanks!

Honza

Quoted 27 lines
---
 blkparse.c | 2 ++
 1 file changed, 2 insertions(+)
blkparse.c +2 -0
index 911309e26a15..dc518632ebf5 100644
@@ -31,6 +31,7 @@
 #include <signal.h>
 #include <locale.h>
 #include <libgen.h>
+#include <time.h>
 
 #include "blktrace.h"
 #include "rbtree.h"
@@ -2797,6 +2798,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);
 }
Signature · 1 line
2.26.2
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
maintainer Applied
#3 lore raw
In reply to Jan Kara
Quoted 3 lines · Jan Kara

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.

Applied, thanks.

Signature · 1 line
Jens Axboe