*) displaying memory usage of yacy in Status.html

*) displaying more expressive uptime information on Status.html and Network.html

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@214 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 20 years ago
parent 167ddd5612
commit 9af1bf4b38

@ -72,7 +72,7 @@
<td class="small" align="right">#[version]#</td> <td class="small" align="right">#[version]#</td>
<td class="small" align="right">#(contact)#passive::direct#(/contact)#</td> <td class="small" align="right">#(contact)#passive::direct#(/contact)#</td>
<td class="small" align="right">#[lastSeen]#</td> <td class="small" align="right">#[lastSeen]#</td>
<td class="small" align="right">#[uptime]#</td> <td class="small" align="right"><NOBR>#[uptime]#</NOBR></td>
<td class="small" align="right">#[links]#</td> <td class="small" align="right">#[links]#</td>
<td class="small" align="right">#[words]#</td> <td class="small" align="right">#[words]#</td>
<td class="small" align="right">#(acceptcrawl)#no::yes#(/acceptcrawl)#</td> <td class="small" align="right">#(acceptcrawl)#no::yes#(/acceptcrawl)#</td>

@ -101,7 +101,7 @@ public class Network {
accActWords += words; accActWords += words;
} }
prop.put("table_my-version", seed.get("Version", "-")); 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-links", groupDigits(links));
prop.put("table_my-words", groupDigits(words)); prop.put("table_my-words", groupDigits(words));
prop.put("table_my-acceptcrawl", "" + (seed.getFlagAcceptRemoteCrawl() ? 1 : 0) ); prop.put("table_my-acceptcrawl", "" + (seed.getFlagAcceptRemoteCrawl() ? 1 : 0) );
@ -167,18 +167,9 @@ public class Network {
boolean complete = post.containsKey("ip"); boolean complete = post.containsKey("ip");
Enumeration e = null; Enumeration e = null;
switch (page) { switch (page) {
case 1 : case 1 : e = yacyCore.seedDB.seedsSortedConnected(post.get("order", "down").equals("up"), post.get("sort", "LCount")); break;
e = yacyCore.seedDB.seedsSortedConnected(post.get("order", "down").equals("up"), post.get("sort", "LCount")); case 2 : e = yacyCore.seedDB.seedsSortedDisconnected(post.get("order", "up").equals("up"), post.get("sort", "LastSeen")); break;
prop.put("table_total", yacyCore.seedDB.sizeConnected()); case 3 : e = yacyCore.seedDB.seedsSortedPotential(post.get("order", "up").equals("up"), post.get("sort", "LastSeen")); break;
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;
} }
while ((e.hasMoreElements()) && (conCount < maxCount)) { while ((e.hasMoreElements()) && (conCount < maxCount)) {
seed = (yacySeed) e.nextElement(); 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+"_version", seed.get("Version", "-"));
prop.put("table_list_"+conCount+"_contact", (seed.getFlagDirectConnect() ? 1 : 0) ); 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+"_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+"_links", groupDigits(links));
prop.put("table_list_"+conCount+"_words", groupDigits(words)); prop.put("table_list_"+conCount+"_words", groupDigits(words));
prop.put("table_list_"+conCount+"_acceptcrawl", (seed.getFlagAcceptRemoteCrawl() ? 1 : 0) ); 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_list", conCount);
prop.put("table", 1); prop.put("table", 1);
prop.put("table_num", conCount); 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) ); prop.put("table_complete", ((complete)? 1 : 0) );
} }
} }

@ -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. you must switch off the proxy to go off-line.
#(/omode)# #(/omode)#
</td></tr> </td></tr>
<tr class="TableCellDark"><td>Memory Usage</td><td>
free: #[freeMemory]# | total: #[totalMemory]# | max: #[maxMemory]#
</td></tr>
</table> </table>
<!-- </td></tr></table> --> <!-- </td></tr></table> -->
</p> </p>

@ -43,6 +43,8 @@
// javac -classpath .:../Classes Status.java // javac -classpath .:../Classes Status.java
// if the shell's current path is HTROOT // if the shell's current path is HTROOT
import java.util.Properties;
import de.anomic.http.httpHeader; import de.anomic.http.httpHeader;
import de.anomic.server.serverCore; import de.anomic.server.serverCore;
import de.anomic.server.serverObjects; import de.anomic.server.serverObjects;
@ -98,7 +100,7 @@ public class Status {
prop.put("peerStatistics", 0);//unknown prop.put("peerStatistics", 0);//unknown
} else { } else {
prop.put("peerStatistics", 1); 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_links", yacyCore.seedDB.mySeed.get("LCount", "unknown"));
prop.put("peerStatistics_words", yacyCore.seedDB.mySeed.get("ICount", "unknown")); prop.put("peerStatistics_words", yacyCore.seedDB.mySeed.get("ICount", "unknown"));
prop.put("peerStatistics_juniorConnects", yacyCore.peerActions.juniorConnects); prop.put("peerStatistics_juniorConnects", yacyCore.peerActions.juniorConnects);
@ -164,8 +166,39 @@ public class Status {
prop.put("omode", 2); 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 rewrite properties
return prop; 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";
}
}
} }

Loading…
Cancel
Save