Author: nextgens
Date: 2008-07-26 22:42:59 +0000 (Sat, 26 Jul 2008)
New Revision: 21429
Modified:
trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
trunk/freenet/src/freenet/node/NodeStats.java
trunk/freenet/src/freenet/node/RequestStarter.java
Log:
Add some stats regarding outgoing local requests
Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
2008-07-26 19:13:29 UTC (rev 21428)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
2008-07-26 22:42:59 UTC (rev 21429)
@@ -324,6 +324,9 @@
HTMLNode nodeCircleTable =
nodeCircleInfobox.addChild("div", "class", "infobox-content").addChild("table");
addNodeCircle(nodeCircleTable, myLocation);
+
+ overviewTableRow = overviewTable.addChild("tr");
+ nextTableCell = overviewTableRow.addChild("td",
"class", "first");
// specialisation box
int[] incomingRequestCountArray = new int[1];
int[] incomingRequestLocation =
stats.getIncomingRequestLocation(incomingRequestCountArray);
@@ -335,6 +338,18 @@
HTMLNode nodeSpecialisationTable =
nodeSpecialisationInfobox.addChild("div", "class",
"infobox-content").addChild("table");
addSpecialisation(nodeSpecialisationTable,
myLocation, incomingRequestsCount, incomingRequestLocation);
}
+
+ nextTableCell = overviewTableRow.addChild("td");
+ int[] outgoingLocalRequestCountArray = new int[1];
+ int[] outgoingLocalRequestLocation =
stats.getOutgoingRequestLocation(outgoingLocalRequestCountArray);
+ int outgoingLocalRequestsCount =
outgoingLocalRequestCountArray[0];
+
+ if(outgoingLocalRequestsCount > 0) {
+ HTMLNode nodeSpecialisationInfobox =
nextTableCell.addChild("div", "class", "infobox");
+ nodeSpecialisationInfobox.addChild("div",
"class", "infobox-header",
"Outgoing\u00a0Local\u00a0Request\u00a0Distribution");
+ HTMLNode nodeSpecialisationTable =
nodeSpecialisationInfobox.addChild("div", "class",
"infobox-content").addChild("table");
+ addSpecialisation(nodeSpecialisationTable,
myLocation, outgoingLocalRequestsCount, outgoingLocalRequestLocation);
+ }
}
this.writeHTMLReply(ctx, 200, "OK", pageNode.generate());
Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java 2008-07-26 19:13:29 UTC
(rev 21428)
+++ trunk/freenet/src/freenet/node/NodeStats.java 2008-07-26 22:42:59 UTC
(rev 21429)
@@ -56,6 +56,9 @@
/** Locations of incoming requests */
private final int[] incomingRequestsByLoc = new int[10];
private int incomingRequestsAccounted = 0;
+ /** Locations of outoing requests */
+ private final int[] outgoingLocalRequestByLoc = new int[10];
+ private int outgoingLocalRequestsAccounted = 0;
private final Node node;
private MemoryChecker myMemoryChecker;
@@ -1690,4 +1693,23 @@
return result;
}
+
+ public void reportOutgoingLocalRequestLocation(double loc) {
+ assert((loc > 0) && (loc < 1.0));
+
+ synchronized(outgoingLocalRequestByLoc) {
+
outgoingLocalRequestByLoc[(int)Math.floor(loc*outgoingLocalRequestByLoc.length)]++;
+ outgoingLocalRequestsAccounted++;
+ }
+ }
+
+ public int[] getOutgoingRequestLocation(int[] retval) {
+ int[] result = new int[outgoingLocalRequestByLoc.length];
+ synchronized(outgoingLocalRequestByLoc) {
+ System.arraycopy(outgoingLocalRequestByLoc, 0, result,
0, outgoingLocalRequestByLoc.length);
+ retval[0] = outgoingLocalRequestsAccounted;
+ }
+
+ return result;
+ }
}
Modified: trunk/freenet/src/freenet/node/RequestStarter.java
===================================================================
--- trunk/freenet/src/freenet/node/RequestStarter.java 2008-07-26 19:13:29 UTC
(rev 21428)
+++ trunk/freenet/src/freenet/node/RequestStarter.java 2008-07-26 22:42:59 UTC
(rev 21429)
@@ -254,6 +254,7 @@
public void run() {
try {
freenet.support.Logger.OSThread.logPID(this);
+
stats.reportOutgoingLocalRequestLocation(key.toNormalizedDouble());
if(!req.send(core, sched, keyNum)) {
if(!req.isCancelled())
Logger.error(this, "run() not able to
send a request on "+req);