Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

- LogalizerHandler skips interfaces again - added LogParser stats to LogStatistics

karlchenofhell5d540b219e3f
diff --git a/htroot/LogStatistics_p.html b/htroot/LogStatistics_p.html
index e2ee9bb25..4f0456f96 100644
--- a/htroot/LogStatistics_p.html
+++ b/htroot/LogStatistics_p.html
@@ -6,10 +6,12 @@
</head>
<body id="ViewProfile">
#%env/templates/header.template%#
- <h2>Log statistics<!--of the last #[parsedLines]# lines--></h2>
+ <h2>Log statistics</h2>
+
+ #(results)#::
+ <p>Needed #[totalParserTime]# #[totalParserTimeUnit]# to parse #[totalParserRuns]# Entries#(avgExists)#:: (#[avgParserRunsPerMinute]#/sec)#(/avgExists)#</p>
<form method="get" action="LogStatistics_p.html">
- #(results)#::
<fieldset><legend>DHT</legend>
<fieldset>
<legend>URLs</legend>
@@ -94,8 +96,8 @@
<dt><span class="tt">Malformed URL Exception</span></dt><dd>#[malformedURLCount]#</dd>
</dl>
</fieldset>
- #(/results)#
</form>
+ #(/results)#
#%env/templates/footer.template%#
</body>
diff --git a/htroot/LogStatistics_p.java b/htroot/LogStatistics_p.java
index 19471ae4c..e9fbfa5a3 100644
--- a/htroot/LogStatistics_p.java
+++ b/htroot/LogStatistics_p.java
@@ -82,6 +82,7 @@ public class LogStatistics_p {
} else {
prop.put("results", 1);
String[] t;
+ float l;
prop.put(RESULTS + LogParserPLASMA.DHT_DISTANCE_AVERAGE, r.get(LogParserPLASMA.DHT_DISTANCE_AVERAGE));
prop.put(RESULTS + LogParserPLASMA.DHT_DISTANCE_MAX, r.get(LogParserPLASMA.DHT_DISTANCE_MAX));
prop.put(RESULTS + LogParserPLASMA.DHT_DISTANCE_MIN, r.get(LogParserPLASMA.DHT_DISTANCE_MIN));
@@ -93,7 +94,7 @@ public class LogStatistics_p {
prop.put(RESULTS + LogParserPLASMA.DHT_TRAFFIC_SENT + "Unit", t[1]);
prop.put(RESULTS + LogParserPLASMA.DHT_URLS_SENT, r.get(LogParserPLASMA.DHT_URLS_SENT));
prop.put(RESULTS + LogParserPLASMA.DHT_WORDS_SELECTED, r.get(LogParserPLASMA.DHT_WORDS_SELECTED));
- t = transformTime(((Integer)r.get(LogParserPLASMA.DHT_WORDS_SELECTED_TIME)).longValue());
+ t = transformTime(((Integer)r.get(LogParserPLASMA.DHT_WORDS_SELECTED_TIME)).longValue() * 1000L);
prop.put(RESULTS + LogParserPLASMA.DHT_WORDS_SELECTED_TIME, t[0]);
prop.put(RESULTS + LogParserPLASMA.DHT_WORDS_SELECTED_TIME + "Unit", t[1]);
prop.put(RESULTS + LogParserPLASMA.ERROR_CHILD_TWICE_LEFT, r.get(LogParserPLASMA.ERROR_CHILD_TWICE_LEFT));
@@ -136,6 +137,17 @@ public class LogStatistics_p {
prop.put(RESULTS + LogParserPLASMA.URLS_RECEIVED_TIME + "Unit", t[1]);
prop.put(RESULTS + LogParserPLASMA.URLS_REQUESTED, r.get(LogParserPLASMA.URLS_REQUESTED));
prop.put(RESULTS + LogParserPLASMA.WORDS_RECEIVED, r.get(LogParserPLASMA.WORDS_RECEIVED));
+ l = ((Long)r.get(LogParserPLASMA.TOTAL_PARSER_TIME)).floatValue();
+ t = transformTime((long)l);
+ prop.put(RESULTS + LogParserPLASMA.TOTAL_PARSER_TIME, t[0]);
+ prop.put(RESULTS + LogParserPLASMA.TOTAL_PARSER_TIME + "Unit", t[1]);
+ prop.put(RESULTS + LogParserPLASMA.TOTAL_PARSER_RUNS, r.get(LogParserPLASMA.TOTAL_PARSER_RUNS));
+ if ((l /= 1000) == 0) {
+ prop.put(RESULTS + "avgExists", 0);
+ } else {
+ prop.put(RESULTS + "avgExists", 1);
+ prop.put(RESULTS + "avgExists_avgParserRunsPerMinute", ((Integer)r.get(LogParserPLASMA.TOTAL_PARSER_RUNS)).floatValue() / l);
+ }
Object[] names = ((HashSet)r.get(LogParserPLASMA.DHT_REJECTED_PEERS_NAME)).toArray();
Object[] hashes = ((HashSet)r.get(LogParserPLASMA.DHT_REJECTED_PEERS_HASH)).toArray();
@@ -172,10 +184,10 @@ public class LogStatistics_p {
private static final String[] units = new String[] { "Bytes", "KiloBytes", "MegaBytes", "GigaBytes" };
private static String[] transformTime(long timems) {
- if (timems > 1000) timems /= 1000; else return new String[] { Long.toString(timems), MILLISECONDS };
- if (timems > 60) timems /= 60; else return new String[] { Long.toString(timems), SECONDS };
- if (timems > 60) timems /= 60; else return new String[] { Long.toString(timems), MINUTES };
- if (timems > 24) timems /= 24; else return new String[] { Long.toString(timems), HOURS };
+ if (timems > 10000) timems /= 1000; else return new String[] { Long.toString(timems), MILLISECONDS };
+ if (timems > 180) timems /= 60; else return new String[] { Long.toString(timems), SECONDS };
+ if (timems > 600) timems /= 60; else return new String[] { Long.toString(timems), MINUTES };
+ if (timems > 240) timems /= 24; else return new String[] { Long.toString(timems), HOURS };
return new String[] { Long.toString(timems), DAYS };
}
@@ -186,10 +198,3 @@ public class LogStatistics_p {
return new String[] { Long.toString(mem), units[i] };
}
}
-
-
-
-
-
-
-
diff --git a/source/de/anomic/server/logging/LogalizerHandler.java b/source/de/anomic/server/logging/LogalizerHandler.java
index d8c3d5da1..75e73fb15 100644
--- a/source/de/anomic/server/logging/LogalizerHandler.java
+++ b/source/de/anomic/server/logging/LogalizerHandler.java
@@ -89,8 +89,9 @@ public class LogalizerHandler extends Handler {
for (int i=0; i<parserDirFiles.length; i++) {
String tmp = parserDirFiles[i].substring(0,parserDirFiles[i].indexOf(".class"));
Class tempClass = Class.forName(logParserPackage+"."+tmp);
- if (tempClass.isInterface() && debug) System.out.println(tempClass.getName() + " is an Interface");
- else {
+ if (tempClass.isInterface()) {
+ if (debug) System.out.println(tempClass.getName() + " is an Interface");
+ } else {
Object theParser = tempClass.newInstance();
if (theParser instanceof LogParser) {
LogParser theLogParser = (LogParser) theParser;
diff --git a/source/de/anomic/server/logging/logParsers/LogParserPLASMA.java b/source/de/anomic/server/logging/logParsers/LogParserPLASMA.java
index 66ae7395d..e04171f8a 100644
--- a/source/de/anomic/server/logging/logParsers/LogParserPLASMA.java
+++ b/source/de/anomic/server/logging/logParsers/LogParserPLASMA.java
@@ -168,8 +168,11 @@ public class LogParserPLASMA implements LogParser{
/** total time needed for storing the results of an indexing - <strong>Integer</strong> */
public static final String INDEXED_STORE_TIME = "indexedStorageTime";
- public static final String TOTAL_PARSER_TIME = "totalParserTime";
- public static final String TOTAL_PARSER_RUNS = "totalParserRuns";
+ /** accumulated time needed to parse the log entries up to now */
+ public static final String TOTAL_PARSER_TIME = "totalParserTime";
+
+ /** times the parser was called, respectively amount of independant log-lines */
+ public static final String TOTAL_PARSER_RUNS = "totalParserRuns";
private final double parserVersion = 0.1;