Author: toad
Date: 2008-02-27 17:44:06 +0000 (Wed, 27 Feb 2008)
New Revision: 18184
Modified:
trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
trunk/freenet/src/freenet/node/FailureTable.java
trunk/freenet/src/freenet/node/NodeStats.java
Log:
Show total bytes sent for sending offered keys.
Report payload for sent keys to the node's payload total.
Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
2008-02-27 17:21:38 UTC (rev 18183)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
2008-02-27 17:44:06 UTC (rev 18184)
@@ -806,6 +806,7 @@
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) }));
+ activityList.addChild("li", l10n("offeredKeyOutput",
"total", SizeUtil.formatSize(node.nodeStats.getOfferedKeysTotalBytesSent(),
true)));
}
}
Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2008-02-27
17:21:38 UTC (rev 18183)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2008-02-27
17:44:06 UTC (rev 18184)
@@ -975,6 +975,7 @@
StatisticsToadlet.jvmVersion=JVM Version: ${version}
StatisticsToadlet.maxMemory=Maximum Java memory: ${memory}
StatisticsToadlet.noRequests=Your node is not processing any requests right
now.
+StatisticsToadlet.offeredKeyOutput=Sending offered keys output (not payload):
${total}
StatisticsToadlet.osArch=OS Architecture: ${arch}
StatisticsToadlet.osName=OS Name: ${name}
StatisticsToadlet.osVersion=OS Version: ${version}
Modified: trunk/freenet/src/freenet/node/FailureTable.java
===================================================================
--- trunk/freenet/src/freenet/node/FailureTable.java 2008-02-27 17:21:38 UTC
(rev 18183)
+++ trunk/freenet/src/freenet/node/FailureTable.java 2008-02-27 17:44:06 UTC
(rev 18184)
@@ -6,6 +6,7 @@
import java.lang.ref.WeakReference;
import java.util.Vector;
+import freenet.io.comm.ByteCounter;
import freenet.io.comm.DMT;
import freenet.io.comm.Message;
import freenet.io.comm.NotConnectedException;
@@ -346,20 +347,20 @@
SSKBlock block = node.fetch((NodeSSK)key, false);
if(block == null) {
// Don't have the key
-
source.sendAsync(DMT.createFNPGetOfferedKeyInvalid(uid,
DMT.GET_OFFERED_KEY_REJECTED_NO_KEY), null, 0, null);
+
source.sendAsync(DMT.createFNPGetOfferedKeyInvalid(uid,
DMT.GET_OFFERED_KEY_REJECTED_NO_KEY), null, 0, senderCounter);
return;
}
Message df = DMT.createFNPSSKDataFound(uid,
block.getRawHeaders(), block.getRawData());
- source.sendAsync(df, null, 0, null);
+ source.sendAsync(df, null, 0, senderCounter);
if(needPubKey) {
Message pk = DMT.createFNPSSKPubKey(uid,
block.getPubKey());
- source.sendAsync(pk, null, 0, null);
+ source.sendAsync(pk, null, 0, senderCounter);
}
} else {
CHKBlock block = node.fetch((NodeCHK)key, false);
if(block == null) {
// Don't have the key
-
source.sendAsync(DMT.createFNPGetOfferedKeyInvalid(uid,
DMT.GET_OFFERED_KEY_REJECTED_NO_KEY), null, 0, null);
+
source.sendAsync(DMT.createFNPGetOfferedKeyInvalid(uid,
DMT.GET_OFFERED_KEY_REJECTED_NO_KEY), null, 0, senderCounter);
return;
}
Message df = DMT.createFNPCHKDataFound(uid,
block.getRawHeaders());
@@ -367,11 +368,30 @@
PartiallyReceivedBlock prb =
new PartiallyReceivedBlock(Node.PACKETS_IN_BLOCK,
Node.PACKET_SIZE, block.getRawData());
BlockTransmitter bt =
- new BlockTransmitter(node.usm, source, uid, prb,
node.outputThrottle, null);
+ new BlockTransmitter(node.usm, source, uid, prb,
node.outputThrottle, senderCounter);
bt.sendAsync(node.executor);
}
}
+ private final OfferedKeysByteCounter senderCounter = new
OfferedKeysByteCounter();
+
+ class OfferedKeysByteCounter implements ByteCounter {
+
+ public void receivedBytes(int x) {
+ node.nodeStats.offeredKeysSenderReceivedBytes(x);
+ }
+
+ public void sentBytes(int x) {
+ node.nodeStats.offeredKeysSenderSentBytes(x);
+ }
+
+ public void sentPayload(int x) {
+ node.sentPayload(x);
+ node.nodeStats.offeredKeysSenderReceivedBytes(-x);
+ }
+
+ }
+
class OfferList {
OfferList(BlockOfferList offerList) {
Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java 2008-02-27 17:21:38 UTC
(rev 18183)
+++ trunk/freenet/src/freenet/node/NodeStats.java 2008-02-27 17:44:06 UTC
(rev 18184)
@@ -1057,6 +1057,8 @@
}
public synchronized void insertSentBytes(boolean ssk, int x) {
+ if(Logger.shouldLog(Logger.DEBUG, this))
+ Logger.debug(this, "insertSentBytes("+ssk+", "+x+")");
if(ssk)
sskInsertSentBytes += x;
else
@@ -1085,5 +1087,24 @@
public long getSSKInsertTotalBytesSent() {
return sskInsertSentBytes;
}
+
+ private long offeredKeysSenderRcvdBytes;
+ private long offeredKeysSenderSentBytes;
+ public synchronized void offeredKeysSenderReceivedBytes(int x) {
+ offeredKeysSenderRcvdBytes += x;
+ }
+
+ public synchronized void offeredKeysSenderSentBytes(int x) {
+ offeredKeysSenderSentBytes += x;
+ }
+
+ public long getOfferedKeysTotalBytesReceived() {
+ return offeredKeysSenderRcvdBytes;
+ }
+
+ public long getOfferedKeysTotalBytesSent() {
+ return offeredKeysSenderSentBytes;
+ }
+
}