* Console: Tag stat descriptions at declaration rather than in Strings.java

This commit is contained in:
zzz
2011-06-05 11:16:57 +00:00
parent 87cad7eaee
commit 8d42ebc2f0
3 changed files with 22 additions and 15 deletions

View File

@ -43,6 +43,7 @@ fi
# list specific files in core/ and router/ here, so we don't scan the whole tree # list specific files in core/ and router/ here, so we don't scan the whole tree
ROUTERFILES="\ ROUTERFILES="\
../../../core/java/src/net/i2p/data/DataHelper.java \ ../../../core/java/src/net/i2p/data/DataHelper.java \
../../../router/java/src/net/i2p/router/Router.java \
../../../router/java/src/net/i2p/router/RouterThrottleImpl.java \ ../../../router/java/src/net/i2p/router/RouterThrottleImpl.java \
../../../router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java \ ../../../router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java \
../../../router/java/src/net/i2p/router/transport/TransportManager.java \ ../../../router/java/src/net/i2p/router/transport/TransportManager.java \

View File

@ -95,13 +95,5 @@ class Dummy {
_("itag0"); _("itag0");
_("itag1"); _("itag1");
_("itag2"); _("itag2");
// Descriptions for the stats that are graphed by default
// There are over 500 stats currently defined, we aren't going to tag them all
_("Low-level bandwidth receive rate"); // bw.recvRate
_("Low-level bandwidth send rate"); // bw.sendRate
_("How many peers we are actively talking with"); // router.activePeers
// router.memoryUsed currently has the max size in the description so it can't be tagged
} }
} }

View File

@ -1421,6 +1421,17 @@ public class Router {
return Math.max(send, recv); return Math.max(send, recv);
} }
/**
* Mark a string for extraction by xgettext and translation.
* Use this only in static initializers.
* It does not translate!
* @return s
* @since 0.8.7
*/
private static final String _x(String s) {
return s;
}
/* following classes are now private static inner classes, didn't bother to reindent */ /* following classes are now private static inner classes, didn't bother to reindent */
private static final long LOW_MEMORY_THRESHOLD = 5 * 1024 * 1024; private static final long LOW_MEMORY_THRESHOLD = 5 * 1024 * 1024;
@ -1435,19 +1446,22 @@ private static class CoalesceStatsEvent implements SimpleTimer.TimedEvent {
public CoalesceStatsEvent(RouterContext ctx) { public CoalesceStatsEvent(RouterContext ctx) {
_ctx = ctx; _ctx = ctx;
ctx.statManager().createRequiredRateStat("bw.receiveBps", "Message receive rate (Bytes/sec)", "Bandwidth", new long[] { 60*1000, 5*60*1000, 60*60*1000 }); // NOTE TO TRANSLATORS - each of these phrases is a description for a statistic
// used in the router watchdog // to be displayed on /stats.jsp and in the graphs on /graphs.jsp.
ctx.statManager().createRequiredRateStat("bw.sendBps", "Message send rate (Bytes/sec)", "Bandwidth", new long[] { 60*1000, 5*60*1000, 60*60*1000 }); // Please keep relatively short so it will fit on the graphs.
ctx.statManager().createRequiredRateStat("bw.sendRate", "Low-level send rate (Bytes/sec)", "Bandwidth", new long[] { 60*1000l, 5*60*1000l, 10*60*1000l, 60*60*1000l }); ctx.statManager().createRequiredRateStat("bw.receiveBps", _x("Message receive rate (bytes/sec)"), "Bandwidth", new long[] { 60*1000, 5*60*1000, 60*60*1000 });
ctx.statManager().createRequiredRateStat("bw.recvRate", "Low-level receive rate (Bytes/sec)", "Bandwidth", new long[] { 60*1000l, 5*60*1000l, 10*60*1000l, 60*60*1000l }); ctx.statManager().createRequiredRateStat("bw.sendBps", _x("Message send rate (bytes/sec)"), "Bandwidth", new long[] { 60*1000, 5*60*1000, 60*60*1000 });
ctx.statManager().createRequiredRateStat("router.activePeers", "How many peers we are actively talking with", "Throttle", new long[] { 60*1000, 5*60*1000, 60*60*1000 }); ctx.statManager().createRequiredRateStat("bw.sendRate", _x("Low-level send rate (bytes/sec)"), "Bandwidth", new long[] { 60*1000l, 5*60*1000l, 10*60*1000l, 60*60*1000l });
ctx.statManager().createRequiredRateStat("bw.recvRate", _x("Low-level receive rate (bytes/sec)"), "Bandwidth", new long[] { 60*1000l, 5*60*1000l, 10*60*1000l, 60*60*1000l });
ctx.statManager().createRequiredRateStat("router.activePeers", _x("How many peers we are actively talking with"), "Throttle", new long[] { 60*1000, 5*60*1000, 60*60*1000 });
ctx.statManager().createRateStat("router.activeSendPeers", "How many peers we've sent to this minute", "Throttle", new long[] { 60*1000, 5*60*1000, 60*60*1000 }); ctx.statManager().createRateStat("router.activeSendPeers", "How many peers we've sent to this minute", "Throttle", new long[] { 60*1000, 5*60*1000, 60*60*1000 });
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.highCapacityPeers", "How many high capacity peers we know", "Throttle", new long[] { 5*60*1000, 60*60*1000 });
ctx.statManager().createRequiredRateStat("router.fastPeers", "Known fast peers", "Throttle", new long[] { 5*60*1000, 60*60*1000 }); ctx.statManager().createRequiredRateStat("router.fastPeers", _x("Known fast peers"), "Throttle", new long[] { 5*60*1000, 60*60*1000 });
_maxMemory = Runtime.getRuntime().maxMemory(); _maxMemory = Runtime.getRuntime().maxMemory();
String legend = "(Bytes)"; String legend = "(Bytes)";
if (_maxMemory < Long.MAX_VALUE) if (_maxMemory < Long.MAX_VALUE)
legend += " Max is " + DataHelper.formatSize(_maxMemory) + 'B'; legend += " Max is " + DataHelper.formatSize(_maxMemory) + 'B';
// router.memoryUsed currently has the max size in the description so it can't be tagged
ctx.statManager().createRequiredRateStat("router.memoryUsed", legend, "Router", new long[] { 60*1000 }); ctx.statManager().createRequiredRateStat("router.memoryUsed", legend, "Router", new long[] { 60*1000 });
} }
private RouterContext getContext() { return _ctx; } private RouterContext getContext() { return _ctx; }