forked from I2P_Developers/i2p.i2p
propagate from branch 'i2p.i2p.zzz.test' (head 104b5c1cea8683af30650a55d5b63141e988bb4c)
to branch 'i2p.i2p' (head 8d35e0858095b3eed3fb6d8f4ecee23cbdadfbb1)
This commit is contained in:
@@ -669,9 +669,9 @@ public class JobQueue {
|
||||
/** render the HTML for the job stats */
|
||||
private void getJobStats(StringBuffer buf) {
|
||||
buf.append("<table border=\"1\">\n");
|
||||
buf.append("<tr><td><b>Job</b></td><td><b>Runs</b></td>");
|
||||
buf.append("<td><b>Time</b></td><td><b><i>Avg</i></b></td><td><b><i>Max</i></b></td><td><b><i>Min</i></b></td>");
|
||||
buf.append("<td><b>Pending</b></td><td><b><i>Avg</i></b></td><td><b><i>Max</i></b></td><td><b><i>Min</i></b></td></tr>\n");
|
||||
buf.append("<tr><th>Job</th><th>Runs</th>");
|
||||
buf.append("<th>Time</th><th><i>Avg</i></th><th><i>Max</i></th><th><i>Min</i></th>");
|
||||
buf.append("<th>Pending</th><th><i>Avg</i></th><th><i>Max</i></th><th><i>Min</i></th></tr>\n");
|
||||
long totRuns = 0;
|
||||
long totExecTime = 0;
|
||||
long avgExecTime = 0;
|
||||
|
@@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 2;
|
||||
public final static long BUILD = 0;
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
|
||||
|
@@ -139,12 +139,18 @@ public class StatisticsManager implements Service {
|
||||
|
||||
//includeRate("tunnel.buildRequestTime", stats, new long[] { 10*60*1000 });
|
||||
long rate = 60*60*1000;
|
||||
includeRate("tunnel.buildClientExpire", stats, new long[] { rate });
|
||||
includeRate("tunnel.buildClientReject", stats, new long[] { rate });
|
||||
includeRate("tunnel.buildClientSuccess", stats, new long[] { rate });
|
||||
includeRate("tunnel.buildExploratoryExpire", stats, new long[] { rate });
|
||||
includeRate("tunnel.buildExploratoryReject", stats, new long[] { rate });
|
||||
includeRate("tunnel.buildExploratorySuccess", stats, new long[] { rate });
|
||||
boolean commentOutIn076 = RouterVersion.VERSION.equals("0.7.5");
|
||||
if (commentOutIn076) {
|
||||
includeRate("tunnel.buildClientExpire", stats, new long[] { rate });
|
||||
includeRate("tunnel.buildClientReject", stats, new long[] { rate });
|
||||
includeRate("tunnel.buildClientSuccess", stats, new long[] { rate });
|
||||
includeRate("tunnel.buildExploratoryExpire", stats, new long[] { rate });
|
||||
includeRate("tunnel.buildExploratoryReject", stats, new long[] { rate });
|
||||
includeRate("tunnel.buildExploratorySuccess", stats, new long[] { rate });
|
||||
} else {
|
||||
includeTunnelRates("Client", stats, rate);
|
||||
includeTunnelRates("Exploratory", stats, rate);
|
||||
}
|
||||
//includeRate("tunnel.rejectTimeout", stats, new long[] { 10*60*1000 });
|
||||
//includeRate("tunnel.rejectOverloaded", stats, new long[] { 10*60*1000 });
|
||||
//includeRate("tunnel.acceptLoad", stats, new long[] { 10*60*1000 });
|
||||
@@ -223,6 +229,49 @@ public class StatisticsManager implements Service {
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
private static final String[] tunnelStats = { "Expire", "Reject", "Success" };
|
||||
|
||||
/**
|
||||
* Add tunnel build rates with some mods to hide absolute quantities
|
||||
* In particular, report counts normalized to 100 (i.e. a percentage)
|
||||
*/
|
||||
private void includeTunnelRates(String tunnelType, Properties stats, long selectedPeriod) {
|
||||
long totalEvents = 0;
|
||||
for (String tunnelStat : tunnelStats) {
|
||||
String rateName = "tunnel.build" + tunnelType + tunnelStat;
|
||||
RateStat stat = _context.statManager().getRate(rateName);
|
||||
if (stat == null) continue;
|
||||
Rate curRate = stat.getRate(selectedPeriod);
|
||||
if (curRate == null) continue;
|
||||
totalEvents += curRate.getLastEventCount();
|
||||
}
|
||||
if (totalEvents <= 0)
|
||||
return;
|
||||
for (String tunnelStat : tunnelStats) {
|
||||
String rateName = "tunnel.build" + tunnelType + tunnelStat;
|
||||
RateStat stat = _context.statManager().getRate(rateName);
|
||||
if (stat == null) continue;
|
||||
Rate curRate = stat.getRate(selectedPeriod);
|
||||
if (curRate == null) continue;
|
||||
double fudgeQuantity = 100.0d * curRate.getLastEventCount() / totalEvents;
|
||||
stats.setProperty("stat_" + rateName + '.' + getPeriod(curRate), renderRate(curRate, fudgeQuantity));
|
||||
}
|
||||
}
|
||||
|
||||
private String renderRate(Rate rate, double fudgeQuantity) {
|
||||
StringBuffer buf = new StringBuffer(128);
|
||||
buf.append(num(rate.getAverageValue())).append(';');
|
||||
buf.append(num(rate.getExtremeAverageValue())).append(';');
|
||||
buf.append(pct(rate.getPercentageOfLifetimeValue())).append(';');
|
||||
if (rate.getLifetimeTotalEventTime() > 0) {
|
||||
// bah saturation
|
||||
buf.append("0;0;0;0;");
|
||||
}
|
||||
long numPeriods = rate.getLifetimePeriods();
|
||||
buf.append(num(fudgeQuantity)).append(';');
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/* report the same data for tx and rx, for enhanced anonymity */
|
||||
private void includeAverageThroughput(Properties stats) {
|
||||
RateStat sendRate = _context.statManager().getRate("bw.sendRate");
|
||||
|
@@ -43,7 +43,7 @@ public class ClientListenerRunner implements Runnable {
|
||||
_running = false;
|
||||
_listening = false;
|
||||
|
||||
String val = context.getProperty(BIND_ALL_INTERFACES, "False");
|
||||
String val = context.getProperty(BIND_ALL_INTERFACES);
|
||||
_bindAllInterfaces = Boolean.valueOf(val).booleanValue();
|
||||
}
|
||||
|
||||
|
@@ -49,18 +49,8 @@ public class ClientManagerFacadeImpl extends ClientManagerFacade {
|
||||
|
||||
public void startup() {
|
||||
_log.info("Starting up the client subsystem");
|
||||
String portStr = _context.router().getConfigSetting(PROP_CLIENT_PORT);
|
||||
if (portStr != null) {
|
||||
try {
|
||||
int port = Integer.parseInt(portStr);
|
||||
_manager = new ClientManager(_context, port);
|
||||
} catch (NumberFormatException nfe) {
|
||||
_log.error("Error setting the port: " + portStr + " is not valid", nfe);
|
||||
_manager = new ClientManager(_context, DEFAULT_PORT);
|
||||
}
|
||||
} else {
|
||||
_manager = new ClientManager(_context, DEFAULT_PORT);
|
||||
}
|
||||
int port = _context.getProperty(PROP_CLIENT_PORT, DEFAULT_PORT);
|
||||
_manager = new ClientManager(_context, port);
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
|
@@ -61,13 +61,13 @@ class ProfileOrganizerRenderer {
|
||||
buf.append("<p>Showing ").append(order.size()).append(" recent profiles, hiding ").append(peers.size()-order.size()).append(" older profiles</p>");
|
||||
buf.append("<table border=\"1\">");
|
||||
buf.append("<tr>");
|
||||
buf.append("<td><b>Peer</b></td>");
|
||||
buf.append("<td><b>Groups (Caps)</b></td>");
|
||||
buf.append("<td><b>Speed</b></td>");
|
||||
buf.append("<td><b>Capacity</b></td>");
|
||||
buf.append("<td><b>Integration</b></td>");
|
||||
buf.append("<td><b>Failing?</b></td>");
|
||||
buf.append("<td> </td>");
|
||||
buf.append("<th>Peer</th>");
|
||||
buf.append("<th>Groups (Caps)</th>");
|
||||
buf.append("<th>Speed</th>");
|
||||
buf.append("<th>Capacity</th>");
|
||||
buf.append("<th>Integration</th>");
|
||||
buf.append("<th>Failing?</th>");
|
||||
buf.append("<th> </th>");
|
||||
buf.append("</tr>");
|
||||
int prevTier = 1;
|
||||
for (Iterator iter = order.iterator(); iter.hasNext();) {
|
||||
@@ -159,22 +159,22 @@ class ProfileOrganizerRenderer {
|
||||
buf.append("<h2>Floodfill and Integrated Peers</h2>\n");
|
||||
buf.append("<table border=\"1\">");
|
||||
buf.append("<tr>");
|
||||
buf.append("<td><b>Peer</b></td>");
|
||||
buf.append("<td><b>Caps</b></td>");
|
||||
buf.append("<td><b>Integ. Value</b></td>");
|
||||
buf.append("<td><b>Last Heard About</b></td>");
|
||||
buf.append("<td><b>Last Heard From</b></td>");
|
||||
buf.append("<td><b>Last Successful Send</b></td>");
|
||||
buf.append("<td><b>Last Failed Send</b></td>");
|
||||
buf.append("<td><b>10m Resp. Time</b></td>");
|
||||
buf.append("<td><b>1h Resp. Time</b></td>");
|
||||
buf.append("<td><b>1d Resp. Time</b></td>");
|
||||
buf.append("<td><b>Successful Lookups</b></td>");
|
||||
buf.append("<td><b>Failed Lookups</b></td>");
|
||||
buf.append("<td><b>New Stores</b></td>");
|
||||
buf.append("<td><b>Old Stores</b></td>");
|
||||
buf.append("<td><b>1h Fail Rate</b></td>");
|
||||
buf.append("<td><b>1d Fail Rate</b></td>");
|
||||
buf.append("<th>Peer</th>");
|
||||
buf.append("<th>Caps</th>");
|
||||
buf.append("<th>Integ. Value</th>");
|
||||
buf.append("<th>Last Heard About</th>");
|
||||
buf.append("<th>Last Heard From</th>");
|
||||
buf.append("<th>Last Successful Send</th>");
|
||||
buf.append("<th>Last Failed Send</th>");
|
||||
buf.append("<th>10m Resp. Time</th>");
|
||||
buf.append("<th>1h Resp. Time</th>");
|
||||
buf.append("<th>1d Resp. Time</th>");
|
||||
buf.append("<th>Successful Lookups</th>");
|
||||
buf.append("<th>Failed Lookups</th>");
|
||||
buf.append("<th>New Stores</th>");
|
||||
buf.append("<th>Old Stores</th>");
|
||||
buf.append("<th>1h Fail Rate</th>");
|
||||
buf.append("<th>1d Fail Rate</th>");
|
||||
buf.append("</tr>");
|
||||
for (Iterator iter = integratedPeers.iterator(); iter.hasNext();) {
|
||||
PeerProfile prof = (PeerProfile)iter.next();
|
||||
|
@@ -31,7 +31,7 @@ import net.i2p.util.Log;
|
||||
public class EventPumper implements Runnable {
|
||||
private RouterContext _context;
|
||||
private Log _log;
|
||||
private boolean _alive;
|
||||
private volatile boolean _alive;
|
||||
private Selector _selector;
|
||||
private final List _bufCache;
|
||||
private final List _wantsRead = new ArrayList(16);
|
||||
@@ -64,7 +64,7 @@ public class EventPumper implements Runnable {
|
||||
_expireIdleWriteTime = MAX_EXPIRE_IDLE_TIME;
|
||||
}
|
||||
|
||||
public void startPumping() {
|
||||
public synchronized void startPumping() {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Starting pumper");
|
||||
// _wantsRead = new ArrayList(16);
|
||||
@@ -83,7 +83,7 @@ public class EventPumper implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
public void stopPumping() {
|
||||
public synchronized void stopPumping() {
|
||||
_alive = false;
|
||||
if (_selector != null && _selector.isOpen())
|
||||
_selector.wakeup();
|
||||
|
@@ -416,7 +416,7 @@ public class NTCPTransport extends TransportImpl {
|
||||
private static final int NUM_CONCURRENT_READERS = 3;
|
||||
private static final int NUM_CONCURRENT_WRITERS = 3;
|
||||
|
||||
public RouterAddress startListening() {
|
||||
public synchronized RouterAddress startListening() {
|
||||
if (_log.shouldLog(Log.DEBUG)) _log.debug("Starting ntcp transport listening");
|
||||
_finisher.start();
|
||||
_pumper.startPumping();
|
||||
@@ -428,7 +428,7 @@ public class NTCPTransport extends TransportImpl {
|
||||
return bindAddress();
|
||||
}
|
||||
|
||||
public RouterAddress restartListening(RouterAddress addr) {
|
||||
public synchronized RouterAddress restartListening(RouterAddress addr) {
|
||||
if (_log.shouldLog(Log.DEBUG)) _log.debug("Restarting ntcp transport listening");
|
||||
_finisher.start();
|
||||
_pumper.startPumping();
|
||||
@@ -602,7 +602,7 @@ public class NTCPTransport extends TransportImpl {
|
||||
* This doesn't (completely) block, caller should check isAlive()
|
||||
* before calling startListening() or restartListening()
|
||||
*/
|
||||
public void stopListening() {
|
||||
public synchronized void stopListening() {
|
||||
if (_log.shouldLog(Log.DEBUG)) _log.debug("Stopping ntcp transport");
|
||||
_pumper.stopPumping();
|
||||
_writer.stopWriting();
|
||||
|
@@ -1769,48 +1769,48 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
buf.append(" timeout: ").append(DataHelper.formatDuration(_expireTimeout));
|
||||
buf.append("</b><br />\n");
|
||||
buf.append("<table border=\"1\">\n");
|
||||
buf.append("<tr><td><b><a href=\"#def.peer\">Peer</a></b>");
|
||||
buf.append("<tr><th><a href=\"#def.peer\">Peer</a>");
|
||||
if (sortFlags != FLAG_ALPHA)
|
||||
buf.append(" <a href=\"").append(urlBase).append("?sort=0\">V</a> ");
|
||||
buf.append("</td><td><b><a href=\"#def.dir\">Dir/Intro</a></b></td><td><b><a href=\"#def.idle\">Idle</a></b>");
|
||||
buf.append("</th><th><a href=\"#def.dir\">Dir/Intro</a></th><th><a href=\"#def.idle\">Idle</a>");
|
||||
appendSortLinks(buf, urlBase, sortFlags, "Sort by idle inbound", FLAG_IDLE_IN);
|
||||
buf.append("/");
|
||||
appendSortLinks(buf, urlBase, sortFlags, "Sort by idle outbound", FLAG_IDLE_OUT);
|
||||
buf.append("</td>");
|
||||
buf.append("<td><b><a href=\"#def.rate\">In/Out</a></b>");
|
||||
buf.append("</th>");
|
||||
buf.append("<th><a href=\"#def.rate\">In/Out</a>");
|
||||
appendSortLinks(buf, urlBase, sortFlags, "Sort by inbound rate", FLAG_RATE_IN);
|
||||
buf.append("/");
|
||||
appendSortLinks(buf, urlBase, sortFlags, "Sort by outbound rate", FLAG_RATE_OUT);
|
||||
buf.append("</td>\n");
|
||||
buf.append("<td><b><a href=\"#def.up\">Up</a></b>");
|
||||
buf.append("</th>\n");
|
||||
buf.append("<th><a href=\"#def.up\">Up</a>");
|
||||
appendSortLinks(buf, urlBase, sortFlags, "Sort by connection uptime", FLAG_UPTIME);
|
||||
buf.append("</td><td><b><a href=\"#def.skew\">skew</a></b>");
|
||||
buf.append("</th><th><a href=\"#def.skew\">skew</a>");
|
||||
appendSortLinks(buf, urlBase, sortFlags, "Sort by clock skew", FLAG_SKEW);
|
||||
buf.append("</td>\n");
|
||||
buf.append("<td><b><a href=\"#def.cwnd\">Cwnd</a></b>");
|
||||
buf.append("</th>\n");
|
||||
buf.append("<th><a href=\"#def.cwnd\">Cwnd</a>");
|
||||
appendSortLinks(buf, urlBase, sortFlags, "Sort by congestion window", FLAG_CWND);
|
||||
buf.append("</td><td><b><a href=\"#def.ssthresh\">Ssthresh</a></b>");
|
||||
buf.append("</th><th><a href=\"#def.ssthresh\">Ssthresh</a>");
|
||||
appendSortLinks(buf, urlBase, sortFlags, "Sort by slow start threshold", FLAG_SSTHRESH);
|
||||
buf.append("</td>\n");
|
||||
buf.append("<td><b><a href=\"#def.rtt\">Rtt</a></b>");
|
||||
buf.append("</th>\n");
|
||||
buf.append("<th><a href=\"#def.rtt\">Rtt</a>");
|
||||
appendSortLinks(buf, urlBase, sortFlags, "Sort by round trip time", FLAG_RTT);
|
||||
buf.append("</td><td><b><a href=\"#def.dev\">Dev</a></b>");
|
||||
buf.append("</th><th><a href=\"#def.dev\">Dev</a>");
|
||||
appendSortLinks(buf, urlBase, sortFlags, "Sort by round trip time deviation", FLAG_DEV);
|
||||
buf.append("</td><td><b><a href=\"#def.rto\">Rto</a></b>");
|
||||
buf.append("</th><th><a href=\"#def.rto\">Rto</a>");
|
||||
appendSortLinks(buf, urlBase, sortFlags, "Sort by retransmission timeout", FLAG_RTO);
|
||||
buf.append("</td>\n");
|
||||
buf.append("<td><b><a href=\"#def.mtu\">Mtu</a></b>");
|
||||
buf.append("</th>\n");
|
||||
buf.append("<th><a href=\"#def.mtu\">Mtu</a>");
|
||||
appendSortLinks(buf, urlBase, sortFlags, "Sort by maximum transmit unit", FLAG_MTU);
|
||||
buf.append("</td><td><b><a href=\"#def.send\">Send</a></b>");
|
||||
buf.append("</th><th><a href=\"#def.send\">Send</a>");
|
||||
appendSortLinks(buf, urlBase, sortFlags, "Sort by packets sent", FLAG_SEND);
|
||||
buf.append("</td><td><b><a href=\"#def.recv\">Recv</a></b>");
|
||||
buf.append("</th><th><a href=\"#def.recv\">Recv</a>");
|
||||
appendSortLinks(buf, urlBase, sortFlags, "Sort by packets received", FLAG_RECV);
|
||||
buf.append("</td>\n");
|
||||
buf.append("<td><b><a href=\"#def.resent\">Resent</a></b>");
|
||||
buf.append("</th>\n");
|
||||
buf.append("<th><a href=\"#def.resent\">Resent</a>");
|
||||
appendSortLinks(buf, urlBase, sortFlags, "Sort by packets retransmitted", FLAG_RESEND);
|
||||
buf.append("</td><td><b><a href=\"#def.dupRecv\">DupRecv</a></b>");
|
||||
buf.append("</th><th><a href=\"#def.dupRecv\">DupRecv</a>");
|
||||
appendSortLinks(buf, urlBase, sortFlags, "Sort by packets received more than once", FLAG_DUP);
|
||||
buf.append("</td>\n");
|
||||
buf.append("</th>\n");
|
||||
buf.append("</tr>\n");
|
||||
out.write(buf.toString());
|
||||
buf.setLength(0);
|
||||
|
@@ -439,9 +439,9 @@ public class TunnelPoolManager implements TunnelManagerFacade {
|
||||
List participating = _context.tunnelDispatcher().listParticipatingTunnels();
|
||||
Collections.sort(participating, new TunnelComparator());
|
||||
out.write("<h2><a name=\"participating\">Participating tunnels</a>:</h2><table border=\"1\">\n");
|
||||
out.write("<tr><td><b>Receive on</b></td><td><b>From</b></td><td>"
|
||||
+ "<b>Send on</b></td><td><b>To</b></td><td><b>Expiration</b></td>"
|
||||
+ "<td><b>Usage</b></td><td><b>Rate</b></td><td><b>Role</b></td></tr>\n");
|
||||
out.write("<tr><th>Receive on</th><th>From</th><th>"
|
||||
+ "Send on</th><th>To</th><th>Expiration</th>"
|
||||
+ "<th>Usage</th><th>Rate</th><th>Role</th></tr>\n");
|
||||
long processed = 0;
|
||||
RateStat rs = _context.statManager().getRate("tunnel.participatingMessageCount");
|
||||
if (rs != null)
|
||||
@@ -602,7 +602,7 @@ public class TunnelPoolManager implements TunnelManagerFacade {
|
||||
Collections.sort(peerList, new HashComparator());
|
||||
|
||||
out.write("<h2><a name=\"peers\">Tunnel Counts By Peer</a>:</h2>\n");
|
||||
out.write("<table border=\"1\"><tr><td><b>Peer</b></td><td><b>Expl. + Client</b></td><td><b>% of total</b></td><td><b>Part. from + to</b></td><td><b>% of total</b></td></tr>\n");
|
||||
out.write("<table border=\"1\"><tr><th>Peer</th><th>Expl. + Client</th><th>% of total</th><th>Part. from + to</th><th>% of total</th></tr>\n");
|
||||
for (Hash h : peerList) {
|
||||
out.write("<tr><td align=\"right\">");
|
||||
out.write(netDbLink(h));
|
||||
|
@@ -276,7 +276,14 @@ public class ControlPoint implements HTTPRequestListener
|
||||
{
|
||||
int nRoots = devNodeList.size();
|
||||
for (int n=0; n<nRoots; n++) {
|
||||
Node rootNode = devNodeList.getNode(n);
|
||||
// AIOOB was thrown from here, maybe would be better to
|
||||
// copy the list before traversal?
|
||||
Node rootNode;
|
||||
try {
|
||||
rootNode = devNodeList.getNode(n);
|
||||
} catch (ArrayIndexOutOfBoundsException aioob) {
|
||||
break;
|
||||
}
|
||||
Device dev = getDevice(rootNode);
|
||||
if (dev == null)
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user