comment out some stats

This commit is contained in:
zzz
2011-12-05 16:17:29 +00:00
parent 4c2c198c0a
commit 5362e7cf15

View File

@ -35,9 +35,12 @@ import net.i2p.util.Log;
public class TunnelDispatcher implements Service { public class TunnelDispatcher implements Service {
private final RouterContext _context; private final RouterContext _context;
private final Log _log; private final Log _log;
/** us */
private final Map<TunnelId, TunnelGateway> _outboundGateways; private final Map<TunnelId, TunnelGateway> _outboundGateways;
private final Map<TunnelId, OutboundTunnelEndpoint> _outboundEndpoints; private final Map<TunnelId, OutboundTunnelEndpoint> _outboundEndpoints;
/** regular participant or IBEP of our own tunnel */
private final Map<TunnelId, TunnelParticipant> _participants; private final Map<TunnelId, TunnelParticipant> _participants;
/** regular IBGW or our own zero-hop inbound */
private final Map<TunnelId, TunnelGateway> _inboundGateways; private final Map<TunnelId, TunnelGateway> _inboundGateways;
private final Map<TunnelId, HopConfig> _participatingConfig; private final Map<TunnelId, HopConfig> _participatingConfig;
/** what is the date/time on which the last non-locally-created tunnel expires? */ /** what is the date/time on which the last non-locally-created tunnel expires? */
@ -103,18 +106,18 @@ public class TunnelDispatcher implements Service {
ctx.statManager().createRateStat("tunnel.joinInboundGateway", ctx.statManager().createRateStat("tunnel.joinInboundGateway",
"How many tunnels we join as the inbound gateway?", "Tunnels", "How many tunnels we join as the inbound gateway?", "Tunnels",
new long[] { 10*60*1000l, 60*60*1000l }); new long[] { 10*60*1000l, 60*60*1000l });
ctx.statManager().createRateStat("tunnel.dispatchGatewayTime", //ctx.statManager().createRateStat("tunnel.dispatchGatewayTime",
"How long it takes to dispatch a TunnelGatewayMessage", "Tunnels", // "How long it takes to dispatch a TunnelGatewayMessage", "Tunnels",
new long[] { 60*1000l, 60*60*1000l }); // new long[] { 60*1000l, 60*60*1000l });
ctx.statManager().createRateStat("tunnel.dispatchDataTime", //ctx.statManager().createRateStat("tunnel.dispatchDataTime",
"How long it takes to dispatch a TunnelDataMessage", "Tunnels", // "How long it takes to dispatch a TunnelDataMessage", "Tunnels",
new long[] { 60*1000l, 60*60*1000l }); // new long[] { 60*1000l, 60*60*1000l });
ctx.statManager().createRateStat("tunnel.dispatchOutboundTime", //ctx.statManager().createRateStat("tunnel.dispatchOutboundTime",
"How long it takes to dispatch an outbound message", "Tunnels", // "How long it takes to dispatch an outbound message", "Tunnels",
new long[] { 60*1000l, 60*60*1000l }); // new long[] { 60*1000l, 60*60*1000l });
ctx.statManager().createRateStat("tunnel.dispatchOutboundZeroHopTime", //ctx.statManager().createRateStat("tunnel.dispatchOutboundZeroHopTime",
"How long it takes to dispatch an outbound message through a zero hop tunnel", "Tunnels", // "How long it takes to dispatch an outbound message through a zero hop tunnel", "Tunnels",
new long[] { 60*60*1000l }); // new long[] { 60*60*1000l });
ctx.statManager().createRequiredRateStat("tunnel.participatingBandwidth", ctx.statManager().createRequiredRateStat("tunnel.participatingBandwidth",
"Participating traffic received (Bytes/sec)", "Tunnels", "Participating traffic received (Bytes/sec)", "Tunnels",
new long[] { 60*1000l, 60*10*1000l }); new long[] { 60*1000l, 60*10*1000l });
@ -386,7 +389,7 @@ public class TunnelDispatcher implements Service {
* *
*/ */
public void dispatch(TunnelDataMessage msg, Hash recvFrom) { public void dispatch(TunnelDataMessage msg, Hash recvFrom) {
long before = System.currentTimeMillis(); //long before = System.currentTimeMillis();
TunnelParticipant participant = _participants.get(msg.getTunnelIdObj()); TunnelParticipant participant = _participants.get(msg.getTunnelIdObj());
if (participant != null) { if (participant != null) {
// we are either just a random participant or the inbound endpoint // we are either just a random participant or the inbound endpoint
@ -408,6 +411,7 @@ public class TunnelDispatcher implements Service {
_context.statManager().addRateData("tunnel.dispatchEndpoint", 1); _context.statManager().addRateData("tunnel.dispatchEndpoint", 1);
} else { } else {
// Somewhat common, probably due to somebody with large clock skew?
_context.messageHistory().droppedTunnelDataMessageUnknown(msg.getUniqueId(), msg.getTunnelId()); _context.messageHistory().droppedTunnelDataMessageUnknown(msg.getUniqueId(), msg.getTunnelId());
int level = (_context.router().getUptime() > 10*60*1000 ? Log.WARN : Log.DEBUG); int level = (_context.router().getUptime() > 10*60*1000 ? Log.WARN : Log.DEBUG);
if (_log.shouldLog(level)) if (_log.shouldLog(level))
@ -417,10 +421,10 @@ public class TunnelDispatcher implements Service {
} }
} }
long dispatchTime = System.currentTimeMillis() - before; //long dispatchTime = System.currentTimeMillis() - before;
if (_log.shouldLog(Log.DEBUG)) //if (_log.shouldLog(Log.DEBUG))
_log.debug("Dispatch data time: " + dispatchTime + " participant? " + participant); // _log.debug("Dispatch data time: " + dispatchTime + " participant? " + participant);
_context.statManager().addRateData("tunnel.dispatchDataTime", dispatchTime, dispatchTime); //_context.statManager().addRateData("tunnel.dispatchDataTime", dispatchTime, dispatchTime);
} }
/** High for now, just to prevent long-lived-message attacks */ /** High for now, just to prevent long-lived-message attacks */
@ -469,11 +473,11 @@ public class TunnelDispatcher implements Service {
+ " existing = " + _inboundGateways.size(), new Exception("source")); + " existing = " + _inboundGateways.size(), new Exception("source"));
} }
long dispatchTime = _context.clock().now() - before; //long dispatchTime = _context.clock().now() - before;
if (_log.shouldLog(Log.DEBUG)) //if (_log.shouldLog(Log.DEBUG))
_log.debug("Dispatch in gw time: " + dispatchTime + " gateway? " + gw); // _log.debug("Dispatch in gw time: " + dispatchTime + " gateway? " + gw);
_context.statManager().addRateData("tunnel.dispatchGatewayTime", dispatchTime, dispatchTime); //_context.statManager().addRateData("tunnel.dispatchGatewayTime", dispatchTime, dispatchTime);
} }
/** /**
@ -544,15 +548,15 @@ public class TunnelDispatcher implements Service {
+ ": existing = " + _outboundGateways.size(), new Exception("src")); + ": existing = " + _outboundGateways.size(), new Exception("src"));
} }
long dispatchTime = _context.clock().now() - before; //long dispatchTime = _context.clock().now() - before;
if (dispatchTime > 1000) { //if (dispatchTime > 1000) {
if (_log.shouldLog(Log.WARN)) // if (_log.shouldLog(Log.WARN))
_log.warn("wtf, took " + dispatchTime + " to dispatch " + msg + " out " + outboundTunnel + " in " + gw); // _log.warn("wtf, took " + dispatchTime + " to dispatch " + msg + " out " + outboundTunnel + " in " + gw);
} //}
if (gw instanceof TunnelGatewayZeroHop) //if (gw instanceof TunnelGatewayZeroHop)
_context.statManager().addRateData("tunnel.dispatchOutboundZeroHopTime", dispatchTime, dispatchTime); // _context.statManager().addRateData("tunnel.dispatchOutboundZeroHopTime", dispatchTime, dispatchTime);
else //else
_context.statManager().addRateData("tunnel.dispatchOutboundTime", dispatchTime, dispatchTime); // _context.statManager().addRateData("tunnel.dispatchOutboundTime", dispatchTime, dispatchTime);
} }
public List<HopConfig> listParticipatingTunnels() { public List<HopConfig> listParticipatingTunnels() {