Whamcloud - gitweb
LU-9019 obd: remove s2dhms time function 69/23269/4
authorJames Simmons <uja.ornl@yahoo.com>
Thu, 30 Mar 2017 17:49:13 +0000 (13:49 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 19 Apr 2017 04:43:32 +0000 (04:43 +0000)
Lustre created the s2dhms function to report a time
lapse in a days:hour:minute:seconds format. This is
over kill so remove s2dhms and just report the number
of seconds that has lapse.

Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Change-Id: I834661e57bf14c5ae397a40784bdec69b9bd55a8
Reviewed-on: https://review.whamcloud.com/23269
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/lprocfs_status.h
lustre/obdclass/lprocfs_status.c
lustre/ptlrpc/lproc_ptlrpc.c

index 763b9be..4f78d6f 100644 (file)
@@ -363,22 +363,6 @@ extern struct kobject *lustre_kobj;
 struct obd_device;
 struct obd_histogram;
 
-/* Days / hours / mins / seconds format */
-struct dhms {
-        int d,h,m,s;
-};
-static inline void s2dhms(struct dhms *ts, time_t secs)
-{
-        ts->d = secs / 86400;
-        secs = secs % 86400;
-        ts->h = secs / 3600;
-        secs = secs % 3600;
-        ts->m = secs / 60;
-        ts->s = secs % 60;
-}
-#define DHMS_FMT "%dd%dh%02dm%02ds"
-#define DHMS_VARS(x) (x)->d, (x)->h, (x)->m, (x)->s
-
 #define JOBSTATS_JOBID_VAR_MAX_LEN     20
 #define JOBSTATS_DISABLE               "disable"
 #define JOBSTATS_PROCNAME_UID          "procname_uid"
index 6d0ed9f..7896dc5 100644 (file)
@@ -1140,7 +1140,6 @@ int lprocfs_timeouts_seq_show(struct seq_file *m, void *data)
        struct obd_import *imp;
        unsigned int cur, worst;
        time64_t now, worstt;
-       struct dhms ts;
        int i;
 
        LASSERT(obd != NULL);
@@ -1150,16 +1149,15 @@ int lprocfs_timeouts_seq_show(struct seq_file *m, void *data)
        now = ktime_get_real_seconds();
 
        /* Some network health info for kicks */
-       s2dhms(&ts, now - imp->imp_last_reply_time);
-       seq_printf(m, "%-10s : %lld, "DHMS_FMT" ago\n",
-                  "last reply", (s64)imp->imp_last_reply_time, DHMS_VARS(&ts));
+       seq_printf(m, "%-10s : %lld, %llds ago\n",
+                  "last reply", (s64)imp->imp_last_reply_time,
+                  (s64)(now - imp->imp_last_reply_time));
 
        cur = at_get(&imp->imp_at.iat_net_latency);
        worst = imp->imp_at.iat_net_latency.at_worst_ever;
        worstt = imp->imp_at.iat_net_latency.at_worst_time;
-       s2dhms(&ts, now - worstt);
-       seq_printf(m, "%-10s : cur %3u  worst %3u (at %lld, "DHMS_FMT" ago) ",
-                  "network", cur, worst, (s64)worstt, DHMS_VARS(&ts));
+       seq_printf(m, "%-10s : cur %3u  worst %3u (at %lld, %llds ago) ",
+                  "network", cur, worst, (s64)worstt, (s64)(now - worstt));
        lprocfs_at_hist_helper(m, &imp->imp_at.iat_net_latency);
 
        for(i = 0; i < IMP_AT_MAX_PORTALS; i++) {
@@ -1168,10 +1166,9 @@ int lprocfs_timeouts_seq_show(struct seq_file *m, void *data)
                cur = at_get(&imp->imp_at.iat_service_estimate[i]);
                worst = imp->imp_at.iat_service_estimate[i].at_worst_ever;
                worstt = imp->imp_at.iat_service_estimate[i].at_worst_time;
-               s2dhms(&ts, now - worstt);
-               seq_printf(m, "portal %-2d  : cur %3u  worst %3u (at %lld, "
-                          DHMS_FMT" ago) ", imp->imp_at.iat_portal[i],
-                          cur, worst, (s64)worstt, DHMS_VARS(&ts));
+               seq_printf(m, "portal %-2d  : cur %3u  worst %3u (at %lld, %llds ago) ",
+                          imp->imp_at.iat_portal[i], cur, worst, (s64)worstt,
+                          (s64)(now - worstt));
                lprocfs_at_hist_helper(m, &imp->imp_at.iat_service_estimate[i]);
        }
 
index 897f5ea..f10dc6c 100644 (file)
@@ -1042,7 +1042,6 @@ static int ptlrpc_lprocfs_timeouts_seq_show(struct seq_file *m, void *n)
 {
        struct ptlrpc_service           *svc = m->private;
        struct ptlrpc_service_part      *svcpt;
-       struct dhms                     ts;
        time64_t worstt;
        unsigned int                    cur;
        unsigned int                    worst;
@@ -1058,11 +1057,10 @@ static int ptlrpc_lprocfs_timeouts_seq_show(struct seq_file *m, void *n)
                cur     = at_get(&svcpt->scp_at_estimate);
                worst   = svcpt->scp_at_estimate.at_worst_ever;
                worstt  = svcpt->scp_at_estimate.at_worst_time;
-               s2dhms(&ts, ktime_get_real_seconds() - worstt);
 
-               seq_printf(m, "%10s : cur %3u  worst %3u (at %lld, "
-                          DHMS_FMT" ago) ", "service",
-                          cur, worst, (s64)worstt, DHMS_VARS(&ts));
+               seq_printf(m, "%10s : cur %3u  worst %3u (at %lld, %llds ago) ",
+                          "service", cur, worst, (s64)worstt,
+                          (s64)(ktime_get_real_seconds() - worstt));
 
                lprocfs_at_hist_helper(m, &svcpt->scp_at_estimate);
        }