Skip to content

Commit

Permalink
*) Correcting wrong % values on IndexTransfer_p page
Browse files Browse the repository at this point in the history
  • Loading branch information
theli committed Nov 15, 2005
1 parent e6bf9d9 commit 9b35ae9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 19 deletions.
6 changes: 4 additions & 2 deletions htroot/IndexTransfer_p.html
Expand Up @@ -17,7 +17,7 @@ <h2>Index Transfer</h2>
<tr class="TableHeader" valign="bottom">
<td>&nbsp;</td>
<td class="small" >Status</td>
<td class="small" >Chunk Size</td>
<td class="small" >Chunk Size<br>(Word Entries)</td>
<td class="small" >Words Range</td>
<td class="small" >Transfered Words</td>
<td class="small" >Delete<br>Index</td>
Expand Down Expand Up @@ -55,7 +55,9 @@ <h2>Index Transfer</h2>
<td class="small" ><font color="#(stopped)#green::red#(/stopped)#">#[selection.status]#</font></td>
<td class="small" align="rigth">#[selection.twchunk]# words</td>
<td class="small" align="right"><tt>#[selection.twrange]#</tt></td>
<td class="small" rowspan="2" align="right">#[twcount]# (#[twpercent]#%)<br>#[twspeed]# words/s</td>
<td class="small" rowspan="2" align="left">#[twEntityCount]# Entities (#[twEntityPercent]#%)<br>
#[twEntryCount]# Entries<br>
#[twEntitySpeed]# entities/s</td>
<td class="small" rowspan="2">#(deleteIndex)#false::true#(/deleteIndex)#</td>
<td class="small" rowspan="2">#[peerName]#</td>
<td class="small" rowspan="2">#(stopped)#<input type="submit" name="stopIndexTransfer" value="Stop Index Transfer">::
Expand Down
10 changes: 5 additions & 5 deletions htroot/IndexTransfer_p.java
Expand Up @@ -74,7 +74,7 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
if (seed == null) {
prop.put("running_status","Disconnected peer");
} else {
boolean deleteIndex = ((String)post.get("deleteIndex", "0")).equals("1");
boolean deleteIndex = post.get("deleteIndex", "0").equals("1");
switchboard.indexDistribution.startTransferWholeIndex(seed,deleteIndex);
prop.put("LOCATION","");
return prop;
Expand All @@ -99,7 +99,6 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
prop.put("ucount", Integer.toString(ucount = switchboard.urlPool.loadedURL.size()));
prop.put("running",(transfThread==null)?0:1);
if (transfThread != null) {
int transferedIdxCount = transfThread.getTransferedIndexCount();
String[] status = transfThread.getStatus();
String[] range = transfThread.getRange();
int[] chunk = transfThread.getChunkSize();
Expand All @@ -113,9 +112,10 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
prop.put("running_transfer.twchunk", Integer.toString(chunk[1]));


prop.put("running_twcount",transferedIdxCount);
prop.put("running_twpercent",Float.toString(transfThread.getTransferedIndexPercent()));
prop.put("running_twspeed",Integer.toString(transfThread.getTransferedIndexSpeed()));
prop.put("running_twEntityCount",transfThread.getTransferedEntityCount());
prop.put("running_twEntryCount",transfThread.getTransferedEntryCount());
prop.put("running_twEntityPercent",Float.toString(transfThread.getTransferedEntityPercent()));
prop.put("running_twEntitySpeed",Integer.toString(transfThread.getTransferedEntitySpeed()));

prop.put("running_deleteIndex", transfThread.deleteIndex()?1:0);
prop.put("running_peerName",transfThread.getSeed().getName());
Expand Down
34 changes: 22 additions & 12 deletions source/de/anomic/plasma/plasmaWordIndexDistribution.java
Expand Up @@ -652,10 +652,11 @@ public class transferIndexThread extends Thread {
private boolean gzipBody = false;
private int timeout = 60000;
private int maxOpenFiles = 800;
private int transferedIndexCount = 0;
private int transferedEntryCount = 0;
private int transferedEntityCount = 0;
private String status = "Running";
private String oldStartingPointHash = "------------", startPointHash = "------------";
private int wordsDBSize = 0;
private int initialWordsDBSize = 0;
private int chunkSize = 500;
private final long startingTime = System.currentTimeMillis();
private final plasmaSwitchboard sb;
Expand All @@ -667,7 +668,7 @@ public transferIndexThread(yacySeed seed, boolean delete) {
this.seed = seed;
this.delete = delete;
this.sb = plasmaSwitchboard.getSwitchboard();
this.wordsDBSize = sb.wordIndex.size();
this.initialWordsDBSize = sb.wordIndex.size();
this.gzipBody = "true".equalsIgnoreCase(sb.getConfig("indexTransfer.gzipBody","false"));
this.timeout = (int) sb.getConfigLong("indexTransfer.timeout",60000);
this.maxOpenFiles = (int) sb.getConfigLong("indexTransfer.maxOpenFiles",800);
Expand Down Expand Up @@ -698,17 +699,24 @@ public int[] getChunkSize() {
return new int[]{this.chunkSize,500};
}

public int getTransferedIndexCount() {
return this.transferedIndexCount;
public int getTransferedEntryCount() {
return this.transferedEntryCount;
}

public float getTransferedIndexPercent() {
if (wordsDBSize == 0) return 100;
else return (float)(this.transferedIndexCount*100/wordsDBSize);
public int getTransferedEntityCount() {
return this.transferedEntityCount;
}

public int getTransferedIndexSpeed() {
return (int) ((1000 * transferedIndexCount) / (System.currentTimeMillis()-startingTime));
public float getTransferedEntityPercent() {
long currentWordsDBSize = sb.wordIndex.size();
if (initialWordsDBSize == 0) return 100;
else if (currentWordsDBSize >= initialWordsDBSize) return 0;
//else return (float) ((initialWordsDBSize-currentWordsDBSize)/(initialWordsDBSize/100));
else return (float)(this.transferedEntityCount*100/initialWordsDBSize);
}

public int getTransferedEntitySpeed() {
return (int) ((1000 * transferedEntryCount) / (System.currentTimeMillis()-startingTime));
}

public yacySeed getSeed() {
Expand Down Expand Up @@ -839,7 +847,8 @@ public void performTransferWholeIndex() {
try {
if (deleteTransferIndexes(oldIndexEntities)) {
plasmaWordIndexDistribution.this.log.logFine("Deleted all " + oldIndexEntities.length + " transferred whole-word indexes locally");
transferedIndexCount += idxCount;
transferedEntryCount += idxCount;
transferedEntityCount += oldIndexEntities.length;
} else {
plasmaWordIndexDistribution.this.log.logSevere("Deleted not all transferred whole-word indexes");
}
Expand All @@ -848,7 +857,8 @@ public void performTransferWholeIndex() {
}
} else {
this.closeEntities(oldIndexEntities);
transferedIndexCount += idxCount;
transferedEntryCount += idxCount;
transferedEntityCount += oldIndexEntities.length;
}
oldIndexEntities = null;
}
Expand Down

0 comments on commit 9b35ae9

Please sign in to comment.