2005-10-08 jrandom

* Use the OS clock for stat timing, since it doesn't jump around (though
      still use the NTP'ed clock for display)
    * Added new DH stats
This commit is contained in:
jrandom
2005-10-08 22:05:46 +00:00
committed by zzz
parent 38617fe0a7
commit ad574c8504
5 changed files with 36 additions and 11 deletions

View File

@@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.259 $ $Date: 2005/10/07 05:23:01 $";
public final static String ID = "$Revision: 1.260 $ $Date: 2005/10/07 15:19:07 $";
public final static String VERSION = "0.6.1.2";
public final static long BUILD = 0;
public final static long BUILD = 1;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@@ -60,6 +60,9 @@ class TCPListener {
_transport = transport;
_pendingSockets = new ArrayList(10);
_handlers = new ArrayList(CONCURRENT_HANDLERS);
_context.statManager().createRateStat("tcp.conReceiveOK", "How long does it take to receive a valid connection", "TCP", new long[] { 60*1000, 5*60*1000, 10*60*1000 });
_context.statManager().createRateStat("tcp.conReceiveFail", "How long does it take to receive a failed connection", "TCP", new long[] { 60*1000, 5*60*1000, 10*60*1000 });
_context.statManager().createRateStat("tcp.conUnhandled", "How often do we receive a connection but take too long on other ones to handle it", "TCP", new long[] { 60*1000, 5*60*1000, 10*60*1000 });
}
/** Make sure we are listening per the transport's config */
@@ -230,6 +233,7 @@ class TCPListener {
removed = _pendingSockets.remove(_cur);
}
if (removed) {
_context.statManager().addRateData("tcp.conUnhandled", 1, 0);
// handlers hadn't taken it yet, so close it
if (_log.shouldLog(Log.WARN))
_log.warn("Closing unhandled socket " + _cur);
@@ -294,7 +298,13 @@ class TCPListener {
ConnectionHandler ch = new ConnectionHandler(_context, _transport, _socket);
TCPConnection con = null;
try {
long before = System.currentTimeMillis();
con = ch.receiveConnection();
long duration = System.currentTimeMillis() - before;
if (con != null)
_context.statManager().addRateData("tcp.conReceiveOK", duration, duration);
else
_context.statManager().addRateData("tcp.conReceiveFail", duration, duration);
} catch (Exception e) {
_log.log(Log.CRIT, "Unhandled exception receiving a connection on " + _socket, e);
}