* configstats: Page will now always reflect results of a previous

change, by querying the config instead of StatSummarizer to
   determine if a stat is graphed.
  - Don't append to a string in a loop
  - parseConfig() return a Set instead of List to avoid O(n**2) behavior
    when deteriming config changes
This commit is contained in:
zzz
2013-10-28 21:48:02 +00:00
parent 5bc13c16dc
commit bd0eee6aa9
4 changed files with 37 additions and 19 deletions

View File

@@ -7,6 +7,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import net.i2p.data.DataHelper;
@@ -220,12 +221,12 @@ public class GraphHelper extends FormHandler {
name = _stat;
displayName = _("Bandwidth usage");
} else {
List<Rate> rates = StatSummarizer.instance().parseSpecs(_stat);
Set<Rate> rates = StatSummarizer.instance().parseSpecs(_stat);
if (rates.size() != 1) {
_out.write("Graphs not enabled for " + _stat);
return "";
}
Rate r = rates.get(0);
Rate r = rates.iterator().next();
period = r.getPeriod();
name = r.getRateStat().getName();
displayName = name;