Author: toad
Date: 2008-02-27 16:51:54 +0000 (Wed, 27 Feb 2008)
New Revision: 18178
Modified:
trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
trunk/freenet/src/freenet/node/CHKInsertHandler.java
trunk/freenet/src/freenet/node/CHKInsertSender.java
trunk/freenet/src/freenet/node/NodeStats.java
trunk/freenet/src/freenet/node/RequestHandler.java
trunk/freenet/src/freenet/node/RequestSender.java
trunk/freenet/src/freenet/node/SSKInsertHandler.java
trunk/freenet/src/freenet/node/SSKInsertSender.java
Log:
Track and show (in advanced mode) bytes used by CHK and SSK inserts and
requests other than for sending payload.
Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
2008-02-27 16:36:59 UTC (rev 18177)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
2008-02-27 16:51:54 UTC (rev 18178)
@@ -803,6 +803,10 @@
activityList.addChild("li", l10n("totalInput", new String[] {
"total", "rate" }, new String[] { SizeUtil.formatSize(total[1], true),
SizeUtil.formatSize(total_input_rate, true) }));
activityList.addChild("li", l10n("totalOutput", new String[] {
"total", "rate" }, new String[] { SizeUtil.formatSize(total[0], true),
SizeUtil.formatSize(total_output_rate, true) } ));
activityList.addChild("li", l10n("payloadOutput", new String[]
{ "total", "rate", "percent" }, new String[] {
SizeUtil.formatSize(totalPayload, true),
SizeUtil.formatSize(total_payload_rate, true), Integer.toString(percent) } ));
+ if(isAdvancedModeEnabled) {
+ activityList.addChild("li", l10n("requestOutput", new
String[] { "chk", "ssk" }, new String[] {
SizeUtil.formatSize(node.nodeStats.getCHKRequestTotalBytesSent(), true),
SizeUtil.formatSize(node.nodeStats.getSSKRequestTotalBytesSent(), true) }));
+ activityList.addChild("li", l10n("insertOutput", new
String[] { "chk", "ssk" }, new String[] {
SizeUtil.formatSize(node.nodeStats.getCHKInsertTotalBytesSent(), true),
SizeUtil.formatSize(node.nodeStats.getSSKInsertTotalBytesSent(), true) }));
+ }
}
static HTMLNode drawActivity(HTMLNode activityInfoboxContent, Node
node) {
Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2008-02-27
16:36:59 UTC (rev 18177)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2008-02-27
16:51:54 UTC (rev 18178)
@@ -968,6 +968,7 @@
StatisticsToadlet.fullTitle=Statistics for ${name}
StatisticsToadlet.getLogs=Get latest node's logfile
StatisticsToadlet.inputRate=Input Rate: ${rate}/sec (of ${max})
+StatisticsToadlet.insertOutput=Insert output (excluding payload): CHK ${chk}
SSK ${ssk}.
StatisticsToadlet.jeDumpButton=Generate a JE Dump
StatisticsToadlet.jvmInfoTitle=JVM Info
StatisticsToadlet.jvmVendor=JVM Vendor: ${vendor}
@@ -989,6 +990,7 @@
StatisticsToadlet.priority=Priority
StatisticsToadlet.running=Running
StatisticsToadlet.waiting=Waiting
+StatisticsToadlet.requestOutput=Request output (excluding payload): CHK ${chk}
SSK ${ssk}.
StatisticsToadlet.totalInput=Total Input: ${total} (${rate}/sec)
StatisticsToadlet.totalOutput=Total Output: ${total} (${rate}/sec)
StatisticsToadlet.transferringRequests=Transferring Requests: sending
${senders}, receiving ${receivers}
Modified: trunk/freenet/src/freenet/node/CHKInsertHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/CHKInsertHandler.java 2008-02-27
16:36:59 UTC (rev 18177)
+++ trunk/freenet/src/freenet/node/CHKInsertHandler.java 2008-02-27
16:51:54 UTC (rev 18178)
@@ -456,12 +456,14 @@
synchronized(totalSync) {
totalSentBytes += x;
}
+ node.nodeStats.insertSentBytes(false, x);
}
public void receivedBytes(int x) {
synchronized(totalSync) {
totalReceivedBytes += x;
}
+ node.nodeStats.insertReceivedBytes(false, x);
}
public int getTotalSentBytes() {
@@ -474,6 +476,7 @@
public void sentPayload(int x) {
node.sentPayload(x);
+ node.nodeStats.insertSentBytes(false, -x);
}
public int getPriority() {
Modified: trunk/freenet/src/freenet/node/CHKInsertSender.java
===================================================================
--- trunk/freenet/src/freenet/node/CHKInsertSender.java 2008-02-27 16:36:59 UTC
(rev 18177)
+++ trunk/freenet/src/freenet/node/CHKInsertSender.java 2008-02-27 16:51:54 UTC
(rev 18178)
@@ -830,6 +830,7 @@
synchronized(totalBytesSync) {
totalBytesSent += x;
}
+ node.nodeStats.insertSentBytes(false, x);
}
public int getTotalSentBytes() {
@@ -844,6 +845,7 @@
synchronized(totalBytesSync) {
totalBytesReceived += x;
}
+ node.nodeStats.insertReceivedBytes(false, x);
}
public int getTotalReceivedBytes() {
@@ -854,6 +856,7 @@
public void sentPayload(int x) {
node.sentPayload(x);
+ node.nodeStats.insertSentBytes(false, -x);
}
public boolean failedReceive() {
Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java 2008-02-27 16:36:59 UTC
(rev 18177)
+++ trunk/freenet/src/freenet/node/NodeStats.java 2008-02-27 16:51:54 UTC
(rev 18178)
@@ -1031,5 +1031,59 @@
}
}
}
+
+ /* Total bytes sent by requests, excluding payload */
+ private long chkRequestSentBytes;
+ private long chkRequestRcvdBytes;
+ private long sskRequestSentBytes;
+ private long sskRequestRcvdBytes;
+ private long chkInsertSentBytes;
+ private long chkInsertRcvdBytes;
+ private long sskInsertSentBytes;
+ private long sskInsertRcvdBytes;
+ public synchronized void requestSentBytes(boolean ssk, int x) {
+ if(ssk)
+ sskRequestSentBytes += x;
+ else
+ chkRequestSentBytes += x;
+ }
+
+ public synchronized void requestReceivedBytes(boolean ssk, int x) {
+ if(ssk)
+ sskRequestRcvdBytes += x;
+ else
+ chkRequestRcvdBytes += x;
+ }
+
+ public synchronized void insertSentBytes(boolean ssk, int x) {
+ if(ssk)
+ sskInsertSentBytes += x;
+ else
+ chkInsertSentBytes += x;
+ }
+
+ public synchronized void insertReceivedBytes(boolean ssk, int x) {
+ if(ssk)
+ sskInsertRcvdBytes += x;
+ else
+ chkInsertRcvdBytes += x;
+ }
+
+ public long getCHKRequestTotalBytesSent() {
+ return chkRequestSentBytes;
+ }
+
+ public long getSSKRequestTotalBytesSent() {
+ return sskRequestSentBytes;
+ }
+
+ public long getCHKInsertTotalBytesSent() {
+ return chkInsertSentBytes;
+ }
+
+ public long getSSKInsertTotalBytesSent() {
+ return sskInsertSentBytes;
+ }
+
}
Modified: trunk/freenet/src/freenet/node/RequestHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/RequestHandler.java 2008-02-27 16:36:59 UTC
(rev 18177)
+++ trunk/freenet/src/freenet/node/RequestHandler.java 2008-02-27 16:51:54 UTC
(rev 18178)
@@ -122,7 +122,7 @@
node.nodeStats.successfulChkFetchBytesReceivedAverage.report(rcvd);
}
}
- }
+ }
}
private void realRun() throws NotConnectedException {
@@ -580,16 +580,19 @@
synchronized(bytesSync) {
sentBytes += x;
}
+ node.nodeStats.requestSentBytes(key instanceof NodeSSK, x);
}
public void receivedBytes(int x) {
synchronized(bytesSync) {
receivedBytes += x;
}
+ node.nodeStats.requestReceivedBytes(key instanceof NodeSSK, x);
}
public void sentPayload(int x) {
node.sentPayload(x);
+ node.nodeStats.requestSentBytes(key instanceof NodeSSK, -x);
}
public int getPriority() {
Modified: trunk/freenet/src/freenet/node/RequestSender.java
===================================================================
--- trunk/freenet/src/freenet/node/RequestSender.java 2008-02-27 16:36:59 UTC
(rev 18177)
+++ trunk/freenet/src/freenet/node/RequestSender.java 2008-02-27 16:51:54 UTC
(rev 18178)
@@ -1122,6 +1122,7 @@
synchronized(totalBytesSync) {
totalBytesSent += x;
}
+ node.nodeStats.requestSentBytes(key instanceof NodeSSK, x);
}
public int getTotalSentBytes() {
@@ -1136,6 +1137,7 @@
synchronized(totalBytesSync) {
totalBytesReceived += x;
}
+ node.nodeStats.requestReceivedBytes(key instanceof NodeSSK, x);
}
public int getTotalReceivedBytes() {
@@ -1150,6 +1152,7 @@
public void sentPayload(int x) {
node.sentPayload(x);
+ node.nodeStats.requestSentBytes(key instanceof NodeSSK, -x);
}
private int recentlyFailedTimeLeft;
Modified: trunk/freenet/src/freenet/node/SSKInsertHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/SSKInsertHandler.java 2008-02-27
16:36:59 UTC (rev 18177)
+++ trunk/freenet/src/freenet/node/SSKInsertHandler.java 2008-02-27
16:51:54 UTC (rev 18178)
@@ -327,12 +327,14 @@
synchronized(totalBytesSync) {
totalBytesSent += x;
}
+ node.nodeStats.insertSentBytes(true, x);
}
public void receivedBytes(int x) {
synchronized(totalBytesSync) {
totalBytesReceived += x;
}
+ node.nodeStats.insertReceivedBytes(true, x);
}
public int getTotalSentBytes() {
@@ -345,6 +347,7 @@
public void sentPayload(int x) {
node.sentPayload(x);
+ node.nodeStats.insertSentBytes(true, -x);
}
public int getPriority() {
Modified: trunk/freenet/src/freenet/node/SSKInsertSender.java
===================================================================
--- trunk/freenet/src/freenet/node/SSKInsertSender.java 2008-02-27 16:36:59 UTC
(rev 18177)
+++ trunk/freenet/src/freenet/node/SSKInsertSender.java 2008-02-27 16:51:54 UTC
(rev 18178)
@@ -524,6 +524,7 @@
synchronized(totalBytesSync) {
totalBytesSent += x;
}
+ node.nodeStats.insertSentBytes(true, x);
}
public int getTotalSentBytes() {
@@ -538,6 +539,7 @@
synchronized(totalBytesSync) {
totalBytesReceived += x;
}
+ node.nodeStats.insertReceivedBytes(true, x);
}
public int getTotalReceivedBytes() {
@@ -548,6 +550,7 @@
public void sentPayload(int x) {
node.sentPayload(x);
+ node.nodeStats.insertSentBytes(true, -x);
}
public int getPriority() {