diff --git a/htroot/SearchStatistics_p.html b/htroot/SearchStatistics_p.html index baa1ba35e..55ca67989 100644 --- a/htroot/SearchStatistics_p.html +++ b/htroot/SearchStatistics_p.html @@ -57,12 +57,14 @@ Requesting Host Count + Queries Per Last Hour Access Dates #{list}# #[host]# #[count]# + #[qph]# #{dates}##[date]# #{/dates}# #{/list}# @@ -104,6 +106,7 @@ Requesting Host Peer Name Count + Queries Per Last Hour Access Dates #{list}# @@ -111,6 +114,7 @@ #[host]# #[peername]# #[count]# + #[qph]# #{dates}##[date]# #{/dates}# #{/list}# diff --git a/htroot/SearchStatistics_p.java b/htroot/SearchStatistics_p.java index 1a0ba9114..5129e1e04 100644 --- a/htroot/SearchStatistics_p.java +++ b/htroot/SearchStatistics_p.java @@ -106,6 +106,8 @@ public class SearchStatistics_p { dateCount++; } prop.put("page_list_" + entCount + "_dates", dateCount); + int qph = handles.tailSet(new Long(System.currentTimeMillis() - 1000 * 60 * 60)).size(); + prop.put("page_list_" + entCount + "_qph", qph); prop.put("page_list_" + entCount + "_dark", ((dark) ? 1 : 0) ); dark =! dark; prop.put("page_list_" + entCount + "_host", host); diff --git a/htroot/SearchStatistics_p.xml b/htroot/SearchStatistics_p.xml index e4ced47c1..7ed6f8d5a 100644 --- a/htroot/SearchStatistics_p.xml +++ b/htroot/SearchStatistics_p.xml @@ -17,6 +17,7 @@ #{list}# #[host]# #[count]# + #[qph]# #{dates}# #[date]# #{/dates}# @@ -27,7 +28,7 @@ #[host]# #[peername]# #[date]# - #[querycount]# + #[querycount]# #[resultcount]# #[querytime]# #[resulttime]# @@ -36,6 +37,12 @@ :: #{list}# + #[host]# + #[count]# + #[qph]# + #{dates}# + #[date]# + #{/dates}# #{/list}# #(/page)# diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java index 7ab51afe7..148db31c1 100644 --- a/source/de/anomic/plasma/plasmaSwitchboard.java +++ b/source/de/anomic/plasma/plasmaSwitchboard.java @@ -241,7 +241,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser public plasmaDHTFlush transferIdxThread = null; private plasmaDHTChunk dhtTransferChunk = null; public ArrayList localSearches, remoteSearches; // array of search result properties as HashMaps - public HashMap localSearchTracker, remoteSearchTracker; + public HashMap localSearchTracker, remoteSearchTracker; // mappings from requesting host to a TreeSet of Long(access time) public long startupTime = 0; public long lastseedcheckuptime = -1; public long indexedPages = 0; @@ -3028,6 +3028,14 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser } + public static int accessFrequency(HashMap tracker, String host) { + // returns the access frequency in queries per hour for a given host and a specific tracker + long timeInterval = 1000 * 60 * 60; + TreeSet accessSet = (TreeSet) tracker.get(host); + if (accessSet == null) return 0; + return accessSet.tailSet(new Long(System.currentTimeMillis() - timeInterval)).size(); + } + public void startTransferWholeIndex(yacySeed seed, boolean delete) { if (transferIdxThread == null) { this.transferIdxThread = new plasmaDHTFlush(this.log, this.wordIndex, seed, delete,