[PATCH] mountstats: Adding Day:Hour:Min:Sec format along with age to "mountstats --raw" for ease of understanding.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux