linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: Kevin Constantine
	<Kevin.Constantine-FfNkGbSheRGpB8w63BLUukEOCMrvLtNR@public.gmane.org>
Cc: chuck.lever@oracle.com, linux-nfs@vger.kernel.org,
	Kevin Constantine
	<Kevin.Constantine-P5ys19MLBK/QT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH 1/1] nfs-iostat.py: divide by zero with fresh mount
Date: Tue, 22 Jun 2010 17:52:09 -0400	[thread overview]
Message-ID: <4C213089.5090008@RedHat.com> (raw)
In-Reply-To: <1275950427-10200-1-git-send-email-kevin.constantine-FfNkGbSheRGpB8w63BLUukEOCMrvLtNR@public.gmane.org>



On 06/07/2010 06:40 PM, Kevin Constantine wrote:
> When an export is freshly mounted, /proc/self/mountstats displays age = 0.
> This causes nfs-iostat.py to divide by zero throwing an error.  When we
> have age = 0, other stats are greater than 0, so we'll set age = 1 and
> print the relevant stats.
> 
> Signed-off-by: Kevin Constantine <kevin.constantine-FfNkGbSheRGpB8w63BLUukEOCMrvLtNR@public.gmane.org>
> ---
>  tools/nfs-iostat/nfs-iostat.py |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py
> index 2d0b143..1207674 100644
> --- a/tools/nfs-iostat/nfs-iostat.py
> +++ b/tools/nfs-iostat/nfs-iostat.py
> @@ -366,6 +366,12 @@ class DeviceData:
>          sends = float(self.__rpc_data['rpcsends'])
>          if sample_time == 0:
>              sample_time = float(self.__nfs_data['age'])
> +        #  sample_time could still be zero if the export was just mounted.
> +        #  Set it to 1 to avoid divide by zero errors in this case since we'll
> +        #  likely still have relevant mount statistics to show.
> +        #
> +        if sample_time == 0:
> +            sample_time = 1;
>          if sends != 0:
>              backlog = (float(self.__rpc_data['backlogutil']) / sends) / sample_time
>          else:
Committed.. 

steved.

      parent reply	other threads:[~2010-06-22 21:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-27 23:58 [PATCH 1/1] nfs-iostat.py: Fixes several Divide by Zero errors Kevin Constantine
     [not found] ` <1275004718-1802-1-git-send-email-kevin.constantine-FfNkGbSheRGpB8w63BLUukEOCMrvLtNR@public.gmane.org>
2010-05-28  0:22   ` Chuck Lever
2010-05-28  0:50     ` Kevin Constantine
2010-05-28 17:00       ` Chuck Lever
2010-05-28 22:51         ` Kevin Constantine
2010-06-01 15:37           ` Chuck Lever
2010-06-02 17:13             ` Kevin Constantine
2010-06-07 22:40               ` [PATCH 1/1] nfs-iostat.py: divide by zero with fresh mount Kevin Constantine
     [not found]                 ` <1275950427-10200-1-git-send-email-kevin.constantine-FfNkGbSheRGpB8w63BLUukEOCMrvLtNR@public.gmane.org>
2010-06-07 23:12                   ` Chuck Lever
2010-06-22 21:52                   ` Steve Dickson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C213089.5090008@RedHat.com \
    --to=steved@redhat.com \
    --cc=Kevin.Constantine-FfNkGbSheRGpB8w63BLUukEOCMrvLtNR@public.gmane.org \
    --cc=Kevin.Constantine-P5ys19MLBK/QT0dZR+AlfA@public.gmane.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).