include the previous period in the measurements (since they're discrete, not rolling)

also include the other elements as necessary by default
This commit is contained in:
jrandom
2004-05-13 07:14:54 +00:00
committed by zzz
parent ad9dd9a2e2
commit 0d431213cd

View File

@ -29,7 +29,7 @@ public class SpeedCalculator extends Calculator {
public static final boolean DEFAULT_USE_INSTANTANEOUS_RATES = false; public static final boolean DEFAULT_USE_INSTANTANEOUS_RATES = false;
/** should the calculator use tunnel test time only, or include all data? */ /** 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 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) { public SpeedCalculator(RouterContext context) {
_context = context; _context = context;
@ -118,9 +118,9 @@ public class SpeedCalculator extends Calculator {
Rate tunnelResponseRate = profile.getTunnelCreateResponseTime().getRate(period); Rate tunnelResponseRate = profile.getTunnelCreateResponseTime().getRate(period);
Rate tunnelTestRate = profile.getTunnelTestResponseTime().getRate(period); Rate tunnelTestRate = profile.getTunnelTestResponseTime().getRate(period);
long dbResponses = tunnelTestOnly ? 0 : dbResponseRate.getCurrentEventCount(); long dbResponses = tunnelTestOnly ? 0 : dbResponseRate.getCurrentEventCount() + dbResponseRate.getLastEventCount();
long tunnelResponses = tunnelTestOnly ? 0 : tunnelResponseRate.getCurrentEventCount(); long tunnelResponses = tunnelTestOnly ? 0 : tunnelResponseRate.getCurrentEventCount() + tunnelResponseRate.getLastEventCount();
long tunnelTests = tunnelTestRate.getCurrentEventCount(); long tunnelTests = tunnelTestRate.getCurrentEventCount() + tunnelTestRate.getLastEventCount();
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("TunnelTests for period " + period + ": " + tunnelTests + _log.debug("TunnelTests for period " + period + ": " + tunnelTests +
" last: " + tunnelTestRate.getLastEventCount() + " lifetime: " + " last: " + tunnelTestRate.getLastEventCount() + " lifetime: " +
@ -161,9 +161,9 @@ public class SpeedCalculator extends Calculator {
Rate tunnelResponseRate = profile.getTunnelCreateResponseTime().getRate(period); Rate tunnelResponseRate = profile.getTunnelCreateResponseTime().getRate(period);
Rate tunnelTestRate = profile.getTunnelTestResponseTime().getRate(period); Rate tunnelTestRate = profile.getTunnelTestResponseTime().getRate(period);
long dbResponses = tunnelTestOnly ? 0 : dbResponseRate.getCurrentEventCount(); long dbResponses = tunnelTestOnly ? 0 : dbResponseRate.getCurrentEventCount() + dbResponseRate.getLastEventCount();
long tunnelResponses = tunnelTestOnly ? 0 : tunnelResponseRate.getCurrentEventCount(); long tunnelResponses = tunnelTestOnly ? 0 : tunnelResponseRate.getCurrentEventCount() + tunnelResponseRate.getLastEventCount();
long tunnelTests = tunnelTestRate.getCurrentEventCount(); long tunnelTests = tunnelTestRate.getCurrentEventCount() + tunnelTestRate.getLastEventCount();
double dbResponseTime = tunnelTestOnly ? 0 : dbResponseRate.getAverageValue(); double dbResponseTime = tunnelTestOnly ? 0 : dbResponseRate.getAverageValue();
double tunnelResponseTime = tunnelTestOnly ? 0 : tunnelResponseRate.getAverageValue(); double tunnelResponseTime = tunnelTestOnly ? 0 : tunnelResponseRate.getAverageValue();