Author: toad
Date: 2008-03-01 23:33:05 +0000 (Sat, 01 Mar 2008)
New Revision: 18311
Modified:
trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
trunk/freenet/src/freenet/node/AnnounceSender.java
trunk/freenet/src/freenet/node/NodeStats.java
Log:
Track and show the total number of bytes used for announcements.
Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
2008-03-01 23:18:27 UTC (rev 18310)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
2008-03-01 23:33:05 UTC (rev 18311)
@@ -813,6 +813,7 @@
activityList.addChild("li", l10n("authBytes", "total",
SizeUtil.formatSize(node.nodeStats.getTotalAuthBytesSent(), true)));
activityList.addChild("li", l10n("resendBytes",
"total", SizeUtil.formatSize(node.nodeStats.getResendBytesSent(), true)));
activityList.addChild("li", l10n("uomBytes", "total",
SizeUtil.formatSize(node.nodeStats.getUOMBytesSent(), true)));
+ activityList.addChild("li", l10n("announceBytes",
"total", SizeUtil.formatSize(node.nodeStats.getAnnounceBytesSent(), true)));
}
}
Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2008-03-01
23:18:27 UTC (rev 18310)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2008-03-01
23:33:05 UTC (rev 18311)
@@ -965,6 +965,7 @@
StatisticsToadlet.activityInserts=Inserts: ${totalSenders} total senders,
${CHKhandlers} CHK handlers, ${SSKhandlers} SSK handlers
StatisticsToadlet.activityRequests=Requests: ${totalSenders} total senders,
${CHKhandlers} CHK handlers, ${SSKhandlers} SSK handlers
StatisticsToadlet.allocMemory=Allocated Java memory: ${memory}
+StatisticsToadlet.announceBytes=Announcement output: ${total}
StatisticsToadlet.authBytes=Connection setup: ${total} output
StatisticsToadlet.bandwidthTitle=Bandwidth
StatisticsToadlet.cpus=Available CPUs: ${count}
Modified: trunk/freenet/src/freenet/node/AnnounceSender.java
===================================================================
--- trunk/freenet/src/freenet/node/AnnounceSender.java 2008-03-01 23:18:27 UTC
(rev 18310)
+++ trunk/freenet/src/freenet/node/AnnounceSender.java 2008-03-01 23:33:05 UTC
(rev 18311)
@@ -502,35 +502,14 @@
om.sendAnnouncementReply(uid, next, ref, this);
}
- private volatile Object totalBytesSync = new Object();
- private int totalBytesSent;
-
public void sentBytes(int x) {
- synchronized(totalBytesSync) {
- totalBytesSent += x;
- }
+ node.nodeStats.announceByteCounter.sentBytes(x);
}
- public int getTotalSentBytes() {
- synchronized(totalBytesSync) {
- return totalBytesSent;
- }
- }
-
- private int totalBytesReceived;
-
public void receivedBytes(int x) {
- synchronized(totalBytesSync) {
- totalBytesReceived += x;
- }
+ node.nodeStats.announceByteCounter.receivedBytes(x);
}
- public int getTotalReceivedBytes() {
- synchronized(totalBytesSync) {
- return totalBytesReceived;
- }
- }
-
public void sentPayload(int x) {
// Doesn't count.
}
Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java 2008-03-01 23:18:27 UTC
(rev 18310)
+++ trunk/freenet/src/freenet/node/NodeStats.java 2008-03-01 23:33:05 UTC
(rev 18311)
@@ -1152,7 +1152,10 @@
}
public void sentPayload(int x) {
- // Ignore
+ Logger.error(this, "Payload sent in
resendByteCounter????", new Exception("error"));
+ synchronized(NodeStats.this) {
+ resendBytesSent += x;
+ }
}
};
@@ -1170,4 +1173,33 @@
public long getUOMBytesSent() {
return uomBytesSent;
}
+
+ // Opennet-related bytes - *not* including bytes sent on requests,
those are accounted towards
+ // the requests' totals.
+
+ private long announceBytesSent;
+
+ public final ByteCounter announceByteCounter = new ByteCounter() {
+
+ public void receivedBytes(int x) {
+ // Ignore
+ }
+
+ public void sentBytes(int x) {
+ synchronized(NodeStats.this) {
+ announceBytesSent += x;
+ }
+ }
+
+ public void sentPayload(int x) {
+ synchronized(NodeStats.this) {
+ announceBytesSent += x;
+ }
+ }
+
+ };
+
+ public long getAnnounceBytesSent() {
+ return announceBytesSent;
+ }
}