* Stats: Add code to disable most stats to save memory.
Set on configstats.jsp or set stat.full=false to disable the stats. (true by default for now)
This commit is contained in:
@ -20,11 +20,13 @@ public class ConfigStatsHandler extends FormHandler {
|
||||
private String _graphs;
|
||||
private boolean _explicitFilter;
|
||||
private String _explicitFilterValue;
|
||||
private boolean _isFull;
|
||||
|
||||
public ConfigStatsHandler() {
|
||||
super();
|
||||
_stats = new ArrayList();
|
||||
_explicitFilter = false;
|
||||
_isFull = false;
|
||||
}
|
||||
|
||||
protected void processForm() {
|
||||
@ -70,6 +72,7 @@ public class ConfigStatsHandler extends FormHandler {
|
||||
|
||||
public void setExplicitFilter(String foo) { _explicitFilter = true; }
|
||||
public void setExplicitFilterValue(String filter) { _explicitFilterValue = filter; }
|
||||
public void setIsFull(String foo) { _isFull = true; }
|
||||
|
||||
/**
|
||||
* The user made changes to the config and wants to save them, so
|
||||
@ -109,6 +112,7 @@ public class ConfigStatsHandler extends FormHandler {
|
||||
|
||||
_context.router().setConfigSetting(StatManager.PROP_STAT_FILTER, stats.toString());
|
||||
_context.router().setConfigSetting("stat.summaries", _graphs);
|
||||
_context.router().setConfigSetting(StatManager.PROP_STAT_FULL, "" + _isFull);
|
||||
boolean ok = _context.router().saveConfig();
|
||||
if (ok)
|
||||
addFormNotice("Stat filter and location updated successfully to: " + stats.toString());
|
||||
|
@ -10,6 +10,7 @@ import java.util.StringTokenizer;
|
||||
import net.i2p.stat.Rate;
|
||||
import net.i2p.stat.RateStat;
|
||||
import net.i2p.stat.FrequencyStat;
|
||||
import net.i2p.stat.StatManager;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
@ -141,4 +142,10 @@ public class ConfigStatsHelper {
|
||||
public boolean getCurrentIsGraphed() { return _currentIsGraphed; }
|
||||
public boolean getCurrentCanBeGraphed() { return _currentCanBeGraphed; }
|
||||
public String getExplicitFilter() { return _filter; }
|
||||
public boolean getIsFull() {
|
||||
String f = _context.getProperty(StatManager.PROP_STAT_FULL);
|
||||
if (f != null && f.equals("true"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,10 @@ function toggleAll(category)
|
||||
System.setProperty("net.i2p.router.web.ConfigStatsHandler.nonce", new java.util.Random().nextLong()+""); %>
|
||||
<input type="hidden" name="action" value="foo" />
|
||||
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigStatsHandler.nonce")%>" />
|
||||
Enable full stats?
|
||||
<input type="checkbox" name="isFull" value="true" <%
|
||||
if (statshelper.getIsFull()) { %>checked="true" <% } %>/>
|
||||
(change requires restart to take effect)<br />
|
||||
Stat file: <input type="text" name="filename" value="<%=statshelper.getFilename()%>" /><br />
|
||||
Filter: (<a href="javascript: void(null);" onclick="toggleAll('*')">toggle all</a>)<br />
|
||||
<table>
|
||||
|
Reference in New Issue
Block a user