From 0d431213cdc141bc8112a144a843d95b179b3b16 Mon Sep 17 00:00:00 2001 From: jrandom Date: Thu, 13 May 2004 07:14:54 +0000 Subject: [PATCH] include the previous period in the measurements (since they're discrete, not rolling) also include the other elements as necessary by default --- .../i2p/router/peermanager/SpeedCalculator.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/router/java/src/net/i2p/router/peermanager/SpeedCalculator.java b/router/java/src/net/i2p/router/peermanager/SpeedCalculator.java index e2f65bfea..52015b444 100644 --- a/router/java/src/net/i2p/router/peermanager/SpeedCalculator.java +++ b/router/java/src/net/i2p/router/peermanager/SpeedCalculator.java @@ -29,7 +29,7 @@ public class SpeedCalculator extends Calculator { public static final boolean DEFAULT_USE_INSTANTANEOUS_RATES = false; /** should the calculator use tunnel test time only, or include all data? */ public static final String PROP_USE_TUNNEL_TEST_ONLY = "speedCalculator.useTunnelTestOnly"; - public static final boolean DEFAULT_USE_TUNNEL_TEST_ONLY = true; + public static final boolean DEFAULT_USE_TUNNEL_TEST_ONLY = false; public SpeedCalculator(RouterContext context) { _context = context; @@ -118,9 +118,9 @@ public class SpeedCalculator extends Calculator { Rate tunnelResponseRate = profile.getTunnelCreateResponseTime().getRate(period); Rate tunnelTestRate = profile.getTunnelTestResponseTime().getRate(period); - long dbResponses = tunnelTestOnly ? 0 : dbResponseRate.getCurrentEventCount(); - long tunnelResponses = tunnelTestOnly ? 0 : tunnelResponseRate.getCurrentEventCount(); - long tunnelTests = tunnelTestRate.getCurrentEventCount(); + long dbResponses = tunnelTestOnly ? 0 : dbResponseRate.getCurrentEventCount() + dbResponseRate.getLastEventCount(); + long tunnelResponses = tunnelTestOnly ? 0 : tunnelResponseRate.getCurrentEventCount() + tunnelResponseRate.getLastEventCount(); + long tunnelTests = tunnelTestRate.getCurrentEventCount() + tunnelTestRate.getLastEventCount(); if (_log.shouldLog(Log.DEBUG)) _log.debug("TunnelTests for period " + period + ": " + tunnelTests + " last: " + tunnelTestRate.getLastEventCount() + " lifetime: " + @@ -161,9 +161,9 @@ public class SpeedCalculator extends Calculator { Rate tunnelResponseRate = profile.getTunnelCreateResponseTime().getRate(period); Rate tunnelTestRate = profile.getTunnelTestResponseTime().getRate(period); - long dbResponses = tunnelTestOnly ? 0 : dbResponseRate.getCurrentEventCount(); - long tunnelResponses = tunnelTestOnly ? 0 : tunnelResponseRate.getCurrentEventCount(); - long tunnelTests = tunnelTestRate.getCurrentEventCount(); + long dbResponses = tunnelTestOnly ? 0 : dbResponseRate.getCurrentEventCount() + dbResponseRate.getLastEventCount(); + long tunnelResponses = tunnelTestOnly ? 0 : tunnelResponseRate.getCurrentEventCount() + tunnelResponseRate.getLastEventCount(); + long tunnelTests = tunnelTestRate.getCurrentEventCount() + tunnelTestRate.getLastEventCount(); double dbResponseTime = tunnelTestOnly ? 0 : dbResponseRate.getAverageValue(); double tunnelResponseTime = tunnelTestOnly ? 0 : tunnelResponseRate.getAverageValue();