[freenet-cvs] r18298 - in trunk/freenet/src/freenet: clients/http l10n node

toad at freenetproject.org toad at freenetproject.org
Sat Mar 1 20:36:29 UTC 2008


Author: toad
Date: 2008-03-01 20:36:28 +0000 (Sat, 01 Mar 2008)
New Revision: 18298

Modified:
   trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
   trunk/freenet/src/freenet/node/KeyTracker.java
   trunk/freenet/src/freenet/node/NodeStats.java
   trunk/freenet/src/freenet/node/PeerNode.java
Log:
Monitor and display the number of bytes used to resend packets.

Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java	2008-03-01 20:23:07 UTC (rev 18297)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java	2008-03-01 20:36:28 UTC (rev 18298)
@@ -811,6 +811,7 @@
 			activityList.addChild("li", l10n("offeredKeyOutput", "total", SizeUtil.formatSize(node.nodeStats.getOfferedKeysTotalBytesSent(), true)));
 			activityList.addChild("li", l10n("swapOutput", "total", SizeUtil.formatSize(node.nodeStats.getSwappingTotalBytesSent(), true)));
 			activityList.addChild("li", l10n("authBytes", "total", SizeUtil.formatSize(node.nodeStats.getTotalAuthBytesSent(), true)));
+			activityList.addChild("li", l10n("resendBytes", "total", SizeUtil.formatSize(node.nodeStats.getResendBytesSent(), true)));
 		}
 	}
 

Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties	2008-03-01 20:23:07 UTC (rev 18297)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties	2008-03-01 20:36:28 UTC (rev 18298)
@@ -994,6 +994,7 @@
 StatisticsToadlet.threads=Running threads: ${running}/${max}
 StatisticsToadlet.threadsByPriority=Threads by priority
 StatisticsToadlet.priority=Priority
+StatisticsToadlet.resendBytes=Resent bytes: ${total}
 StatisticsToadlet.running=Running
 StatisticsToadlet.waiting=Waiting
 StatisticsToadlet.requestOutput=Request output (excluding payload): CHK ${chk} SSK ${ssk}.

Modified: trunk/freenet/src/freenet/node/KeyTracker.java
===================================================================
--- trunk/freenet/src/freenet/node/KeyTracker.java	2008-03-01 20:23:07 UTC (rev 18297)
+++ trunk/freenet/src/freenet/node/KeyTracker.java	2008-03-01 20:36:28 UTC (rev 18298)
@@ -1010,7 +1010,7 @@
             AsyncMessageCallback[] callbacks = element.callbacks;
             // Ignore packet#
             if(logMINOR) Logger.minor(this, "Queueing resend of what was once "+element.packetNumber);
-            messages[i] = new MessageItem(buf, callbacks, true, 0, null, element.priority);
+            messages[i] = new MessageItem(buf, callbacks, true, 0, pn.node.nodeStats.resendByteCounter, element.priority);
         }
         pn.requeueMessageItems(messages, 0, messages.length, true);
         

Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java	2008-03-01 20:23:07 UTC (rev 18297)
+++ trunk/freenet/src/freenet/node/NodeStats.java	2008-03-01 20:36:28 UTC (rev 18298)
@@ -9,6 +9,7 @@
 import freenet.config.InvalidConfigValueException;
 import freenet.config.SubConfig;
 import freenet.crypt.RandomSource;
+import freenet.io.comm.ByteCounter;
 import freenet.io.comm.DMT;
 import freenet.io.comm.IOStatisticCollector;
 import freenet.l10n.L10n;
@@ -1136,4 +1137,28 @@
 		return totalAuthBytesSent;
 	}
 	
+	private long resendBytesSent;
+	
+	public final ByteCounter resendByteCounter = new ByteCounter() {
+
+		public void receivedBytes(int x) {
+			// Ignore
+		}
+
+		public void sentBytes(int x) {
+			synchronized(NodeStats.this) {
+				resendBytesSent += x;
+			}
+		}
+
+		public void sentPayload(int x) {
+			// Ignore
+		}
+		
+	};
+	
+	public long getResendBytesSent() {
+		return resendBytesSent;
+	}
+	
 }

Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java	2008-03-01 20:23:07 UTC (rev 18297)
+++ trunk/freenet/src/freenet/node/PeerNode.java	2008-03-01 20:36:28 UTC (rev 18298)
@@ -2476,7 +2476,7 @@
 				Logger.error(this, "No tracker to resend packet " + item.packetNumber + " on");
 				continue;
 			}
-			MessageItem mi = new MessageItem(item.buf, item.callbacks, true, 0, null, item.priority);
+			MessageItem mi = new MessageItem(item.buf, item.callbacks, true, 0, node.nodeStats.resendByteCounter, item.priority);
 			requeueMessageItems(new MessageItem[]{mi}, 0, 1, true);
 		}
 	}




More information about the cvs mailing list