Update of /cvsroot/freenet/freenet/src/freenet
In directory sc8-pr-cvs1:/tmp/cvs-serv8216/src/freenet
Modified Files:
PeerHandler.java OpenConnectionManager.java
Log Message:
Added per Peer connection successes/attempts info to viewLevel 1 and 2
Index: PeerHandler.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/PeerHandler.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -w -r1.28 -r1.29
--- PeerHandler.java 19 Oct 2003 20:22:24 -0000 1.28
+++ PeerHandler.java 20 Oct 2003 11:22:49 -0000 1.29
@@ -843,6 +843,17 @@
}
}
+ public long getOutboundConnectionAttempts(){
+ return totalOutboundAttempts;
+ }
+
+ public long getOutboundConnectionSuccesses(){
+ return totalOutboundSuccesses;
+ }
+ public float getOutboundConnectionSuccessRatio(){
+ return (float)totalOutboundSuccesses/(float)totalOutboundAttempts;
+ }
+
/**
* @author Iakin
*
@@ -856,9 +867,9 @@
public static final int SENDQUEUE = 4; //DONE
public static final int RECEIVING_COUNT = 5;
public static final int MESSAGES = 6;
- public static final int IDLETIME = 7;
- public static final int LIFETIME = 8;
- public static final int SENDING = 10;
+ public static final int IDLETIME = 7; //DONE
+ public static final int LIFETIME = 8; //DONE
+ //public static final int SENDING = 10;
public static final int ROUTING_ADDRESS = 11; //DONE
public static final int DATASENT = 12;
public static final int RECEIVEQUEUE = 13;
@@ -873,6 +884,9 @@
public static final int QUEUED_MESSAGES = 22; //DONE
public static final int QUEUED_TRAILERMESSAGES = 23; //DONE
public static final int QUEUED_MESSAGES_COMBINED = 24; //DONE
+ public static final int CONNECTION_ATTEMPTS = 25; //DONE
+ public static final int CONNECTION_SUCCESSES = 26; //DONE
+ public static final int CONNECTION_SUCCESS_RATIO = 27; //DONE
private int iCompareMode = UNORDERED;
@@ -997,6 +1011,12 @@
return secondaryCompare(iSign, new
Long(ph1.messagesWithTrailers.size()).compareTo(new
Long(ph2.messagesWithTrailers.size())), ph1, ph2);
case QUEUED_MESSAGES_COMBINED :
return secondaryCompare(iSign, new
Long(ph1.messages.size()+ph1.messagesWithTrailers.size()).compareTo(new
Long(ph2.messages.size()+ph2.messagesWithTrailers.size())), ph1, ph2);
+ case CONNECTION_ATTEMPTS :
+ return secondaryCompare(iSign, new
Long(ph1.totalOutboundAttempts).compareTo(new Long(ph2.totalOutboundAttempts)), ph1,
ph2);
+ case CONNECTION_SUCCESSES :
+ return secondaryCompare(iSign, new
Long(ph1.totalOutboundSuccesses).compareTo(new Long(ph2.totalOutboundSuccesses)), ph1,
ph2);
+ case CONNECTION_SUCCESS_RATIO :
+ return secondaryCompare(iSign, new
Float(ph1.getOutboundConnectionSuccessRatio()).compareTo(new
Float(ph2.getOutboundConnectionSuccessRatio())), ph1, ph2);
default :
return 0;
}
Index: OpenConnectionManager.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/OpenConnectionManager.java,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -w -r1.134 -r1.135
--- OpenConnectionManager.java 20 Oct 2003 10:43:26 -0000 1.134
+++ OpenConnectionManager.java 20 Oct 2003 11:22:50 -0000 1.135
@@ -1711,7 +1711,8 @@
}
protected class PeerHandlerDataSnapshot{
- long
idleTime,lifeTime,nonTrailerMessagesQueued,trailerMessagesQueued,sendQueue,inboundConnectionsCount,outboundConnectionsCount;
+ long
idleTime,lifeTime,nonTrailerMessagesQueued,trailerMessagesQueued,sendQueue,inboundConnectionsCount,outboundConnectionsCount,connectionAttempts,connectionSuccesses;
+ float outboundConnectionSuccessRatio;
String version,address;
Identity identity;
PeerHandlerDataSnapshot(){}
@@ -1724,6 +1725,9 @@
sendQueue = Math.max(sendQueue,other.sendQueue);
inboundConnectionsCount =
Math.max(inboundConnectionsCount,other.inboundConnectionsCount);
outboundConnectionsCount =
Math.max(outboundConnectionsCount,other.outboundConnectionsCount);
+ connectionAttempts =
Math.max(connectionAttempts,other.connectionAttempts);
+ connectionSuccesses =
Math.max(connectionSuccesses,other.connectionSuccesses);
+ outboundConnectionSuccessRatio =
Math.max(outboundConnectionSuccessRatio,other.outboundConnectionSuccessRatio);
}
PeerHandlerDataSnapshot(PeerHandler p)
{
@@ -1737,6 +1741,9 @@
sendQueue = p.queuedBytes();
inboundConnectionsCount =
p.getInboundConnectionsCount();
outboundConnectionsCount =
p.getOutboundConnectionsCount();
+ connectionAttempts = p.getOutboundConnectionAttempts();
+ connectionSuccesses =
p.getOutboundConnectionSuccesses();
+ outboundConnectionSuccessRatio =
p.getOutboundConnectionSuccessRatio();
}
}
protected void doRenderBody(PrintWriter pw, HttpServletRequest req) {
@@ -1774,13 +1781,13 @@
}
pw.println("</TABLE>");
}
- protected float normalize(long value,long max){
+ protected float normalize(float value,float max){
if(max == 0)
return value;
else
- return (float)value/(float)max;
+ return value/max;
}
- protected long calculateBarLength(long value, long max)
+ protected long calculateBarLength(float value, float max)
{
int maxBarWidth = 350;
int minBarLength = 2;
@@ -1882,7 +1889,7 @@
renderPeerHandlerCell(pw,req,"Life
time",lifeTime,"FF9C01",calculateBarLength(p.lifeTime,normalizeTo.lifeTime));
*/
- //Connections
+ //Open Connections
if (viewLevel == 0) {
v1 = new
Value(null,String.valueOf(p.inboundConnectionsCount+p.outboundConnectionsCount),"252597",calculateBarLength(p.inboundConnectionsCount+p.outboundConnectionsCount,normalizeTo.inboundConnectionsCount+normalizeTo.outboundConnectionsCount));
v2 = null;
@@ -1891,6 +1898,16 @@
v2 = new
Value("in",String.valueOf(p.inboundConnectionsCount),"252597",calculateBarLength(p.inboundConnectionsCount,normalizeTo.inboundConnectionsCount));
}
renderPeerHandlerCell(pw,req,"Open connections",v1,v2);
+
+ //Connection Attempts
+ if(viewLevel == 1)
+ renderPeerHandlerCell(pw,req,"Outbound connection
success ratio",new
java.text.DecimalFormat("0.00").format(p.outboundConnectionSuccessRatio),"252597",calculateBarLength(p.outboundConnectionSuccessRatio,normalizeTo.outboundConnectionSuccessRatio));
+ else if (viewLevel > 1) {
+ v1 = new
Value("total",String.valueOf(p.connectionAttempts),"7810D0",calculateBarLength(p.connectionAttempts,normalizeTo.connectionAttempts));
+ v2 = new
Value("successes",String.valueOf(p.connectionSuccesses),"252597",calculateBarLength(p.connectionSuccesses,normalizeTo.connectionSuccesses));
+ renderPeerHandlerCell(pw,req,"Connection
attempts",v1,v2);
+ }
+
pw.println("</TABLE></TD></TR></TABLE>");
}
@@ -1942,6 +1959,13 @@
else{
pw.println(renderSortingLink(req.getRequestURI(),"Outbound
connections",PeerHandler.PeerHandlerComparator.CONNECTIONS_OPEN_OUTBOUND));
pw.println(renderSortingLink(req.getRequestURI(),"Inbound
connections",PeerHandler.PeerHandlerComparator.CONNECTIONS_OPEN_INBOUND));
+ }
+
+ if(viewLevel == 1)
+
pw.println(renderSortingLink(req.getRequestURI(),"Outbound connection success
ratio",PeerHandler.PeerHandlerComparator.CONNECTION_SUCCESS_RATIO));
+ else if (viewLevel > 1) {
+
pw.println(renderSortingLink(req.getRequestURI(),"Outbound connection
attempts",PeerHandler.PeerHandlerComparator.CONNECTION_ATTEMPTS));
+
pw.println(renderSortingLink(req.getRequestURI(),"Outbound connection
successes",PeerHandler.PeerHandlerComparator.CONNECTION_SUCCESSES));
}
pw.println("</TABLE></TD></TR></TABLE>");
}
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs