From 2acedb91a4f802c6145f4f9c64e0fca865c85418 Mon Sep 17 00:00:00 2001 From: Mike Thomas Date: Fri, 4 Sep 2009 22:42:27 +0000 Subject: [PATCH] Better protection against divide-by-zero - if we have less than a second, we'll just round up to 1 second. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5938 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/presents/server/ReportingInvoker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java/com/threerings/presents/server/ReportingInvoker.java b/src/java/com/threerings/presents/server/ReportingInvoker.java index bdaa7f718..9b1768f22 100644 --- a/src/java/com/threerings/presents/server/ReportingInvoker.java +++ b/src/java/com/threerings/presents/server/ReportingInvoker.java @@ -111,7 +111,7 @@ public class ReportingInvoker extends Invoker Stats stats = getStats(reset); buf.append("- Max queue size: ").append(stats.maxQueueSize).append("\n"); buf.append("- Units executed: ").append(stats.unitsRun); - long runPerSec = (sinceLast == 0) ? 0 : stats.unitsRun/(sinceLast/1000); + long runPerSec = stats.unitsRun/Math.max(1, sinceLast/1000); buf.append(" (").append(runPerSec).append("/s)\n"); if (_currentUnit != null) { String uname = StringUtil.safeToString(_currentUnit);