Skip to content

Commit

Permalink
*) used more switchboard-vars instead of config-vars
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3310 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
auron_x committed Jan 31, 2007
1 parent 4f6eed5 commit 89e7af0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
4 changes: 4 additions & 0 deletions source/de/anomic/plasma/plasmaSwitchboard.java
Expand Up @@ -241,8 +241,12 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
private plasmaDHTChunk dhtTransferChunk = null;
public TreeMap localSearches, remoteSearches;
public HashMap localSearchTracker, remoteSearchTracker;
public long startupTime = 0;
public long lastseedcheckuptime = -1;
public long indexedPages = 0;
public long lastindexedPages = 0;
public double requestedQueries = 0d;
public double lastrequestedQueries = 0d;

/*
* Remote Proxy configuration
Expand Down
20 changes: 10 additions & 10 deletions source/de/anomic/yacy/yacyPeerActions.java
Expand Up @@ -109,21 +109,21 @@ public void updateMySeed() {
seedDB.mySeed.put(yacySeed.PORT, Integer.toString(serverCore.getPortNr(sb.getConfig("port", "8080"))));
}

long uptime = ((System.currentTimeMillis() - sb.getConfigLong("startupTime", 0)) / 1000);
long uptimediff = uptime - sb.getConfigLong("lastseedcheckUptime", 0); //TODO: Do not use the switchboard?
long indexedcdiff = sb.indexedPages - sb.getConfigLong("lastseedcheckIndexedc", 0);
double requestcdiff = sb.requestedQueries - sb.getConfigDouble("lastseedcheckRequestc", 0d);
if (uptimediff > 300 || sb.getConfigLong("lastseedcheckUptime", -1) == -1 ) {
sb.setConfig("lastseedcheckUptime", uptime);
sb.setConfig("lastseedcheckIndexedc", sb.indexedPages);
sb.setConfig("lastseedcheckRequestc", sb.requestedQueries);
long uptime = (System.currentTimeMillis() - sb.startupTime) / 1000;
long uptimediff = uptime - sb.lastseedcheckuptime;
long indexedcdiff = sb.indexedPages - sb.lastindexedPages;
double requestcdiff = sb.requestedQueries - sb.lastrequestedQueries;
if (uptimediff > 300 || sb.lastseedcheckuptime == -1 ) {
sb.lastseedcheckuptime = uptime;
sb.lastindexedPages = sb.indexedPages;
sb.lastrequestedQueries = sb.requestedQueries;
}

//the speed of indexing (pages/minute) of the peer
seedDB.mySeed.put(yacySeed.ISPEED, Long.toString(Math.round(Math.max((float) indexedcdiff, 0f) * 60f / Math.max((float) uptimediff, 1f))));
sb.setConfig("totalPPM", Long.toString(sb.indexedPages * 60 / Math.max(uptime, 1)));
sb.setConfig("totalPPM", sb.indexedPages * 60 / Math.max(uptime, 1));
seedDB.mySeed.put(yacySeed.RSPEED, Long.toString(Math.round(Math.max((float) requestcdiff, 0f) * 60f / Math.max((float) uptimediff, 1f))));
sb.setConfig("totalQPM", Double.toString(sb.requestedQueries * 60d / Math.max((double) uptime, 1d)));
sb.setConfig("totalQPM", sb.requestedQueries * 60d / Math.max((double) uptime, 1d));

seedDB.mySeed.put(yacySeed.UPTIME, Long.toString(uptime/60)); // the number of minutes that the peer is up in minutes/day (moving average MA30)
seedDB.mySeed.put(yacySeed.LCOUNT, Integer.toString(sb.wordIndex.loadedURL.size())); // the number of links that the peer has stored (LURL's)
Expand Down
2 changes: 1 addition & 1 deletion source/yacy.java
Expand Up @@ -308,7 +308,7 @@ private static void startup(String homePath, long startupMemFree, long startupMe
sb.setConfig("vString", combined2prettyVersion(Double.toString(version)));
sb.setConfig("vdate", vDATE);
sb.setConfig("applicationRoot", homePath);
sb.setConfig("startupTime", Long.toString(startup));
sb.startupTime = startup;
serverLog.logConfig("STARTUP", "YACY Version: " + version + ", Built " + vDATE);
yacyCore.latestVersion = version;

Expand Down

0 comments on commit 89e7af0

Please sign in to comment.