Linux NFS development
 help / color / mirror / Atom feed
* [PATCH] mountstats: Adding Day:Hour:Min:Sec format along with age to "mountstats --raw" for ease of understanding.
@ 2020-06-02  9:29 Rohan Sable
  2020-06-03 14:57 ` Scott Mayhew
  0 siblings, 1 reply; 2+ messages in thread
From: Rohan Sable @ 2020-06-02  9:29 UTC (permalink / raw)
  To: linux-nfs; +Cc: rsable, steved

The output will look something like this :

From :
age:    2215

To   :
age:    2267; 0 Day(s) 0 Hour(s) 37 Min(s) 47 Sec(s)

Signed-off-by: Rohan Sable <rsable@redhat.com>
---
 tools/mountstats/mountstats.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py
index 6ac83ccb..d9b5af1b 100755
--- a/tools/mountstats/mountstats.py
+++ b/tools/mountstats/mountstats.py
@@ -228,6 +228,15 @@ Nfsv4ops = [
     'CLONE'
 ]
 
+def sec_conv(rem):
+    day = int(rem / (24 * 3600))
+    rem %= (24 * 3600)
+    hrs = int(rem / 3600)
+    rem %= 3600
+    min = int(rem / 60)
+    sec = rem % 60
+    print(day, "Day(s)", hrs, "Hour(s)", min, "Min(s)", sec, "Sec(s)")
+
 class DeviceData:
     """DeviceData objects provide methods for parsing and displaying
     data for a single mount grabbed from /proc/self/mountstats
@@ -349,7 +358,8 @@ class DeviceData:
             (self.__nfs_data['export'], self.__nfs_data['mountpoint'], \
             self.__nfs_data['fstype'], self.__nfs_data['statvers']))
         print('\topts:\t%s' % ','.join(self.__nfs_data['mountoptions']))
-        print('\tage:\t%d' % self.__nfs_data['age'])
+        print('\tage:\t%d' % self.__nfs_data['age'], end="; ")
+        sec_conv(self.__nfs_data['age'])
         print('\tcaps:\t%s' % ','.join(self.__nfs_data['servercapabilities']))
         print('\tsec:\tflavor=%d,pseudoflavor=%d' % (self.__nfs_data['flavor'], \
             self.__nfs_data['pseudoflavor']))
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-03 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-02  9:29 [PATCH] mountstats: Adding Day:Hour:Min:Sec format along with age to "mountstats --raw" for ease of understanding Rohan Sable
2020-06-03 14:57 ` Scott Mayhew

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox