linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] nfs-iostat: Fix columnarization of RPC statistics
@ 2014-04-25 16:52 Chuck Lever
  2014-04-25 16:52 ` [PATCH 2/2] nfs-iostat: Fix attribute cache statistics Chuck Lever
  2014-04-30 16:30 ` [PATCH 1/2] nfs-iostat: Fix columnarization of RPC statistics Steve Dickson
  0 siblings, 2 replies; 4+ messages in thread
From: Chuck Lever @ 2014-04-25 16:52 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

Note: format() is new with Python 2.6

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 tools/nfs-iostat/nfs-iostat.py |   31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py
index 341cdbf..6831c12 100644
--- a/tools/nfs-iostat/nfs-iostat.py
+++ b/tools/nfs-iostat/nfs-iostat.py
@@ -353,15 +353,21 @@ class DeviceData:
             exe_per_op = 0.0
 
         op += ':'
-        print('%s' % op.lower().ljust(15), end='')
-        print('  ops/s\t\t   kB/s\t\t  kB/op\t\tretrans\t\tavg RTT (ms)\tavg exe (ms)')
-
-        print('\t\t%7.3f' % (ops / sample_time), end='')
-        print('\t%7.3f' % (kilobytes / sample_time), end='')
-        print('\t%7.3f' % kb_per_op, end='')
-        print(' %7d (%3.1f%%)' % (retrans, retrans_percent), end='')
-        print('\t%7.3f' % rtt_per_op, end='')
-        print('\t%7.3f' % exe_per_op)
+        print(format(op.lower(), '<16s'), end='')
+        print(format('ops/s', '>8s'), end='')
+        print(format('kB/s', '>16s'), end='')
+        print(format('kB/op', '>16s'), end='')
+        print(format('retrans', '>16s'), end='')
+        print(format('avg RTT (ms)', '>16s'), end='')
+        print(format('avg exe (ms)', '>16s'))
+
+        print(format((ops / sample_time), '>24.3f'), end='')
+        print(format((kilobytes / sample_time), '>16.3f'), end='')
+        print(format(kb_per_op, '>16.3f'), end='')
+        retransmits = '{0:>10.0f} ({1:>3.1f}%)'.format(retrans, retrans_percent).strip()
+        print(format(retransmits, '>16'), end='')
+        print(format(rtt_per_op, '>16.3f'), end='')
+        print(format(exe_per_op, '>16.3f'))
 
     def ops(self, sample_time):
         sends = float(self.__rpc_data['rpcsends'])
@@ -391,9 +397,10 @@ class DeviceData:
             (self.__nfs_data['export'], self.__nfs_data['mountpoint']))
         print()
 
-        print('   op/s\t\trpc bklog')
-        print('%7.2f' % (sends / sample_time), end='')
-        print('\t%7.2f' % backlog)
+        print(format('ops/s', '>16') + format('rpc bklog', '>16'))
+        print(format((sends / sample_time), '>16.3f'), end='')
+        print(format(backlog, '>16.3f'))
+        print()
 
         if which == 0:
             self.__print_rpc_op_stats('READ', sample_time)


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

* [PATCH 2/2] nfs-iostat: Fix attribute cache statistics
  2014-04-25 16:52 [PATCH 1/2] nfs-iostat: Fix columnarization of RPC statistics Chuck Lever
@ 2014-04-25 16:52 ` Chuck Lever
  2014-04-30 16:31   ` Steve Dickson
  2014-04-30 16:30 ` [PATCH 1/2] nfs-iostat: Fix columnarization of RPC statistics Steve Dickson
  1 sibling, 1 reply; 4+ messages in thread
From: Chuck Lever @ 2014-04-25 16:52 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

"nfs-iostat.py --attr" was displaying nonsense (like negative
counts and percentages).

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 tools/nfs-iostat/nfs-iostat.py |   28 ++++++++--------------------
 1 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py
index 6831c12..b324cd8 100644
--- a/tools/nfs-iostat/nfs-iostat.py
+++ b/tools/nfs-iostat/nfs-iostat.py
@@ -243,27 +243,15 @@ class DeviceData:
         """Print attribute cache efficiency stats
         """
         nfs_stats = self.__nfs_data
-        getattr_stats = self.__rpc_data['GETATTR']
-
-        if nfs_stats['inoderevalidates'] != 0:
-            getattr_ops = float(getattr_stats[1])
-            opens = float(nfs_stats['vfsopen'])
-            revalidates = float(nfs_stats['inoderevalidates']) - opens
-            if revalidates != 0:
-                ratio = ((revalidates - getattr_ops) * 100) / revalidates
-            else:
-                ratio = 0.0
-
-            data_invalidates = float(nfs_stats['datainvalidates'])
-            attr_invalidates = float(nfs_stats['attrinvalidates'])
 
-            print()
-            print('%d inode revalidations, hitting in cache %4.2f%% of the time' % \
-                (revalidates, ratio))
-            print('%d open operations (mandatory GETATTR requests)' % opens)
-            if getattr_ops != 0:
-                print('%4.2f%% of GETATTRs resulted in data cache invalidations' % \
-                   ((data_invalidates * 100) / getattr_ops))
+        print()
+        print('%d VFS opens' % (nfs_stats['vfsopen']))
+        print('%d inoderevalidates (forced GETATTRs)' % \
+            (nfs_stats['inoderevalidates']))
+        print('%d page cache invalidations' % \
+            (nfs_stats['datainvalidates']))
+        print('%d attribute cache invalidations' % \
+            (nfs_stats['attrinvalidates']))
 
     def __print_dir_cache_stats(self, sample_time):
         """Print directory stats


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

* Re: [PATCH 1/2] nfs-iostat: Fix columnarization of RPC statistics
  2014-04-25 16:52 [PATCH 1/2] nfs-iostat: Fix columnarization of RPC statistics Chuck Lever
  2014-04-25 16:52 ` [PATCH 2/2] nfs-iostat: Fix attribute cache statistics Chuck Lever
@ 2014-04-30 16:30 ` Steve Dickson
  1 sibling, 0 replies; 4+ messages in thread
From: Steve Dickson @ 2014-04-30 16:30 UTC (permalink / raw)
  To: Chuck Lever; +Cc: linux-nfs



On 04/25/2014 12:52 PM, Chuck Lever wrote:
> Note: format() is new with Python 2.6
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Committed...

steved.
> ---
> 
>  tools/nfs-iostat/nfs-iostat.py |   31 +++++++++++++++++++------------
>  1 files changed, 19 insertions(+), 12 deletions(-)
> 
> diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py
> index 341cdbf..6831c12 100644
> --- a/tools/nfs-iostat/nfs-iostat.py
> +++ b/tools/nfs-iostat/nfs-iostat.py
> @@ -353,15 +353,21 @@ class DeviceData:
>              exe_per_op = 0.0
>  
>          op += ':'
> -        print('%s' % op.lower().ljust(15), end='')
> -        print('  ops/s\t\t   kB/s\t\t  kB/op\t\tretrans\t\tavg RTT (ms)\tavg exe (ms)')
> -
> -        print('\t\t%7.3f' % (ops / sample_time), end='')
> -        print('\t%7.3f' % (kilobytes / sample_time), end='')
> -        print('\t%7.3f' % kb_per_op, end='')
> -        print(' %7d (%3.1f%%)' % (retrans, retrans_percent), end='')
> -        print('\t%7.3f' % rtt_per_op, end='')
> -        print('\t%7.3f' % exe_per_op)
> +        print(format(op.lower(), '<16s'), end='')
> +        print(format('ops/s', '>8s'), end='')
> +        print(format('kB/s', '>16s'), end='')
> +        print(format('kB/op', '>16s'), end='')
> +        print(format('retrans', '>16s'), end='')
> +        print(format('avg RTT (ms)', '>16s'), end='')
> +        print(format('avg exe (ms)', '>16s'))
> +
> +        print(format((ops / sample_time), '>24.3f'), end='')
> +        print(format((kilobytes / sample_time), '>16.3f'), end='')
> +        print(format(kb_per_op, '>16.3f'), end='')
> +        retransmits = '{0:>10.0f} ({1:>3.1f}%)'.format(retrans, retrans_percent).strip()
> +        print(format(retransmits, '>16'), end='')
> +        print(format(rtt_per_op, '>16.3f'), end='')
> +        print(format(exe_per_op, '>16.3f'))
>  
>      def ops(self, sample_time):
>          sends = float(self.__rpc_data['rpcsends'])
> @@ -391,9 +397,10 @@ class DeviceData:
>              (self.__nfs_data['export'], self.__nfs_data['mountpoint']))
>          print()
>  
> -        print('   op/s\t\trpc bklog')
> -        print('%7.2f' % (sends / sample_time), end='')
> -        print('\t%7.2f' % backlog)
> +        print(format('ops/s', '>16') + format('rpc bklog', '>16'))
> +        print(format((sends / sample_time), '>16.3f'), end='')
> +        print(format(backlog, '>16.3f'))
> +        print()
>  
>          if which == 0:
>              self.__print_rpc_op_stats('READ', sample_time)
> 

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

* Re: [PATCH 2/2] nfs-iostat: Fix attribute cache statistics
  2014-04-25 16:52 ` [PATCH 2/2] nfs-iostat: Fix attribute cache statistics Chuck Lever
@ 2014-04-30 16:31   ` Steve Dickson
  0 siblings, 0 replies; 4+ messages in thread
From: Steve Dickson @ 2014-04-30 16:31 UTC (permalink / raw)
  To: Chuck Lever; +Cc: linux-nfs



On 04/25/2014 12:52 PM, Chuck Lever wrote:
> "nfs-iostat.py --attr" was displaying nonsense (like negative
> counts and percentages).
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Committed... 

steved.
> ---
> 
>  tools/nfs-iostat/nfs-iostat.py |   28 ++++++++--------------------
>  1 files changed, 8 insertions(+), 20 deletions(-)
> 
> diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py
> index 6831c12..b324cd8 100644
> --- a/tools/nfs-iostat/nfs-iostat.py
> +++ b/tools/nfs-iostat/nfs-iostat.py
> @@ -243,27 +243,15 @@ class DeviceData:
>          """Print attribute cache efficiency stats
>          """
>          nfs_stats = self.__nfs_data
> -        getattr_stats = self.__rpc_data['GETATTR']
> -
> -        if nfs_stats['inoderevalidates'] != 0:
> -            getattr_ops = float(getattr_stats[1])
> -            opens = float(nfs_stats['vfsopen'])
> -            revalidates = float(nfs_stats['inoderevalidates']) - opens
> -            if revalidates != 0:
> -                ratio = ((revalidates - getattr_ops) * 100) / revalidates
> -            else:
> -                ratio = 0.0
> -
> -            data_invalidates = float(nfs_stats['datainvalidates'])
> -            attr_invalidates = float(nfs_stats['attrinvalidates'])
>  
> -            print()
> -            print('%d inode revalidations, hitting in cache %4.2f%% of the time' % \
> -                (revalidates, ratio))
> -            print('%d open operations (mandatory GETATTR requests)' % opens)
> -            if getattr_ops != 0:
> -                print('%4.2f%% of GETATTRs resulted in data cache invalidations' % \
> -                   ((data_invalidates * 100) / getattr_ops))
> +        print()
> +        print('%d VFS opens' % (nfs_stats['vfsopen']))
> +        print('%d inoderevalidates (forced GETATTRs)' % \
> +            (nfs_stats['inoderevalidates']))
> +        print('%d page cache invalidations' % \
> +            (nfs_stats['datainvalidates']))
> +        print('%d attribute cache invalidations' % \
> +            (nfs_stats['attrinvalidates']))
>  
>      def __print_dir_cache_stats(self, sample_time):
>          """Print directory stats
> 

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

end of thread, other threads:[~2014-04-30 16:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-25 16:52 [PATCH 1/2] nfs-iostat: Fix columnarization of RPC statistics Chuck Lever
2014-04-25 16:52 ` [PATCH 2/2] nfs-iostat: Fix attribute cache statistics Chuck Lever
2014-04-30 16:31   ` Steve Dickson
2014-04-30 16:30 ` [PATCH 1/2] nfs-iostat: Fix columnarization of RPC statistics Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).