From 44a178400ce99688fd84a0c814e2602007dafea6 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Sat, 16 Aug 2014 16:01:45 +0200 Subject: [PATCH] Update sadf -H output Update sadf -H output to: 1) display the date the file was created 2) tell whether this is a genuine sa datafile (ie. not converted from an old datafile) or not. Signed-off-by: Sebastien GODARD --- sadf_misc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sadf_misc.c b/sadf_misc.c index c540f4d..f368722 100644 --- a/sadf_misc.c +++ b/sadf_misc.c @@ -613,7 +613,7 @@ __printf_funct_t print_hdr_header(int *tab, int action, char *dfile, struct activity *act[], unsigned int id_seq[]) { int i, p; - struct tm *loc_t; + struct tm rectime, *loc_t; char cur_time[32]; /* Actions F_MAIN and F_END ignored */ @@ -627,6 +627,10 @@ __printf_funct_t print_hdr_header(int *tab, int action, char *dfile, return; } + printf(_("Genuine sa datafile: %s (%x)\n"), + file_magic->upgraded ? _("no") : _("yes"), + file_magic->upgraded); + printf(_("Host: ")); print_gal_header(localtime((const time_t *) &(file_hdr->sa_ust_time)), file_hdr->sa_sysname, file_hdr->sa_release, @@ -636,6 +640,11 @@ __printf_funct_t print_hdr_header(int *tab, int action, char *dfile, printf(_("Number of CPU for last samples in file: %u\n"), file_hdr->sa_last_cpu_nr > 1 ? file_hdr->sa_last_cpu_nr - 1 : 1); + /* Fill file timestmap structure (rectime) */ + get_file_timestamp_struct(flags, &rectime, file_hdr); + strftime(cur_time, sizeof(cur_time), "%Y-%m-%d", &rectime); + printf(_("File date: %s\n"), cur_time); + if ((loc_t = gmtime((const time_t *) &file_hdr->sa_ust_time)) != NULL) { printf(_("File time: ")); strftime(cur_time, sizeof(cur_time), "%T", loc_t); -- 2.40.0