2007-08-11 zzz

* Add stats for individual tunnel rates (nice when graphed)
    * i2psnark: Fix outbound tunnel nickname
This commit is contained in:
zzz
2007-08-11 20:48:14 +00:00
committed by zzz
parent e3e1d0842d
commit a4b221fa71
4 changed files with 35 additions and 3 deletions

View File

@ -101,6 +101,8 @@ public class I2PSnarkUtil {
}
if (opts.getProperty("inbound.nickname") == null)
opts.setProperty("inbound.nickname", "I2PSnark");
if (opts.getProperty("outbound.nickname") == null)
opts.setProperty("outbound.nickname", "I2PSnark");
if (opts.getProperty("i2p.streaming.inactivityTimeout") == null)
opts.setProperty("i2p.streaming.inactivityTimeout", "90000");
if (opts.getProperty("i2p.streaming.inactivityAction") == null)

View File

@ -1,4 +1,8 @@
$Id: history.txt,v 1.580 2007-08-04 22:25:30 complication Exp $
$Id: history.txt,v 1.581 2007-08-05 22:35:42 complication Exp $
2007-08-11 zzz
* Add stats for individual tunnel rates (nice when graphed)
* i2psnark: Fix outbound tunnel nickname
2007-08-05 Complication
* Update the sharing calculator on config.jsp

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.515 $ $Date: 2007-08-04 22:25:31 $";
public final static String ID = "$Revision: 1.516 $ $Date: 2007-08-05 22:35:45 $";
public final static String VERSION = "0.6.1.28";
public final static long BUILD = 18;
public final static long BUILD = 19;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -34,6 +34,9 @@ public class TunnelPool {
private long _lastSelectionPeriod;
private int _expireSkew;
private long _started;
private long _lastRateUpdate;
private long _lastLifetimeProcessed;
private String _rateName;
public TunnelPool(RouterContext ctx, TunnelPoolManager mgr, TunnelPoolSettings settings, TunnelPeerSelector sel) {
_context = ctx;
@ -48,12 +51,19 @@ public class TunnelPool {
_lifetimeProcessed = 0;
_expireSkew = _context.random().nextInt(90*1000);
_started = System.currentTimeMillis();
_lastRateUpdate = _started;
_lastLifetimeProcessed = 0;
_rateName = "tunnel.Bps." +
(_settings.isExploratory() ? "exploratory" : _settings.getDestinationNickname()) +
(_settings.isInbound() ? ".in" : ".out");
refreshSettings();
}
public void startup() {
_alive = true;
_started = System.currentTimeMillis();
_lastRateUpdate = _started;
_lastLifetimeProcessed = 0;
_manager.getExecutor().repoll();
if (_settings.isInbound() && (_settings.getDestination() != null) ) {
// we just reconnected and didn't require any new tunnel builders.
@ -66,6 +76,9 @@ public class TunnelPool {
if (ls != null)
_context.clientManager().requestLeaseSet(_settings.getDestination(), ls);
}
_context.statManager().createRateStat(_rateName,
"Tunnel Bandwidth", "Tunnels",
new long[] { 5*60*1000l });
}
public void shutdown() {
@ -249,6 +262,7 @@ public class TunnelPool {
_manager.getExecutor().repoll();
_lifetimeProcessed += info.getProcessedMessagesCount();
updateRate();
long lifetimeConfirmed = info.getVerifiedBytesTransferred();
long lifetime = 10*60*1000;
@ -295,6 +309,7 @@ public class TunnelPool {
_manager.tunnelFailed();
_lifetimeProcessed += cfg.getProcessedMessagesCount();
updateRate();
if (_settings.isInbound() && (_settings.getDestination() != null) ) {
if (ls != null) {
@ -303,6 +318,17 @@ public class TunnelPool {
}
}
void updateRate() {
long now = _context.clock().now();
long et = now - _lastRateUpdate;
if (et > 2*60*1000) {
long bw = 1024 * (_lifetimeProcessed - _lastLifetimeProcessed) * 1000 / et; // Bps
_context.statManager().addRateData(_rateName, bw, 0);
_lastRateUpdate = now;
_lastLifetimeProcessed = _lifetimeProcessed;
}
}
void refreshLeaseSet() {
if (_log.shouldLog(Log.DEBUG))
_log.debug(toString() + ": refreshing leaseSet on tunnel expiration (but prior to grace timeout)");