2006-03-17 jrandom
* Add support for graphing the event count as well as the average stat value (done by adding &showEvents=true to the URL). Also supports hiding the legend (&hideLegend=true), the grid (&hideGrid=true), and the title (&hideTitle=true). * Removed an unnecessary arbitrary filter on the profile organizer so we can pick high capacity and fast peers more appropriately
This commit is contained in:
@ -86,12 +86,14 @@ public class StatSummarizer implements Runnable {
|
||||
lsnr.startListening();
|
||||
//System.out.println("Start listening for " + r.getRateStat().getName() + ": " + r.getPeriod());
|
||||
}
|
||||
public boolean renderPng(Rate rate, OutputStream out) throws IOException { return renderPng(rate, out, -1, -1); }
|
||||
public boolean renderPng(Rate rate, OutputStream out, int width, int height) throws IOException {
|
||||
public boolean renderPng(Rate rate, OutputStream out) throws IOException {
|
||||
return renderPng(rate, out, -1, -1, false, false, false, false);
|
||||
}
|
||||
public boolean renderPng(Rate rate, OutputStream out, int width, int height, boolean hideLegend, boolean hideGrid, boolean hideTitle, boolean showEvents) throws IOException {
|
||||
for (int i = 0; i < _listeners.size(); i++) {
|
||||
SummaryListener lsnr = (SummaryListener)_listeners.get(i);
|
||||
if (lsnr.getRate().equals(rate)) {
|
||||
lsnr.renderPng(out, width, height);
|
||||
lsnr.renderPng(out, width, height, hideLegend, hideGrid, hideTitle, showEvents);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,9 @@ class SummaryListener implements RateSummaryListener {
|
||||
_factory.delete(_db.getPath());
|
||||
_db = null;
|
||||
}
|
||||
public void renderPng(OutputStream out, int width, int height) throws IOException { _renderer.render(out, width, height); }
|
||||
public void renderPng(OutputStream out, int width, int height, boolean hideLegend, boolean hideGrid, boolean hideTitle, boolean showEvents) throws IOException {
|
||||
_renderer.render(out, width, height, hideLegend, hideGrid, hideTitle, showEvents);
|
||||
}
|
||||
public void renderPng(OutputStream out) throws IOException { _renderer.render(out); }
|
||||
|
||||
String getName() { return _name; }
|
||||
@ -138,8 +140,8 @@ class SummaryRenderer {
|
||||
_listener = lsnr;
|
||||
}
|
||||
|
||||
public void render(OutputStream out) throws IOException { render(out, -1, -1); }
|
||||
public void render(OutputStream out, int width, int height) throws IOException {
|
||||
public void render(OutputStream out) throws IOException { render(out, -1, -1, false, false, false, false); }
|
||||
public void render(OutputStream out, int width, int height, boolean hideLegend, boolean hideGrid, boolean hideTitle, boolean showEvents) throws IOException {
|
||||
long end = _listener.now();
|
||||
long start = end - _listener.getRate().getPeriod()*SummaryListener.PERIODS;
|
||||
long begin = System.currentTimeMillis();
|
||||
@ -148,15 +150,30 @@ class SummaryRenderer {
|
||||
def.setTimePeriod(start/1000, end/1000);
|
||||
String title = _listener.getRate().getRateStat().getName() + " averaged for "
|
||||
+ DataHelper.formatDuration(_listener.getRate().getPeriod());
|
||||
def.setTitle(title);
|
||||
if (!hideTitle)
|
||||
def.setTitle(title);
|
||||
String path = _listener.getData().getPath();
|
||||
String dsNames[] = _listener.getData().getDsNames();
|
||||
def.datasource(_listener.getName(), path, dsNames[0], "AVERAGE", "MEMORY");
|
||||
// include the average event count on the plot
|
||||
//def.datasource(_listener.getName(), path, dsNames[1], "AVERAGE", "MEMORY");
|
||||
def.area(dsNames[0], Color.BLUE, _listener.getRate().getRateStat().getDescription());
|
||||
//def.line(dsNames[1], Color.RED, "Events per period");
|
||||
//System.out.println("rendering: path=" + path + " dsNames[0]=" + dsNames[0] + " dsNames[1]=" + dsNames[1] + " lsnr.getName=" + _listener.getName());
|
||||
String plotName = null;
|
||||
String descr = null;
|
||||
if (showEvents) {
|
||||
// include the average event count on the plot
|
||||
plotName = dsNames[1];
|
||||
descr = "Events per period";
|
||||
} else {
|
||||
// include the average value
|
||||
plotName = dsNames[0];
|
||||
descr = _listener.getRate().getRateStat().getDescription();
|
||||
}
|
||||
def.datasource(plotName, path, plotName, "AVERAGE", "MEMORY");
|
||||
def.area(plotName, Color.BLUE, descr);
|
||||
if (hideLegend)
|
||||
def.setShowLegend(false);
|
||||
if (hideGrid) {
|
||||
def.setGridX(false);
|
||||
def.setGridY(false);
|
||||
}
|
||||
System.out.println("rendering: path=" + path + " dsNames[0]=" + dsNames[0] + " dsNames[1]=" + dsNames[1] + " lsnr.getName=" + _listener.getName());
|
||||
def.setAntiAliasing(false);
|
||||
RrdGraph graph = new RrdGraph(def);
|
||||
//System.out.println("Graph created");em.
|
||||
|
@ -23,7 +23,11 @@ if (rs != null) {
|
||||
if (str != null) try { width = Integer.parseInt(str); } catch (NumberFormatException nfe) {}
|
||||
str = request.getParameter("height");
|
||||
if (str != null) try { height = Integer.parseInt(str); } catch (NumberFormatException nfe) {}
|
||||
rendered = net.i2p.router.web.StatSummarizer.instance().renderPng(rate, cout, width, height);
|
||||
boolean hideLegend = Boolean.valueOf(""+request.getParameter("hideLegend")).booleanValue();
|
||||
boolean hideGrid = Boolean.valueOf(""+request.getParameter("hideGrid")).booleanValue();
|
||||
boolean hideTitle = Boolean.valueOf(""+request.getParameter("hideTitle")).booleanValue();
|
||||
boolean showEvents = Boolean.valueOf(""+request.getParameter("showEvents")).booleanValue();
|
||||
rendered = net.i2p.router.web.StatSummarizer.instance().renderPng(rate, cout, width, height, hideLegend, hideGrid, hideTitle, showEvents);
|
||||
}
|
||||
if (rendered)
|
||||
cout.close();
|
||||
|
10
history.txt
10
history.txt
@ -1,4 +1,12 @@
|
||||
$Id: history.txt,v 1.431 2006/03/15 19:49:22 complication Exp $
|
||||
$Id: history.txt,v 1.432 2006/03/16 16:45:28 jrandom Exp $
|
||||
|
||||
2006-03-17 jrandom
|
||||
* Add support for graphing the event count as well as the average stat
|
||||
value (done by adding &showEvents=true to the URL). Also supports
|
||||
hiding the legend (&hideLegend=true), the grid (&hideGrid=true), and
|
||||
the title (&hideTitle=true).
|
||||
* Removed an unnecessary arbitrary filter on the profile organizer so we
|
||||
can pick high capacity and fast peers more appropriately
|
||||
|
||||
2006-03-16 jrandom
|
||||
* Integrate basic hooks for jrobin (http://jrobin.org) into the router
|
||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
||||
*
|
||||
*/
|
||||
public class RouterVersion {
|
||||
public final static String ID = "$Revision: 1.372 $ $Date: 2006/03/15 19:49:23 $";
|
||||
public final static String ID = "$Revision: 1.373 $ $Date: 2006/03/16 16:45:26 $";
|
||||
public final static String VERSION = "0.6.1.12";
|
||||
public final static long BUILD = 10;
|
||||
public final static long BUILD = 11;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||
System.out.println("Router ID: " + RouterVersion.ID);
|
||||
|
@ -184,6 +184,8 @@ public class StatsGenerator {
|
||||
buf.append(" <a href=\"viewstat.jsp?stat=").append(name);
|
||||
buf.append("&period=").append(periods[i]);
|
||||
buf.append("\" title=\"Render summarized data\">render</a>");
|
||||
buf.append(" <a href=\"viewstat.jsp?stat=").append(name);
|
||||
buf.append("&period=").append(periods[i]).append("&showEvents=true\" title=\"Render summarized event counts\">events</a>");
|
||||
buf.append(" (as <a href=\"viewstat.jsp?stat=").append(name);
|
||||
buf.append("&period=").append(periods[i]);
|
||||
buf.append("&format=xml\" title=\"Dump stat history as XML\">XML</a>");
|
||||
|
@ -482,9 +482,10 @@ public class ProfileOrganizer {
|
||||
|
||||
placeTime = System.currentTimeMillis()-placeStart;
|
||||
|
||||
if (_log.shouldLog(Log.DEBUG)) {
|
||||
_log.debug("Profiles reorganized. averages: [integration: " + _thresholdIntegrationValue
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Profiles reorganized. averages: [integration: " + _thresholdIntegrationValue
|
||||
+ ", capacity: " + _thresholdCapacityValue + ", speed: " + _thresholdSpeedValue + "]");
|
||||
if (_log.shouldLog(Log.DEBUG)) {
|
||||
StringBuffer buf = new StringBuffer(512);
|
||||
for (Iterator iter = _strictCapacityOrder.iterator(); iter.hasNext(); ) {
|
||||
PeerProfile prof = (PeerProfile)iter.next();
|
||||
@ -522,7 +523,7 @@ public class ProfileOrganizer {
|
||||
if ( (!_fastPeers.containsKey(cur.getPeer())) && (!cur.getIsFailing()) ) {
|
||||
if (!isSelectable(cur.getPeer())) {
|
||||
// skip peers we dont have in the netDb
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("skip unknown peer from fast promotion: " + cur.getPeer().toBase64());
|
||||
continue;
|
||||
}
|
||||
@ -611,8 +612,9 @@ public class ProfileOrganizer {
|
||||
continue;
|
||||
|
||||
// dont bother trying to make sense of things below the baseline
|
||||
if (profile.getCapacityValue() <= CapacityCalculator.GROWTH_FACTOR)
|
||||
continue;
|
||||
// otoh, keep them in the threshold calculation, so we can adapt
|
||||
////if (profile.getCapacityValue() <= CapacityCalculator.GROWTH_FACTOR)
|
||||
//// continue;
|
||||
|
||||
totalCapacity += profile.getCapacityValue();
|
||||
totalIntegration += profile.getIntegrationValue();
|
||||
|
Reference in New Issue
Block a user