diff --git a/Makefile.gcj b/Makefile.gcj index 106c252ec..c1da11d6f 100644 --- a/Makefile.gcj +++ b/Makefile.gcj @@ -21,11 +21,12 @@ NATIVE_DIR=native # router.jar: full I2P router # jbigi.jar: collection of native optimized GMP routines for crypto JAR_BASE=i2p.jar mstreaming.jar streaming.jar -JAR_CLIENTS=i2ptunnel.jar sam.jar i2psnark.jar +JAR_CLIENTS=i2ptunnel.jar sam.jar JAR_ROUTER=router.jar JAR_JBIGI=jbigi.jar JAR_XML=xml-apis.jar resolver.jar xercesImpl.jar JAR_CONSOLE=\ + i2psnark.jar \ javax.servlet.jar \ commons-el.jar \ commons-logging.jar \ @@ -79,15 +80,15 @@ native_clean: native_shared: libi2p.so @cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2p_dsa --main=net.i2p.crypto.DSAEngine @echo "* i2p_dsa is a simple test app with the DSA engine and Fortuna PRNG to make sure crypto is working" - @cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/prng --main=gnu.crypto.prng.Fortuna + @cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/prng --main=gnu.crypto.prng.FortunaStandalone @cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2ptunnel --main=net.i2p.i2ptunnel.I2PTunnel @echo "* i2ptunnel is mihi's I2PTunnel CLI" @echo " run it as ./i2ptunnel -cli to avoid awt complaints" @cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2ptunnelctl --main=net.i2p.i2ptunnel.TunnelControllerGroup @echo "* i2ptunnelctl is a controller for I2PTunnel, reading i2ptunnel.config" @echo " and launching the appropriate proxies" - @cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2psnark --main=org.klomp.snark.Snark - @echo "* i2psnark is an anonymous bittorrent client" + #@cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2psnark --main=org.klomp.snark.Snark + #@echo "* i2psnark is an anonymous bittorrent client" @cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2prouter --main=net.i2p.router.Router @echo "* i2prouter is the main I2P router" @echo " it can be used, and while the router console won't load," @@ -95,6 +96,6 @@ native_shared: libi2p.so libi2p.so: @echo "* Building libi2p.so" - @(cd build ; ${GCJ} ${OPTIMIZE} -fPIC -fjni -shared -o ../${NATIVE_DIR}/libi2p.so ${LIBI2P_JARS} ; cd .. ) + @(cd build ; time ${GCJ} ${OPTIMIZE} -fPIC -fjni -shared -o ../${NATIVE_DIR}/libi2p.so ${LIBI2P_JARS} ; cd .. ) @ls -l ${NATIVE_DIR}/libi2p.so @echo "* libi2p.so built" diff --git a/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java new file mode 100644 index 000000000..ea66bed63 --- /dev/null +++ b/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java @@ -0,0 +1,104 @@ +package net.i2p.router.web; + +import java.io.IOException; +import java.io.Writer; +import java.util.*; + +import net.i2p.data.DataHelper; +import net.i2p.stat.Rate; +import net.i2p.router.RouterContext; + +public class GraphHelper { + private RouterContext _context; + private Writer _out; + private int _periodCount; + private boolean _showEvents; + private int _width; + private int _height; + private int _refreshDelaySeconds; + /** + * Configure this bean to query a particular router context + * + * @param contextId begging few characters of the routerHash, or null to pick + * the first one we come across. + */ + public void setContextId(String contextId) { + try { + _context = ContextHelper.getContext(contextId); + } catch (Throwable t) { + t.printStackTrace(); + } + } + + public GraphHelper() { + _periodCount = SummaryListener.PERIODS; + _showEvents = false; + _width = -1; + _height = -1; + _refreshDelaySeconds = 60; + } + + public void setOut(Writer out) { _out = out; } + public void setPeriodCount(String str) { + try { _periodCount = Integer.parseInt(str); } catch (NumberFormatException nfe) {} + } + public void setShowEvents(boolean b) { _showEvents = b; } + public void setHeight(String str) { + try { _height = Integer.parseInt(str); } catch (NumberFormatException nfe) {} + } + public void setWidth(String str) { + try { _width = Integer.parseInt(str); } catch (NumberFormatException nfe) {} + } + public void setRefreshDelay(String str) { + try { _refreshDelaySeconds = Integer.parseInt(str); } catch (NumberFormatException nfe) {} + } + + public String getImages() { + try { + List listeners = StatSummarizer.instance().getListeners(); + for (int i = 0; i < listeners.size(); i++) { + SummaryListener lsnr = (SummaryListener)listeners.get(i); + Rate r = lsnr.getRate(); + String title = r.getRateStat().getName() + " for " + DataHelper.formatDuration(_periodCount * r.getPeriod()); + _out.write("\n"); + } + if (_refreshDelaySeconds > 0) + _out.write("\n"); + + } catch (IOException ioe) { + ioe.printStackTrace(); + } + return ""; + } + public String getForm() { + try { + _out.write("
"); + _out.write("Periods:
\n"); + _out.write("Plot averages: "); + _out.write("or plot events:
\n"); + _out.write("Image sizes: width: pixels, height: (-1 for the default)
\n"); + _out.write("Refresh delay:
\n"); + _out.write(""); + } catch (IOException ioe) { + ioe.printStackTrace(); + } + return ""; + } + public String getPeerSummary() { + try { + _context.commSystem().renderStatusHTML(_out); + _context.bandwidthLimiter().renderStatusHTML(_out); + } catch (IOException ioe) { + ioe.printStackTrace(); + } + return ""; + } +} diff --git a/apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java b/apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java index 9e6941aea..f193122aa 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java @@ -31,6 +31,9 @@ public class StatSummarizer implements Runnable { } } + /** list of SummaryListener instances */ + List getListeners() { return _listeners; } + private static final String DEFAULT_DATABASES = "bw.sendRate.60000" + ",bw.recvRate.60000" + ",tunnel.testSuccessTime.60000" + diff --git a/apps/routerconsole/jsp/graphs.jsp b/apps/routerconsole/jsp/graphs.jsp new file mode 100644 index 000000000..422bf19d6 --- /dev/null +++ b/apps/routerconsole/jsp/graphs.jsp @@ -0,0 +1,23 @@ +<%@page contentType="text/html"%> +<%@page pageEncoding="UTF-8"%> + + + +I2P Router Console - graphs + + + +<%@include file="nav.jsp" %> +<%@include file="summary.jsp" %> + +
+ + + " /> + + + +
+ + + diff --git a/apps/routerconsole/jsp/nav.jsp b/apps/routerconsole/jsp/nav.jsp index 1a3aefc6c..4f3d416ba 100644 --- a/apps/routerconsole/jsp/nav.jsp +++ b/apps/routerconsole/jsp/nav.jsp @@ -33,6 +33,7 @@ NetDB | Logs | Jobs | + Graphs | Stats | Internals <% } %> diff --git a/history.txt b/history.txt index 28d6fb6d9..eeb54386e 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,7 @@ -$Id: history.txt,v 1.433 2006/03/17 18:46:03 jrandom Exp $ +$Id: history.txt,v 1.434 2006/03/18 18:09:38 jrandom Exp $ + +2006-03-18 jrandom + * Added a new graphs.jsp page to show all of the stats being harvested 2006-03-18 jrandom * Made the netDb search load limitations a little less stringent diff --git a/router/java/src/net/i2p/router/Router.java b/router/java/src/net/i2p/router/Router.java index 1eb8cde1a..e1af6eb0c 100644 --- a/router/java/src/net/i2p/router/Router.java +++ b/router/java/src/net/i2p/router/Router.java @@ -245,7 +245,8 @@ public class Router { _context.tunnelDispatcher().startup(); _context.inNetMessagePool().startup(); startupQueue(); - _context.jobQueue().addJob(new CoalesceStatsJob(_context)); + //_context.jobQueue().addJob(new CoalesceStatsJob(_context)); + SimpleTimer.getInstance().addEvent(new CoalesceStatsEvent(_context), 0); _context.jobQueue().addJob(new UpdateRoutingKeyModifierJob(_context)); warmupCrypto(); _sessionKeyPersistenceHelper.startup(); @@ -1011,9 +1012,10 @@ public class Router { * coalesce the stats framework every minute * */ -class CoalesceStatsJob extends JobImpl { - public CoalesceStatsJob(RouterContext ctx) { - super(ctx); +class CoalesceStatsEvent implements SimpleTimer.TimedEvent { + private RouterContext _ctx; + public CoalesceStatsEvent(RouterContext ctx) { + _ctx = ctx; ctx.statManager().createRateStat("bw.receiveBps", "How fast we receive data (in KBps)", "Bandwidth", new long[] { 60*1000, 5*60*1000, 60*60*1000 }); ctx.statManager().createRateStat("bw.sendBps", "How fast we send data (in KBps)", "Bandwidth", new long[] { 60*1000, 5*60*1000, 60*60*1000 }); ctx.statManager().createRateStat("bw.sendRate", "Low level bandwidth send rate, averaged every minute", "Bandwidth", new long[] { 60*1000l, 5*60*1000l, 10*60*1000l, 60*60*1000l }); @@ -1023,8 +1025,8 @@ class CoalesceStatsJob extends JobImpl { ctx.statManager().createRateStat("router.highCapacityPeers", "How many high capacity peers we know", "Throttle", new long[] { 5*60*1000, 60*60*1000 }); ctx.statManager().createRateStat("router.fastPeers", "How many fast peers we know", "Throttle", new long[] { 5*60*1000, 60*60*1000 }); } - public String getName() { return "Coalesce stats"; } - public void runJob() { + private RouterContext getContext() { return _ctx; } + public void timeReached() { int active = getContext().commSystem().countActivePeers(); getContext().statManager().addRateData("router.activePeers", active, 60*1000); @@ -1062,7 +1064,7 @@ class CoalesceStatsJob extends JobImpl { } } - requeue(60*1000); + SimpleTimer.getInstance().addEvent(this, 60*1000); } } diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index c6ba1da79..8704ead42 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -15,9 +15,9 @@ import net.i2p.CoreVersion; * */ public class RouterVersion { - public final static String ID = "$Revision: 1.374 $ $Date: 2006/03/17 18:46:02 $"; + public final static String ID = "$Revision: 1.375 $ $Date: 2006/03/18 18:09:37 $"; public final static String VERSION = "0.6.1.12"; - public final static long BUILD = 12; + public final static long BUILD = 13; public static void main(String args[]) { System.out.println("I2P Router version: " + VERSION + "-" + BUILD); System.out.println("Router ID: " + RouterVersion.ID);