refactoring: plasmaSearchProfile -> plasmaSearchTimingProfile

This was made to distiguish this profile from the
(to-be-implemented) plasmaSeachOrderProfile

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1538 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
orbiter 2006-02-04 23:11:31 +00:00
parent 6eef848954
commit eab1805bca
5 changed files with 52 additions and 52 deletions

View File

@ -48,7 +48,7 @@ import java.io.File;
import de.anomic.http.httpHeader;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.plasmaSearchProfile;
import de.anomic.plasma.plasmaSearchTimingProfile;
import de.anomic.plasma.plasmaSearchEvent;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@ -70,14 +70,14 @@ public class PerformanceSearch_p {
if (post.containsKey("submitlocalprofilecustom")) {
// first count percentages
int c = 0;
for (int i = 0; i < plasmaSearchProfile.sequence.length; i++) {
c += post.getInt("searchProcessLocalTime_" + plasmaSearchProfile.sequence[i], 0);
for (int i = 0; i < plasmaSearchTimingProfile.sequence.length; i++) {
c += post.getInt("searchProcessLocalTime_" + plasmaSearchTimingProfile.sequence[i], 0);
}
// if check is ok set new values
if (c == 100) {
for (int i = 0; i < plasmaSearchProfile.sequence.length; i++) {
sb.setConfig("searchProcessLocalTime_" + plasmaSearchProfile.sequence[i], post.get("searchProcessLocalTime_" + plasmaSearchProfile.sequence[i], ""));
sb.setConfig("searchProcessLocalCount_" + plasmaSearchProfile.sequence[i], post.get("searchProcessLocalCount_" + plasmaSearchProfile.sequence[i], ""));
for (int i = 0; i < plasmaSearchTimingProfile.sequence.length; i++) {
sb.setConfig("searchProcessLocalTime_" + plasmaSearchTimingProfile.sequence[i], post.get("searchProcessLocalTime_" + plasmaSearchTimingProfile.sequence[i], ""));
sb.setConfig("searchProcessLocalCount_" + plasmaSearchTimingProfile.sequence[i], post.get("searchProcessLocalCount_" + plasmaSearchTimingProfile.sequence[i], ""));
}
prop.put("submitlocalrespond", 1);
} else {
@ -85,9 +85,9 @@ public class PerformanceSearch_p {
}
}
if (post.containsKey("submitlocalprofiledefault")) {
for (int i = 0; i < plasmaSearchProfile.sequence.length; i++) {
sb.setConfig("searchProcessLocalTime_" + plasmaSearchProfile.sequence[i], (String) defaultSettings.get("searchProcessLocalTime_" + plasmaSearchProfile.sequence[i]));
sb.setConfig("searchProcessLocalCount_" + plasmaSearchProfile.sequence[i], (String) defaultSettings.get("searchProcessLocalCount_" + plasmaSearchProfile.sequence[i]));
for (int i = 0; i < plasmaSearchTimingProfile.sequence.length; i++) {
sb.setConfig("searchProcessLocalTime_" + plasmaSearchTimingProfile.sequence[i], (String) defaultSettings.get("searchProcessLocalTime_" + plasmaSearchTimingProfile.sequence[i]));
sb.setConfig("searchProcessLocalCount_" + plasmaSearchTimingProfile.sequence[i], (String) defaultSettings.get("searchProcessLocalCount_" + plasmaSearchTimingProfile.sequence[i]));
}
prop.put("submitlocalrespond", 2);
}
@ -100,12 +100,12 @@ public class PerformanceSearch_p {
long t;
int c;
char sequence;
if (se != null) for (int i = 0; i < plasmaSearchProfile.sequence.length; i++) {
t = se.getLocalProfile().getYieldTime(plasmaSearchProfile.sequence[i]);
if (se != null) for (int i = 0; i < plasmaSearchTimingProfile.sequence.length; i++) {
t = se.getLocalProfile().getYieldTime(plasmaSearchTimingProfile.sequence[i]);
if (t > 0) time += t;
}
for (int i = 0; i < plasmaSearchProfile.sequence.length; i++) {
sequence = plasmaSearchProfile.sequence[i];
for (int i = 0; i < plasmaSearchTimingProfile.sequence.length; i++) {
sequence = plasmaSearchTimingProfile.sequence[i];
prop.put("searchProcessLocalTime_" + sequence, sb.getConfig("searchProcessLocalTime_" + sequence, ""));
prop.put("searchProcessLocalCount_" + sequence, sb.getConfig("searchProcessLocalCount_" + sequence, ""));
if (se == null) {

View File

@ -65,7 +65,7 @@ public final class plasmaSearchEvent extends Thread implements Runnable {
private plasmaSnippetCache snippetCache;
private plasmaWordIndexEntryContainer rcLocal, rcGlobal; // caches for results
private int rcGlobalCount;
private plasmaSearchProfile profileLocal, profileGlobal;
private plasmaSearchTimingProfile profileLocal, profileGlobal;
private yacySearch[] searchThreads;
public plasmaSearchEvent(plasmaSearchQuery query, serverLog log, plasmaWordIndex wordIndex, plasmaCrawlLURL urlStore, plasmaSnippetCache snippetCache) {
@ -78,10 +78,10 @@ public final class plasmaSearchEvent extends Thread implements Runnable {
this.rcGlobal = new plasmaWordIndexEntryContainer(null);
this.rcGlobalCount = 0;
if (query.domType == plasmaSearchQuery.SEARCHDOM_GLOBALDHT) {
this.profileLocal = new plasmaSearchProfile(4 * query.maximumTime / 10, query.wantedResults);
this.profileGlobal = new plasmaSearchProfile(6 * query.maximumTime / 10, query.wantedResults);
this.profileLocal = new plasmaSearchTimingProfile(4 * query.maximumTime / 10, query.wantedResults);
this.profileGlobal = new plasmaSearchTimingProfile(6 * query.maximumTime / 10, query.wantedResults);
} else {
this.profileLocal = new plasmaSearchProfile(query.maximumTime, query.wantedResults);
this.profileLocal = new plasmaSearchTimingProfile(query.maximumTime, query.wantedResults);
this.profileGlobal = null;
}
this.searchThreads = null;
@ -91,7 +91,7 @@ public final class plasmaSearchEvent extends Thread implements Runnable {
return query;
}
public plasmaSearchProfile getLocalProfile() {
public plasmaSearchTimingProfile getLocalProfile() {
return profileLocal;
}
@ -153,10 +153,10 @@ public final class plasmaSearchEvent extends Thread implements Runnable {
// retrieve entities that belong to the hashes
profileLocal.startTimer();
Set containers = wordIndex.getContainers(query.queryHashes, true, true, profileLocal.getTargetTime(plasmaSearchProfile.PROCESS_COLLECTION));
Set containers = wordIndex.getContainers(query.queryHashes, true, true, profileLocal.getTargetTime(plasmaSearchTimingProfile.PROCESS_COLLECTION));
if (containers.size() < query.size()) containers = null; // prevent that only a subset is returned
profileLocal.setYieldTime(plasmaSearchProfile.PROCESS_COLLECTION);
profileLocal.setYieldCount(plasmaSearchProfile.PROCESS_COLLECTION, (containers == null) ? 0 : containers.size());
profileLocal.setYieldTime(plasmaSearchTimingProfile.PROCESS_COLLECTION);
profileLocal.setYieldCount(plasmaSearchTimingProfile.PROCESS_COLLECTION, (containers == null) ? 0 : containers.size());
// since this is a conjunction we return an empty entity if any word is not known
if (containers == null) {
@ -166,9 +166,9 @@ public final class plasmaSearchEvent extends Thread implements Runnable {
// join the result
profileLocal.startTimer();
rcLocal = plasmaWordIndexEntryContainer.joinContainer(containers, profileLocal.getTargetTime(plasmaSearchProfile.PROCESS_JOIN), query.maxDistance);
profileLocal.setYieldTime(plasmaSearchProfile.PROCESS_JOIN);
profileLocal.setYieldCount(plasmaSearchProfile.PROCESS_JOIN, rcLocal.size());
rcLocal = plasmaWordIndexEntryContainer.joinContainer(containers, profileLocal.getTargetTime(plasmaSearchTimingProfile.PROCESS_JOIN), query.maxDistance);
profileLocal.setYieldTime(plasmaSearchTimingProfile.PROCESS_JOIN);
profileLocal.setYieldCount(plasmaSearchTimingProfile.PROCESS_JOIN, rcLocal.size());
return rcLocal.size();
}
@ -178,7 +178,7 @@ public final class plasmaSearchEvent extends Thread implements Runnable {
// the result of the fetch is then in the rcGlobal
if (fetchpeers < 10) fetchpeers = 10;
log.logFine("STARTING " + fetchpeers + " THREADS TO CATCH EACH " + profileGlobal.getTargetCount(plasmaSearchProfile.PROCESS_POSTSORT) + " URLs WITHIN " + (profileGlobal.duetime() / 1000) + " SECONDS");
log.logFine("STARTING " + fetchpeers + " THREADS TO CATCH EACH " + profileGlobal.getTargetCount(plasmaSearchTimingProfile.PROCESS_POSTSORT) + " URLs WITHIN " + (profileGlobal.duetime() / 1000) + " SECONDS");
long timeout = System.currentTimeMillis() + profileGlobal.duetime() + 4000;
searchThreads = yacySearch.searchHashes(query.queryHashes, query.maxDistance, urlStore, rcGlobal, fetchpeers, plasmaSwitchboard.urlBlacklist, snippetCache, profileGlobal);
@ -186,7 +186,7 @@ public final class plasmaSearchEvent extends Thread implements Runnable {
// wait until wanted delay passed or wanted result appeared
while (System.currentTimeMillis() < timeout) {
// check if all threads have been finished or results so far are enough
if (rcGlobal.size() >= profileGlobal.getTargetCount(plasmaSearchProfile.PROCESS_POSTSORT) * 5) break; // we have enough
if (rcGlobal.size() >= profileGlobal.getTargetCount(plasmaSearchTimingProfile.PROCESS_POSTSORT) * 5) break; // we have enough
if (yacySearch.remainingWaiting(searchThreads) == 0) break; // we cannot expect more
// wait a little time ..
try {Thread.sleep(100);} catch (InterruptedException e) {}
@ -203,14 +203,14 @@ public final class plasmaSearchEvent extends Thread implements Runnable {
searchResult.add(rcLocal);
searchResult.add(rcGlobal);
long preorderTime = profileLocal.getTargetTime(plasmaSearchProfile.PROCESS_PRESORT);
long postorderTime = profileLocal.getTargetTime(plasmaSearchProfile.PROCESS_POSTSORT);
long preorderTime = profileLocal.getTargetTime(plasmaSearchTimingProfile.PROCESS_PRESORT);
long postorderTime = profileLocal.getTargetTime(plasmaSearchTimingProfile.PROCESS_POSTSORT);
profileLocal.startTimer();
plasmaSearchPreOrder preorder = new plasmaSearchPreOrder(query);
preorder.addContainer(searchResult, preorderTime);
profileLocal.setYieldTime(plasmaSearchProfile.PROCESS_PRESORT);
profileLocal.setYieldCount(plasmaSearchProfile.PROCESS_PRESORT, rcLocal.size());
profileLocal.setYieldTime(plasmaSearchTimingProfile.PROCESS_PRESORT);
profileLocal.setYieldCount(plasmaSearchTimingProfile.PROCESS_PRESORT, rcLocal.size());
profileLocal.startTimer();
plasmaSearchResult acc = new plasmaSearchResult(query);
@ -221,7 +221,7 @@ public final class plasmaSearchEvent extends Thread implements Runnable {
plasmaWordIndexEntry entry;
long postorderLimitTime = (postorderTime < 0) ? Long.MAX_VALUE : System.currentTimeMillis() + postorderTime;
plasmaCrawlLURL.Entry page;
int minEntries = profileLocal.getTargetCount(plasmaSearchProfile.PROCESS_POSTSORT);
int minEntries = profileLocal.getTargetCount(plasmaSearchTimingProfile.PROCESS_POSTSORT);
try {
while (preorder.hasNext()) {
if ((acc.sizeFetched() >= minEntries) && (System.currentTimeMillis() >= postorderLimitTime)) break;
@ -238,21 +238,21 @@ public final class plasmaSearchEvent extends Thread implements Runnable {
} catch (kelondroException ee) {
serverLog.logSevere("PLASMA", "Database Failure during plasmaSearch.order: " + ee.getMessage(), ee);
}
profileLocal.setYieldTime(plasmaSearchProfile.PROCESS_URLFETCH);
profileLocal.setYieldCount(plasmaSearchProfile.PROCESS_URLFETCH, acc.sizeFetched());
profileLocal.setYieldTime(plasmaSearchTimingProfile.PROCESS_URLFETCH);
profileLocal.setYieldCount(plasmaSearchTimingProfile.PROCESS_URLFETCH, acc.sizeFetched());
// start postsorting
profileLocal.startTimer();
acc.sortResults();
profileLocal.setYieldTime(plasmaSearchProfile.PROCESS_POSTSORT);
profileLocal.setYieldCount(plasmaSearchProfile.PROCESS_POSTSORT, acc.sizeOrdered());
profileLocal.setYieldTime(plasmaSearchTimingProfile.PROCESS_POSTSORT);
profileLocal.setYieldCount(plasmaSearchTimingProfile.PROCESS_POSTSORT, acc.sizeOrdered());
// apply filter
profileLocal.startTimer();
acc.removeDoubleDom();
//acc.removeRedundant();
profileLocal.setYieldTime(plasmaSearchProfile.PROCESS_FILTER);
profileLocal.setYieldCount(plasmaSearchProfile.PROCESS_FILTER, acc.sizeOrdered());
profileLocal.setYieldTime(plasmaSearchTimingProfile.PROCESS_FILTER);
profileLocal.setYieldCount(plasmaSearchTimingProfile.PROCESS_FILTER, acc.sizeOrdered());
return acc;
}

View File

@ -52,7 +52,7 @@ import java.lang.Cloneable;
* the real obtained timings after a search is performed
*/
public class plasmaSearchProfile implements Cloneable {
public class plasmaSearchTimingProfile implements Cloneable {
// collection:
// time = time to get a RWI out of RAM cache, assortments and WORDS files
@ -102,7 +102,7 @@ public class plasmaSearchProfile implements Cloneable {
private HashMap yieldCount;
private long timer;
private plasmaSearchProfile() {
private plasmaSearchTimingProfile() {
targetTime = new HashMap();
targetCount = new HashMap();
yieldTime = new HashMap();
@ -110,7 +110,7 @@ public class plasmaSearchProfile implements Cloneable {
timer = 0;
}
public plasmaSearchProfile(long time, int count) {
public plasmaSearchTimingProfile(long time, int count) {
this(
3 * time / 12, 10 * count,
1 * time / 12, 10 * count,
@ -122,7 +122,7 @@ public class plasmaSearchProfile implements Cloneable {
);
}
public plasmaSearchProfile(
public plasmaSearchTimingProfile(
long time_collection, int count_collection,
long time_join, int count_join,
long time_presort, int count_presort,
@ -150,7 +150,7 @@ public class plasmaSearchProfile implements Cloneable {
}
public Object clone() {
plasmaSearchProfile p = new plasmaSearchProfile();
plasmaSearchTimingProfile p = new plasmaSearchTimingProfile();
p.targetTime = (HashMap) this.targetTime.clone();
p.targetCount = (HashMap) this.targetCount.clone();
p.yieldTime = (HashMap) this.yieldTime.clone();
@ -158,7 +158,7 @@ public class plasmaSearchProfile implements Cloneable {
return p;
}
public plasmaSearchProfile(String s) {
public plasmaSearchTimingProfile(String s) {
targetTime = new HashMap();
targetCount = new HashMap();
yieldTime = new HashMap();

View File

@ -60,7 +60,7 @@ import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.plasmaWordIndexEntry;
import de.anomic.plasma.plasmaWordIndexEntryContainer;
import de.anomic.plasma.plasmaURLPattern;
import de.anomic.plasma.plasmaSearchProfile;
import de.anomic.plasma.plasmaSearchTimingProfile;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
import de.anomic.server.serverCodings;
@ -357,7 +357,7 @@ public final class yacyClient {
plasmaWordIndexEntryContainer containerCache,
plasmaURLPattern blacklist,
plasmaSnippetCache snippets,
plasmaSearchProfile profile
plasmaSearchTimingProfile profile
) {
// send a search request to peer with remote Hash
// this mainly converts the words into word hashes
@ -399,7 +399,7 @@ public final class yacyClient {
obj.put("myseed", yacyCore.seedDB.mySeed.genSeedStr(key));
obj.put("youare", targetPeer.hash);
obj.put("key", key);
obj.put("count", profile.getTargetCount(plasmaSearchProfile.PROCESS_POSTSORT));
obj.put("count", profile.getTargetCount(plasmaSearchTimingProfile.PROCESS_POSTSORT));
obj.put("resource", ((global) ? "global" : "local"));
obj.put("query", wordhashes);
obj.put("ttl", "0");

View File

@ -52,7 +52,7 @@ import de.anomic.kelondro.kelondroMScoreCluster;
import de.anomic.plasma.plasmaCrawlLURL;
import de.anomic.plasma.plasmaURLPattern;
import de.anomic.plasma.plasmaSnippetCache;
import de.anomic.plasma.plasmaSearchProfile;
import de.anomic.plasma.plasmaSearchTimingProfile;
import de.anomic.plasma.plasmaWordIndexEntryContainer;
import de.anomic.server.logging.serverLog;
@ -67,10 +67,10 @@ public class yacySearch extends Thread {
final private yacySeed targetPeer;
private int links;
private int maxDistance;
final private plasmaSearchProfile profile;
final private plasmaSearchTimingProfile profile;
public yacySearch(Set wordhashes, int maxDistance, boolean global, yacySeed targetPeer,
plasmaCrawlLURL urlManager, plasmaWordIndexEntryContainer containerCache, plasmaURLPattern blacklist, plasmaSnippetCache snippetCache, plasmaSearchProfile profile) {
plasmaCrawlLURL urlManager, plasmaWordIndexEntryContainer containerCache, plasmaURLPattern blacklist, plasmaSnippetCache snippetCache, plasmaSearchTimingProfile profile) {
super("yacySearch_" + targetPeer.getName());
this.wordhashes = wordhashes;
this.global = global;
@ -81,7 +81,7 @@ public class yacySearch extends Thread {
this.targetPeer = targetPeer;
this.links = -1;
this.maxDistance = maxDistance;
this.profile = (plasmaSearchProfile) profile.clone();
this.profile = (plasmaSearchTimingProfile) profile.clone();
}
public void run() {
@ -104,7 +104,7 @@ public class yacySearch extends Thread {
return this.links;
}
public plasmaSearchProfile profile() {
public plasmaSearchTimingProfile profile() {
return this.profile;
}
@ -175,7 +175,7 @@ public class yacySearch extends Thread {
}
public static yacySearch[] searchHashes(Set wordhashes, int maxDist, plasmaCrawlLURL urlManager, plasmaWordIndexEntryContainer containerCache,
int targets, plasmaURLPattern blacklist, plasmaSnippetCache snippetCache, plasmaSearchProfile profile) {
int targets, plasmaURLPattern blacklist, plasmaSnippetCache snippetCache, plasmaSearchTimingProfile profile) {
// check own peer status
if (yacyCore.seedDB.mySeed == null || yacyCore.seedDB.mySeed.getAddress() == null) { return null; }