diff --git a/htroot/Network.html b/htroot/Network.html
index 596864ef5..7444886df 100644
--- a/htroot/Network.html
+++ b/htroot/Network.html
@@ -72,7 +72,7 @@
#[version]# |
#(contact)#passive::direct#(/contact)# |
#[lastSeen]# |
-#[uptime]# |
+#[uptime]# |
#[links]# |
#[words]# |
#(acceptcrawl)#no::yes#(/acceptcrawl)# |
diff --git a/htroot/Network.java b/htroot/Network.java
index 47a340ed3..1e3f7861b 100644
--- a/htroot/Network.java
+++ b/htroot/Network.java
@@ -101,7 +101,7 @@ public class Network {
accActWords += words;
}
prop.put("table_my-version", seed.get("Version", "-"));
- prop.put("table_my-uptime", seed.get("Uptime", "-"));
+ prop.put("table_my-uptime", Status.intervalToString(seed.get("Uptime", "-")));
prop.put("table_my-links", groupDigits(links));
prop.put("table_my-words", groupDigits(words));
prop.put("table_my-acceptcrawl", "" + (seed.getFlagAcceptRemoteCrawl() ? 1 : 0) );
@@ -167,18 +167,9 @@ public class Network {
boolean complete = post.containsKey("ip");
Enumeration e = null;
switch (page) {
- case 1 :
- e = yacyCore.seedDB.seedsSortedConnected(post.get("order", "down").equals("up"), post.get("sort", "LCount"));
- prop.put("table_total", yacyCore.seedDB.sizeConnected());
- break;
- case 2 :
- e = yacyCore.seedDB.seedsSortedDisconnected(post.get("order", "up").equals("up"), post.get("sort", "LastSeen"));
- prop.put("table_total", yacyCore.seedDB.sizeDisconnected());
- break;
- case 3 :
- e = yacyCore.seedDB.seedsSortedPotential(post.get("order", "up").equals("up"), post.get("sort", "LastSeen"));
- prop.put("table_total", yacyCore.seedDB.sizePotential());
- break;
+ case 1 : e = yacyCore.seedDB.seedsSortedConnected(post.get("order", "down").equals("up"), post.get("sort", "LCount")); break;
+ case 2 : e = yacyCore.seedDB.seedsSortedDisconnected(post.get("order", "up").equals("up"), post.get("sort", "LastSeen")); break;
+ case 3 : e = yacyCore.seedDB.seedsSortedPotential(post.get("order", "up").equals("up"), post.get("sort", "LastSeen")); break;
}
while ((e.hasMoreElements()) && (conCount < maxCount)) {
seed = (yacySeed) e.nextElement();
@@ -219,7 +210,7 @@ public class Network {
prop.put("table_list_"+conCount+"_version", seed.get("Version", "-"));
prop.put("table_list_"+conCount+"_contact", (seed.getFlagDirectConnect() ? 1 : 0) );
prop.put("table_list_"+conCount+"_lastSeen", lastSeen(seed.get("LastSeen", "-")) );
- prop.put("table_list_"+conCount+"_uptime", seed.get("Uptime", "-") );
+ prop.put("table_list_"+conCount+"_uptime", Status.intervalToString(seed.get("Uptime", "-")));
prop.put("table_list_"+conCount+"_links", groupDigits(links));
prop.put("table_list_"+conCount+"_words", groupDigits(words));
prop.put("table_list_"+conCount+"_acceptcrawl", (seed.getFlagAcceptRemoteCrawl() ? 1 : 0) );
@@ -237,7 +228,7 @@ public class Network {
prop.put("table_list", conCount);
prop.put("table", 1);
prop.put("table_num", conCount);
- //prop.put("table_total", (maxCount > conCount) ? conCount : maxCount);
+ prop.put("table_total", (maxCount > conCount) ? conCount : maxCount);
prop.put("table_complete", ((complete)? 1 : 0) );
}
}
diff --git a/htroot/Status.html b/htroot/Status.html
index d8ac995e4..48e810d05 100644
--- a/htroot/Status.html
+++ b/htroot/Status.html
@@ -106,6 +106,9 @@ Attention: If you don't have a flatrate or are always-on,
you must switch off the proxy to go off-line.
#(/omode)#
+Memory Usage |
+free: #[freeMemory]# | total: #[totalMemory]# | max: #[maxMemory]#
+ |
diff --git a/htroot/Status.java b/htroot/Status.java
index 29a86f8ed..df039ed35 100644
--- a/htroot/Status.java
+++ b/htroot/Status.java
@@ -43,6 +43,8 @@
// javac -classpath .:../Classes Status.java
// if the shell's current path is HTROOT
+import java.util.Properties;
+
import de.anomic.http.httpHeader;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
@@ -98,7 +100,7 @@ public class Status {
prop.put("peerStatistics", 0);//unknown
} else {
prop.put("peerStatistics", 1);
- prop.put("peerStatistics_uptime", yacyCore.seedDB.mySeed.get("Uptime", "unknown"));
+ prop.put("peerStatistics_uptime", intervalToString(yacyCore.seedDB.mySeed.get("Uptime", "unknown")));
prop.put("peerStatistics_links", yacyCore.seedDB.mySeed.get("LCount", "unknown"));
prop.put("peerStatistics_words", yacyCore.seedDB.mySeed.get("ICount", "unknown"));
prop.put("peerStatistics_juniorConnects", yacyCore.peerActions.juniorConnects);
@@ -164,8 +166,39 @@ public class Status {
prop.put("omode", 2);
}
+ // memory usage
+ Runtime rt = Runtime.getRuntime();
+ prop.put("freeMemory", Long.toString(rt.freeMemory()));
+ prop.put("totalMemory", Long.toString(rt.totalMemory()));
+ prop.put("maxMemory", Long.toString(rt.maxMemory()));
+
// return rewrite properties
return prop;
}
+
+ public static String intervalToString(String minsAsString)
+ {
+ try {
+ long mins = Long.parseLong(minsAsString);
+
+ StringBuilder uptime = new StringBuilder();
+
+ int uptimeDays = (int) (Math.floor(mins/1440));
+ int uptimeHours = (int) (Math.floor(mins/60)%24);
+ int uptimeMins = (int) mins%60;
+
+ uptime.append(uptimeDays)
+ .append(((uptimeDays == 1)?" day ":" days "))
+ .append((uptimeHours < 10)?"0":"")
+ .append(uptimeHours)
+ .append(":")
+ .append((uptimeMins < 10)?"0":"")
+ .append(uptimeMins);
+
+ return uptime.toString();
+ } catch (Exception e) {
+ return "unknown";
+ }
+ }
}