diff --git a/htroot/LogStatistics_p.html b/htroot/LogStatistics_p.html index 5e040f437..4f0456f96 100644 --- a/htroot/LogStatistics_p.html +++ b/htroot/LogStatistics_p.html @@ -9,7 +9,7 @@

Log statistics

#(results)#:: -

Needed #[totalParserTime]# #[totalParserTimeUnit]# to parse #[totalParserRuns]# Entries#(avgExists)#:: (#[avgParserRunsPerSecond]# / sec)#(/avgExists)#

+

Needed #[totalParserTime]# #[totalParserTimeUnit]# to parse #[totalParserRuns]# Entries#(avgExists)#:: (#[avgParserRunsPerMinute]#/sec)#(/avgExists)#

DHT @@ -32,7 +32,7 @@
RWIs blocked:
#[blockedRWISum]#
Total time:
#[rwiTimeSum]# #[rwiTimeSumUnit]#
RWIs selected:
#[DHTSelectionWordsCount]#
-
Selection time:
#[DHTSelectionWordsTimeCount]# #[DHTSelectionWordsTimeCountUnit]#
+
Selection time:
#[DHTSelectionWordsTimeCount]#
diff --git a/htroot/LogStatistics_p.java b/htroot/LogStatistics_p.java index c25fd7693..de6ab56a6 100644 --- a/htroot/LogStatistics_p.java +++ b/htroot/LogStatistics_p.java @@ -81,39 +81,39 @@ public class LogStatistics_p { } else { prop.put("results", 1); String[] t; - double l; + 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)); prop.put(RESULTS + LogParserPLASMA.DHT_REJECTED, r.get(LogParserPLASMA.DHT_REJECTED)); prop.put(RESULTS + LogParserPLASMA.DHT_SELECTED, r.get(LogParserPLASMA.DHT_SELECTED)); prop.put(RESULTS + LogParserPLASMA.DHT_SENT_FAILED, r.get(LogParserPLASMA.DHT_SENT_FAILED)); - t = transformMem(((Long)r.get(LogParserPLASMA.DHT_TRAFFIC_SENT)).longValue() * 1000000); + t = transformMem(((Long)r.get(LogParserPLASMA.DHT_TRAFFIC_SENT)).longValue()); prop.put(RESULTS + LogParserPLASMA.DHT_TRAFFIC_SENT, t[0]); 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() * 1000000000); + 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)); prop.put(RESULTS + LogParserPLASMA.ERROR_CHILD_TWICE_RIGHT, r.get(LogParserPLASMA.ERROR_CHILD_TWICE_RIGHT)); prop.put(RESULTS + LogParserPLASMA.ERROR_MALFORMED_URL, r.get(LogParserPLASMA.ERROR_MALFORMED_URL)); prop.put(RESULTS + LogParserPLASMA.INDEXED_ANCHORS, r.get(LogParserPLASMA.INDEXED_ANCHORS)); - t = transformTime(((Integer)r.get(LogParserPLASMA.INDEXED_INDEX_TIME)).longValue() * 1000000); + t = transformTime(((Integer)r.get(LogParserPLASMA.INDEXED_INDEX_TIME)).longValue()); prop.put(RESULTS + LogParserPLASMA.INDEXED_INDEX_TIME, t[0]); prop.put(RESULTS + LogParserPLASMA.INDEXED_INDEX_TIME + "Unit", t[1]); - t = transformTime(((Integer)r.get(LogParserPLASMA.INDEXED_PARSE_TIME)).longValue() * 1000000); + t = transformTime(((Integer)r.get(LogParserPLASMA.INDEXED_PARSE_TIME)).longValue()); prop.put(RESULTS + LogParserPLASMA.INDEXED_PARSE_TIME, t[0]); prop.put(RESULTS + LogParserPLASMA.INDEXED_PARSE_TIME + "Unit", t[1]); prop.put(RESULTS + LogParserPLASMA.INDEXED_SITES, r.get(LogParserPLASMA.INDEXED_SITES)); t = transformMem(((Integer)r.get(LogParserPLASMA.INDEXED_SITES_SIZE)).longValue()); prop.put(RESULTS + LogParserPLASMA.INDEXED_SITES_SIZE, t[0]); prop.put(RESULTS + LogParserPLASMA.INDEXED_SITES_SIZE + "Unit", t[1]); - t = transformTime(((Integer)r.get(LogParserPLASMA.INDEXED_STACK_TIME)).longValue() * 1000000); + t = transformTime(((Integer)r.get(LogParserPLASMA.INDEXED_STACK_TIME)).longValue()); prop.put(RESULTS + LogParserPLASMA.INDEXED_STACK_TIME, t[0]); prop.put(RESULTS + LogParserPLASMA.INDEXED_STACK_TIME + "Unit", t[1]); - t = transformTime(((Integer)r.get(LogParserPLASMA.INDEXED_STORE_TIME)).longValue() * 1000000); + t = transformTime(((Integer)r.get(LogParserPLASMA.INDEXED_STORE_TIME)).longValue()); prop.put(RESULTS + LogParserPLASMA.INDEXED_STORE_TIME, t[0]); prop.put(RESULTS + LogParserPLASMA.INDEXED_STORE_TIME + "Unit", t[1]); prop.put(RESULTS + LogParserPLASMA.INDEXED_WORDS, r.get(LogParserPLASMA.INDEXED_WORDS)); @@ -121,33 +121,31 @@ public class LogStatistics_p { prop.put(RESULTS + LogParserPLASMA.PEERS_TOO_LESS, r.get(LogParserPLASMA.PEERS_TOO_LESS)); prop.put(RESULTS + LogParserPLASMA.RANKING_DIST, r.get(LogParserPLASMA.RANKING_DIST)); prop.put(RESULTS + LogParserPLASMA.RANKING_DIST_FAILED, r.get(LogParserPLASMA.RANKING_DIST_FAILED)); - t = transformTime(((Integer)r.get(LogParserPLASMA.RANKING_DIST_TIME)).longValue() * 1000000); + t = transformTime(((Integer)r.get(LogParserPLASMA.RANKING_DIST_TIME)).longValue()); prop.put(RESULTS + LogParserPLASMA.RANKING_DIST_TIME, t[0]); prop.put(RESULTS + LogParserPLASMA.RANKING_DIST_TIME + "Unit", t[1]); prop.put(RESULTS + LogParserPLASMA.RWIS_BLOCKED, r.get(LogParserPLASMA.RWIS_BLOCKED)); prop.put(RESULTS + LogParserPLASMA.RWIS_RECEIVED, r.get(LogParserPLASMA.RWIS_RECEIVED)); - t = transformTime(((Long)r.get(LogParserPLASMA.RWIS_RECEIVED_TIME)).longValue() * 1000000); + t = transformTime(((Long)r.get(LogParserPLASMA.RWIS_RECEIVED_TIME)).longValue()); prop.put(RESULTS + LogParserPLASMA.RWIS_RECEIVED_TIME, t[0]); prop.put(RESULTS + LogParserPLASMA.RWIS_RECEIVED_TIME + "Unit", t[1]); prop.put(RESULTS + LogParserPLASMA.URLS_BLOCKED, r.get(LogParserPLASMA.URLS_BLOCKED)); prop.put(RESULTS + LogParserPLASMA.URLS_RECEIVED, r.get(LogParserPLASMA.URLS_RECEIVED)); - t = transformTime(((Long)r.get(LogParserPLASMA.URLS_RECEIVED_TIME)).longValue() * 1000000); + t = transformTime(((Long)r.get(LogParserPLASMA.URLS_RECEIVED_TIME)).longValue()); prop.put(RESULTS + LogParserPLASMA.URLS_RECEIVED_TIME, t[0]); 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)); - t = transformTime((long)(l = ((Long)r.get(LogParserPLASMA.TOTAL_PARSER_TIME)).longValue())); + 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 /= 1000000000D) == 0) { + if ((l /= 1000) == 0) { prop.put(RESULTS + "avgExists", 0); } else { prop.put(RESULTS + "avgExists", 1); - prop.put(RESULTS + "avgExists_avgParserRunsPerSecond", - String.format("%.2f", new Object[] { - new Double(((Integer)r.get(LogParserPLASMA.TOTAL_PARSER_RUNS)).doubleValue() / l) - } )); + prop.put(RESULTS + "avgExists_avgParserRunsPerMinute", (int) (((Integer) r.get(LogParserPLASMA.TOTAL_PARSER_RUNS)).floatValue() / l)); } Object[] names = ((HashSet)r.get(LogParserPLASMA.DHT_REJECTED_PEERS_NAME)).toArray(); @@ -176,8 +174,6 @@ public class LogStatistics_p { } } - private static final String NANOSECONDS = "ns"; - private static final String MICROSECONDS = "\u00B5s"; private static final String MILLISECONDS = "ms"; private static final String SECONDS = "sec"; private static final String MINUTES = "min"; @@ -187,8 +183,6 @@ public class LogStatistics_p { private static final String[] units = new String[] { "Bytes", "KiloBytes", "MegaBytes", "GigaBytes" }; private static String[] transformTime(long timems) { - if (timems > 10000) timems /= 1000; else return new String[] { Long.toString(timems), NANOSECONDS }; - if (timems > 10000) timems /= 1000; else return new String[] { Long.toString(timems), MICROSECONDS }; 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 }; diff --git a/source/de/anomic/server/logging/logParsers/LogParserPLASMA.java b/source/de/anomic/server/logging/logParsers/LogParserPLASMA.java index 13df74095..0ac3ca12e 100644 --- a/source/de/anomic/server/logging/logParsers/LogParserPLASMA.java +++ b/source/de/anomic/server/logging/logParsers/LogParserPLASMA.java @@ -168,7 +168,7 @@ public class LogParserPLASMA implements LogParser{ /** total time needed for storing the results of an indexing - Integer */ public static final String INDEXED_STORE_TIME = "indexedStorageTime"; - /** accumulated time needed to parse the log entries up to now (in ns)*/ + /** accumulated time needed to parse the log entries up to now (in ms)*/ public static final String TOTAL_PARSER_TIME = "totalParserTime"; /** times the parser was called, respectively amount of independant log-lines */ @@ -251,7 +251,7 @@ public class LogParserPLASMA implements LogParser{ private int totalParserRuns = 0; public int parse(String logLevel, String logLine) { - long start = System.nanoTime(); + long start = System.currentTimeMillis(); if (logLevel.equals("INFO")){ m = i1.matcher (logLine); @@ -260,7 +260,7 @@ public class LogParserPLASMA implements LogParser{ urlSum += Integer.parseInt(m.group(1)); urlTimeSum += Integer.parseInt(m.group(2)); blockedURLSum += Integer.parseInt(m.group(3)); - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } @@ -272,7 +272,7 @@ public class LogParserPLASMA implements LogParser{ rwiTimeSum += Integer.parseInt(m.group(3)); urlReqSum += Integer.parseInt(m.group(4)); blockedRWISum += Integer.parseInt(m.group(6)); - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } @@ -284,7 +284,7 @@ public class LogParserPLASMA implements LogParser{ rwiTimeSum += Integer.parseInt(m.group(3)); urlReqSum += Integer.parseInt(m.group(4)); blockedRWISum += Integer.parseInt(m.group(6)); - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } @@ -294,7 +294,7 @@ public class LogParserPLASMA implements LogParser{ DHTSendTraffic += Integer.parseInt(m.group(6)); DHTPeerNames.add(m.group(2)); DHTPeerHashs.add(m.group(3)); - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } @@ -305,7 +305,7 @@ public class LogParserPLASMA implements LogParser{ DHTSendURLs += Integer.parseInt(m.group(3)); DHTPeerNames.add(m.group(4)); DHTPeerHashs.add(m.group(5)); - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } @@ -316,7 +316,7 @@ public class LogParserPLASMA implements LogParser{ maxDHTDist = Math.max(maxDHTDist, Double.parseDouble(m.group(3))); avgDHTDist += Double.parseDouble(m.group(3)); DHTSelectionTargetCount++; - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } @@ -326,14 +326,14 @@ public class LogParserPLASMA implements LogParser{ RWIRejectPeerNames.add(m.group(2)); RWIRejectPeerHashs.add(m.group(1)); RWIRejectCount++; - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } m = i7.matcher (logLine); if (m.find ()) { - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } @@ -342,7 +342,7 @@ public class LogParserPLASMA implements LogParser{ if (m.find ()) { DHTSelectionWordsCount += Double.parseDouble(m.group(1)); DHTSelectionWordsTimeCount += Double.parseDouble(m.group(2)); - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } @@ -351,7 +351,7 @@ public class LogParserPLASMA implements LogParser{ if (m.find ()) { rankingDistributionCount++; rankingDistributionTime += Integer.parseInt(m.group(1)); - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } @@ -359,7 +359,7 @@ public class LogParserPLASMA implements LogParser{ if (m.find ()) { rankingDistributionFailCount++; - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } @@ -367,7 +367,7 @@ public class LogParserPLASMA implements LogParser{ if (m.find ()) { busyPeerCount++; - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } @@ -379,7 +379,7 @@ public class LogParserPLASMA implements LogParser{ m = i13.matcher (logLine); if (m.find ()) { - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } @@ -394,7 +394,7 @@ public class LogParserPLASMA implements LogParser{ indexedParsingTime += Integer.parseInt(m.group(8)); indexedIndexingTime += Integer.parseInt(m.group(9)); indexedStorageTime += Integer.parseInt(m.group(10)); - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } @@ -404,7 +404,7 @@ public class LogParserPLASMA implements LogParser{ if (m.find ()) { notEnoughDHTPeers++; - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } @@ -412,7 +412,7 @@ public class LogParserPLASMA implements LogParser{ if (m.find ()) { failedIndexDistributionCount++; - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } @@ -422,7 +422,7 @@ public class LogParserPLASMA implements LogParser{ if (m.find ()) { if (m.group(1).equals("leftchild")) leftChildTwiceCount++; else if (m.group(1).equals("rightchild")) rightChildTwiceCount++; - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } @@ -430,12 +430,12 @@ public class LogParserPLASMA implements LogParser{ if (m.find ()) { malformedURLCount++; - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return 0; } } - totalParserTime += (System.nanoTime() - start); + totalParserTime += (System.currentTimeMillis() - start); totalParserRuns++; return -1; }