[freenet-cvs] r20960 - branches/db4o/freenet/src/freenet/clients/http

toad at freenetproject.org toad at freenetproject.org
Fri Jul 4 00:09:37 UTC 2008


Author: toad
Date: 2008-07-04 00:09:37 +0000 (Fri, 04 Jul 2008)
New Revision: 20960

Modified:
   branches/db4o/freenet/src/freenet/clients/http/StatisticsToadlet.java
Log:
Show the number of jobs queued at each priority level on the database executor on the stats page in advanced mode.

Modified: branches/db4o/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- branches/db4o/freenet/src/freenet/clients/http/StatisticsToadlet.java	2008-07-04 00:08:50 UTC (rev 20959)
+++ branches/db4o/freenet/src/freenet/clients/http/StatisticsToadlet.java	2008-07-04 00:09:37 UTC (rev 20960)
@@ -307,7 +307,12 @@
 			
 			// rejection reasons box
 			drawRejectReasonsBox(nextTableCell, false);
-			drawRejectReasonsBox(nextTableCell, true);			
+			drawRejectReasonsBox(nextTableCell, true);
+			
+			// database thread jobs box
+			
+			HTMLNode databaseJobsInfobox = nextTableCell.addChild("div", "class", "infobox");
+			drawDatabaseJobsBox(databaseJobsInfobox);
 
 			// peer distribution box
 			overviewTableRow = overviewTable.addChild("tr");
@@ -412,6 +417,24 @@
 		}
 	}
 
+	private void drawDatabaseJobsBox(HTMLNode node) {
+		node.addChild("div", "class", "infobox-header", l10n("databaseJobsByPriority"));
+		HTMLNode threadsInfoboxContent = node.addChild("div", "class", "infobox-content");
+		int[] jobsByPriority = core.clientDatabaseExecutor.runningJobs();
+		
+		HTMLNode threadsByPriorityTable = threadsInfoboxContent.addChild("table", "border", "0");
+		HTMLNode row = threadsByPriorityTable.addChild("tr");
+
+		row.addChild("th", l10n("priority"));
+		row.addChild("th", l10n("waiting"));
+		
+		for(int i=0; i<jobsByPriority.length; i++) {
+			row = threadsByPriorityTable.addChild("tr");
+			row.addChild("td", String.valueOf(i));
+			row.addChild("td", String.valueOf(jobsByPriority[i]));
+		}
+	}
+	
 	private void drawStoreSizeBox(HTMLNode storeSizeInfobox, long nodeUptimeSeconds) {
 		
 		storeSizeInfobox.addChild("div", "class", "infobox-header", "Datastore");




More information about the cvs mailing list