fix for negative numbers in network statistic

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6532 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent f8dc1dfabe
commit 57d729e377

@ -78,8 +78,8 @@ public class Banner {
final yacySeed seed = sb.peers.mySeed(); final yacySeed seed = sb.peers.mySeed();
if (seed != null){ if (seed != null){
name = seed.get(yacySeed.NAME, "-").toUpperCase(); name = seed.get(yacySeed.NAME, "-").toUpperCase();
links = Long.parseLong(seed.get(yacySeed.LCOUNT, "0")); links = seed.getLinkCount();
words = Long.parseLong(seed.get(yacySeed.ICOUNT, "0")); words = seed.getWordCount();
myppm = seed.getPPM(); myppm = seed.getPPM();
myqph = 60d * seed.getQPM(); myqph = 60d * seed.getQPM();

@ -97,8 +97,8 @@ public class Network {
long ICount; long ICount;
long RCount; long RCount;
try { try {
LCount = Long.parseLong(seed.get(yacySeed.LCOUNT, "0")); LCount = seed.getLinkCount();
ICount = Long.parseLong(seed.get(yacySeed.ICOUNT, "0")); ICount = seed.getWordCount();
RCount = Long.parseLong(seed.get(yacySeed.RCOUNT, "0")); RCount = Long.parseLong(seed.get(yacySeed.RCOUNT, "0"));
} catch (final Exception e) {LCount = 0; ICount = 0; RCount = 0;} } catch (final Exception e) {LCount = 0; ICount = 0; RCount = 0;}
@ -426,8 +426,8 @@ public class Network {
prop.putNum(STR_TABLE_LIST + conCount + "_lastSeen", /*seed.getLastSeenString() + " " +*/ lastseen); prop.putNum(STR_TABLE_LIST + conCount + "_lastSeen", /*seed.getLastSeenString() + " " +*/ lastseen);
prop.put(STR_TABLE_LIST + conCount + "_utc", seed.get(yacySeed.UTC, "-")); prop.put(STR_TABLE_LIST + conCount + "_utc", seed.get(yacySeed.UTC, "-"));
prop.putHTML(STR_TABLE_LIST + conCount + "_uptime", DateFormatter.formatInterval(60000 * Long.parseLong(seed.get(yacySeed.UPTIME, "0")))); prop.putHTML(STR_TABLE_LIST + conCount + "_uptime", DateFormatter.formatInterval(60000 * Long.parseLong(seed.get(yacySeed.UPTIME, "0"))));
prop.putNum(STR_TABLE_LIST + conCount + "_LCount", seed.getLong(yacySeed.LCOUNT, 0)); prop.putNum(STR_TABLE_LIST + conCount + "_LCount", seed.getLinkCount());
prop.putNum(STR_TABLE_LIST + conCount + "_ICount", seed.getLong(yacySeed.ICOUNT, 0)); prop.putNum(STR_TABLE_LIST + conCount + "_ICount", seed.getWordCount());
prop.putNum(STR_TABLE_LIST + conCount + "_RCount", seed.getLong(yacySeed.RCOUNT, 0)); prop.putNum(STR_TABLE_LIST + conCount + "_RCount", seed.getLong(yacySeed.RCOUNT, 0));
prop.putNum(STR_TABLE_LIST + conCount + "_sI", seed.getLong(yacySeed.INDEX_OUT, 0)); prop.putNum(STR_TABLE_LIST + conCount + "_sI", seed.getLong(yacySeed.INDEX_OUT, 0));
prop.putNum(STR_TABLE_LIST + conCount + "_sU", seed.getLong(yacySeed.URL_OUT, 0)); prop.putNum(STR_TABLE_LIST + conCount + "_sU", seed.getLong(yacySeed.URL_OUT, 0));

@ -191,7 +191,7 @@ public class Status {
prop.putNum("peerStatistics_pagesperminute", sb.peers.mySeed().getPPM()); prop.putNum("peerStatistics_pagesperminute", sb.peers.mySeed().getPPM());
prop.putNum("peerStatistics_queriesperhour", Math.round(6000d * sb.peers.mySeed().getQPM()) / 100d); prop.putNum("peerStatistics_queriesperhour", Math.round(6000d * sb.peers.mySeed().getQPM()) / 100d);
prop.putNum("peerStatistics_links", sb.peers.mySeed().getLinkCount()); prop.putNum("peerStatistics_links", sb.peers.mySeed().getLinkCount());
prop.put("peerStatistics_words", Formatter.number(sb.peers.mySeed().get(yacySeed.ICOUNT, "0"))); prop.put("peerStatistics_words", Formatter.number(sb.peers.mySeed().getWordCount()));
prop.putNum("peerStatistics_disconnects", sb.peers.peerActions.disconnects); prop.putNum("peerStatistics_disconnects", sb.peers.peerActions.disconnects);
prop.put("peerStatistics_connects", Formatter.number(sb.peers.mySeed().get(yacySeed.CCOUNT, "0"))); prop.put("peerStatistics_connects", Formatter.number(sb.peers.mySeed().get(yacySeed.CCOUNT, "0")));
thisHash = sb.peers.mySeed().hash; thisHash = sb.peers.mySeed().hash;

@ -153,15 +153,15 @@ public class Segments implements Iterable<Segment> {
return segment; return segment;
} }
public int URLCount() { public long URLCount() {
int c = 0; long c = 0;
for (Segment s: this.segments.values()) c += s.urlMetadata().size(); for (Segment s: this.segments.values()) c += (long) s.urlMetadata().size();
return c; return c;
} }
public int RWICount() { public long RWICount() {
int c = 0; long c = 0;
for (Segment s: this.segments.values()) c += s.termIndex().sizesMax(); for (Segment s: this.segments.values()) c += (long) s.termIndex().sizesMax();
return c; return c;
} }

@ -2032,10 +2032,10 @@ public final class Switchboard extends serverSwitch {
peers.mySeed().put(yacySeed.RSPEED, Double.toString(totalQPM /*Math.max((float) requestcdiff, 0f) * 60f / Math.max((float) uptimediff, 1f)*/ )); peers.mySeed().put(yacySeed.RSPEED, Double.toString(totalQPM /*Math.max((float) requestcdiff, 0f) * 60f / Math.max((float) uptimediff, 1f)*/ ));
peers.mySeed().put(yacySeed.UPTIME, Long.toString(uptime/60)); // the number of minutes that the peer is up in minutes/day (moving average MA30) peers.mySeed().put(yacySeed.UPTIME, Long.toString(uptime/60)); // the number of minutes that the peer is up in minutes/day (moving average MA30)
peers.mySeed().put(yacySeed.LCOUNT, Integer.toString(indexSegments.URLCount())); // the number of links that the peer has stored (LURL's) peers.mySeed().put(yacySeed.LCOUNT, Long.toString(indexSegments.URLCount())); // the number of links that the peer has stored (LURL's)
peers.mySeed().put(yacySeed.NCOUNT, Integer.toString(crawlQueues.noticeURL.size())); // the number of links that the peer has noticed, but not loaded (NURL's) peers.mySeed().put(yacySeed.NCOUNT, Integer.toString(crawlQueues.noticeURL.size())); // the number of links that the peer has noticed, but not loaded (NURL's)
peers.mySeed().put(yacySeed.RCOUNT, Integer.toString(crawlQueues.noticeURL.stackSize(NoticedURL.STACK_TYPE_LIMIT))); // the number of links that the peer provides for remote crawling (ZURL's) peers.mySeed().put(yacySeed.RCOUNT, Integer.toString(crawlQueues.noticeURL.stackSize(NoticedURL.STACK_TYPE_LIMIT))); // the number of links that the peer provides for remote crawling (ZURL's)
peers.mySeed().put(yacySeed.ICOUNT, Integer.toString(indexSegments.RWICount())); // the minimum number of words that the peer has indexed (as it says) peers.mySeed().put(yacySeed.ICOUNT, Long.toString(indexSegments.RWICount())); // the minimum number of words that the peer has indexed (as it says)
peers.mySeed().put(yacySeed.SCOUNT, Integer.toString(peers.sizeConnected())); // the number of seeds that the peer has stored peers.mySeed().put(yacySeed.SCOUNT, Integer.toString(peers.sizeConnected())); // the number of seeds that the peer has stored
peers.mySeed().put(yacySeed.CCOUNT, Double.toString(((int) ((peers.sizeConnected() + peers.sizeDisconnected() + peers.sizePotential()) * 60.0 / (uptime + 1.01)) * 100) / 100.0)); // the number of clients that the peer connects (as connects/hour) peers.mySeed().put(yacySeed.CCOUNT, Double.toString(((int) ((peers.sizeConnected() + peers.sizeDisconnected() + peers.sizePotential()) * 60.0 / (uptime + 1.01)) * 100) / 100.0)); // the number of clients that the peer connects (as connects/hour)
peers.mySeed().put(yacySeed.VERSION, yacyBuildProperties.getLongVersion()); peers.mySeed().put(yacySeed.VERSION, yacyBuildProperties.getLongVersion());

@ -203,7 +203,7 @@ public class yacySearch extends Thread {
if (seed == null) continue; if (seed == null) continue;
if (!seed.getFlagAcceptRemoteIndex()) continue; // probably a robinson peer if (!seed.getFlagAcceptRemoteIndex()) continue; // probably a robinson peer
score = (int) Math.round(Math.random() * ((c / 3) + 3)); score = (int) Math.round(Math.random() * ((c / 3) + 3));
if (Log.isFine("PLASMA")) Log.logFine("PLASMA", "selectPeers/RWIcount: " + seed.hash + ":" + seed.getName() + ", RWIcount=" + seed.get(yacySeed.ICOUNT,"") + ", score " + score); if (Log.isFine("PLASMA")) Log.logFine("PLASMA", "selectPeers/RWIcount: " + seed.hash + ":" + seed.getName() + ", RWIcount=" + seed.getWordCount() + ", score " + score);
ranking.addScore(seed.hash, score); ranking.addScore(seed.hash, score);
regularSeeds.put(seed.hash, seed); regularSeeds.put(seed.hash, seed);
c--; c--;

@ -605,6 +605,14 @@ public class yacySeed implements Cloneable {
} }
} }
public final long getWordCount() {
try {
return getLong(yacySeed.ICOUNT, 0);
} catch (final NumberFormatException e) {
return 0;
}
}
private boolean getFlag(final int flag) { private boolean getFlag(final int flag) {
final String flags = get(yacySeed.FLAGS, yacySeed.FLAGSZERO); final String flags = get(yacySeed.FLAGS, yacySeed.FLAGSZERO);
return (new bitfield(flags.getBytes())).get(flag); return (new bitfield(flags.getBytes())).get(flag);

Loading…
Cancel
Save