- LogalizerHandler skips interfaces again

- added LogParser stats to LogStatistics

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3234 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
karlchenofhell 18 years ago
parent 84ae66f0a1
commit 5d540b219e

@ -6,10 +6,12 @@
</head> </head>
<body id="ViewProfile"> <body id="ViewProfile">
#%env/templates/header.template%# #%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"> <form method="get" action="LogStatistics_p.html">
#(results)#::
<fieldset><legend>DHT</legend> <fieldset><legend>DHT</legend>
<fieldset> <fieldset>
<legend>URLs</legend> <legend>URLs</legend>
@ -94,8 +96,8 @@
<dt><span class="tt">Malformed URL Exception</span></dt><dd>#[malformedURLCount]#</dd> <dt><span class="tt">Malformed URL Exception</span></dt><dd>#[malformedURLCount]#</dd>
</dl> </dl>
</fieldset> </fieldset>
#(/results)#
</form> </form>
#(/results)#
#%env/templates/footer.template%# #%env/templates/footer.template%#
</body> </body>

@ -82,6 +82,7 @@ public class LogStatistics_p {
} else { } else {
prop.put("results", 1); prop.put("results", 1);
String[] t; String[] t;
float l;
prop.put(RESULTS + LogParserPLASMA.DHT_DISTANCE_AVERAGE, r.get(LogParserPLASMA.DHT_DISTANCE_AVERAGE)); 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_MAX, r.get(LogParserPLASMA.DHT_DISTANCE_MAX));
prop.put(RESULTS + LogParserPLASMA.DHT_DISTANCE_MIN, r.get(LogParserPLASMA.DHT_DISTANCE_MIN)); 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_TRAFFIC_SENT + "Unit", t[1]);
prop.put(RESULTS + LogParserPLASMA.DHT_URLS_SENT, r.get(LogParserPLASMA.DHT_URLS_SENT)); 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)); 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, t[0]);
prop.put(RESULTS + LogParserPLASMA.DHT_WORDS_SELECTED_TIME + "Unit", t[1]); 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)); 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_RECEIVED_TIME + "Unit", t[1]);
prop.put(RESULTS + LogParserPLASMA.URLS_REQUESTED, r.get(LogParserPLASMA.URLS_REQUESTED)); prop.put(RESULTS + LogParserPLASMA.URLS_REQUESTED, r.get(LogParserPLASMA.URLS_REQUESTED));
prop.put(RESULTS + LogParserPLASMA.WORDS_RECEIVED, r.get(LogParserPLASMA.WORDS_RECEIVED)); 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[] names = ((HashSet)r.get(LogParserPLASMA.DHT_REJECTED_PEERS_NAME)).toArray();
Object[] hashes = ((HashSet)r.get(LogParserPLASMA.DHT_REJECTED_PEERS_HASH)).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 final String[] units = new String[] { "Bytes", "KiloBytes", "MegaBytes", "GigaBytes" };
private static String[] transformTime(long timems) { private static String[] transformTime(long timems) {
if (timems > 1000) timems /= 1000; else return new String[] { Long.toString(timems), MILLISECONDS }; if (timems > 10000) 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 > 180) 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 > 600) 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 > 240) timems /= 24; else return new String[] { Long.toString(timems), HOURS };
return new String[] { Long.toString(timems), DAYS }; return new String[] { Long.toString(timems), DAYS };
} }
@ -186,10 +198,3 @@ public class LogStatistics_p {
return new String[] { Long.toString(mem), units[i] }; return new String[] { Long.toString(mem), units[i] };
} }
} }

@ -89,8 +89,9 @@ public class LogalizerHandler extends Handler {
for (int i=0; i<parserDirFiles.length; i++) { for (int i=0; i<parserDirFiles.length; i++) {
String tmp = parserDirFiles[i].substring(0,parserDirFiles[i].indexOf(".class")); String tmp = parserDirFiles[i].substring(0,parserDirFiles[i].indexOf(".class"));
Class tempClass = Class.forName(logParserPackage+"."+tmp); Class tempClass = Class.forName(logParserPackage+"."+tmp);
if (tempClass.isInterface() && debug) System.out.println(tempClass.getName() + " is an Interface"); if (tempClass.isInterface()) {
else { if (debug) System.out.println(tempClass.getName() + " is an Interface");
} else {
Object theParser = tempClass.newInstance(); Object theParser = tempClass.newInstance();
if (theParser instanceof LogParser) { if (theParser instanceof LogParser) {
LogParser theLogParser = (LogParser) theParser; LogParser theLogParser = (LogParser) theParser;

@ -168,8 +168,11 @@ public class LogParserPLASMA implements LogParser{
/** total time needed for storing the results of an indexing - <strong>Integer</strong> */ /** 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 INDEXED_STORE_TIME = "indexedStorageTime";
public static final String TOTAL_PARSER_TIME = "totalParserTime"; /** accumulated time needed to parse the log entries up to now */
public static final String TOTAL_PARSER_RUNS = "totalParserRuns"; 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; private final double parserVersion = 0.1;

Loading…
Cancel
Save