]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - tools/nfs-iostat/nfs-iostat.py
pdate addres for Free Software Foundation
[nfs-utils.git] / tools / nfs-iostat / nfs-iostat.py
index 2d0b1433b948ef4884a987f3bd556376294f413c..4e55dad8e6568232ee98af703ddecf596f019ac3 100644 (file)
@@ -17,7 +17,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+MA 02110-1301 USA
 """
 
 import sys, os, time
@@ -366,6 +367,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: