Whamcloud - gitweb
LU-17005 obdclass: only print seconds for job_stats
authorAndreas Dilger <adilger@whamcloud.com>
Fri, 1 Sep 2023 00:08:30 +0000 (18:08 -0600)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 1 Sep 2023 13:15:32 +0000 (13:15 +0000)
Only print the seconds field for the job_stats snapshot_time: field.
Otherwise the addition of the usec and "secs.usec" units field can
break the output parsing.

There is no way to print only the seconds in lprocfs_stats_header(),
since all of the other snapshot_time: fields previously printed the
microseconds field also, so use seq_printf() with the old format.

Test-Parameters: trivial
Fixes: 5efb892396e3 ("LU-11407 obdclass: add start time to stats files")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I1bda709e3bc4231d42f6a98e7487f0b11445f056
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52212
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Feng Lei <flei@whamcloud.com>
Reviewed-by: Nathaniel Clark <nclark@whamcloud.com>
lustre/obdclass/lprocfs_jobstats.c

index 3c078fd..8ca2e80 100644 (file)
@@ -517,8 +517,19 @@ static int lprocfs_jobstats_seq_show(struct seq_file *p, void *v)
 
        seq_printf(p, "- %-16s %s%*s%s\n",
                   "job_id:", quote, joblen, escaped, quote);
-       lprocfs_stats_header(p, job->js_time_latest, job->js_stats->ls_init,
-                            16, ":", true, "  ");
+       if (obd_enable_stats_header) {
+               lprocfs_stats_header(p, job->js_time_latest,
+                                    job->js_stats->ls_init,
+                                    16, ":", true, "  ");
+       } else {
+               struct timespec64 ts = ktime_to_timespec64(job->js_time_latest);
+
+               /* print directly for compat, no way to skip msecs field */
+               seq_printf(p, "  %-16s %lld\n", "snapshot_time:",
+                          (long long)ts.tv_sec);
+       }
+
+
 
        s = job->js_stats;
        for (i = 0; i < s->ls_num; i++) {