give the reliability more positive influence so it doesn't go negative so easily

update the peerProfile's CLI to make the resulting stats easier to read
This commit is contained in:
jrandom
2004-07-10 04:15:51 +00:00
committed by zzz
parent 809e12b034
commit 591dfc961e
2 changed files with 15 additions and 11 deletions

View File

@ -2,6 +2,8 @@ package net.i2p.router.peermanager;
import java.io.File;
import java.text.DecimalFormat;
import net.i2p.data.Hash;
import net.i2p.router.RouterContext;
import net.i2p.stat.RateStat;
@ -297,6 +299,8 @@ public class PeerProfile {
*/
public static void main(String args[]) {
RouterContext ctx = new RouterContext(new net.i2p.router.Router());
DecimalFormat fmt = new DecimalFormat("0,000.0");
fmt.setPositivePrefix("+");
ProfilePersistenceHelper helper = new ProfilePersistenceHelper(ctx);
try { Thread.sleep(5*1000); } catch (InterruptedException e) {}
StringBuffer buf = new StringBuffer(1024);
@ -308,9 +312,9 @@ public class PeerProfile {
}
//profile.coallesceStats();
buf.append("Peer " + profile.getPeer().toBase64()
+ ":\t Speed:\t" + profile.calculateSpeed()
+ " Reliability:\t" + profile.calculateReliability()
+ " Integration:\t" + profile.calculateIntegration()
+ ":\t Speed:\t" + fmt.format(profile.calculateSpeed())
+ " Reliability:\t" + fmt.format(profile.calculateReliability())
+ " Integration:\t" + fmt.format(profile.calculateIntegration())
+ " Active?\t" + profile.getIsActive()
+ " Failing?\t" + profile.calculateIsFailing()
+ '\n');

View File

@ -23,10 +23,10 @@ public class ReliabilityCalculator extends Calculator {
return profile.getReliabilityBonus();
long val = 0;
val += profile.getSendSuccessSize().getRate(60*1000).getCurrentEventCount() * 5;
val += profile.getSendSuccessSize().getRate(60*1000).getLastEventCount() * 2;
val += profile.getSendSuccessSize().getRate(60*60*1000).getLastEventCount();
val += profile.getSendSuccessSize().getRate(60*60*1000).getCurrentEventCount();
val += profile.getSendSuccessSize().getRate(60*1000).getCurrentEventCount() * 20;
val += profile.getSendSuccessSize().getRate(60*1000).getLastEventCount() * 10;
val += profile.getSendSuccessSize().getRate(60*60*1000).getLastEventCount() * 1;
val += profile.getSendSuccessSize().getRate(60*60*1000).getCurrentEventCount() * 5;
val += profile.getTunnelCreateResponseTime().getRate(10*60*1000).getLastEventCount() * 5;
val += profile.getTunnelCreateResponseTime().getRate(60*60*1000).getCurrentEventCount();
@ -36,10 +36,10 @@ public class ReliabilityCalculator extends Calculator {
//val -= profile.getSendFailureSize().getRate(60*60*1000).getCurrentEventCount()*2;
//val -= profile.getSendFailureSize().getRate(60*60*1000).getLastEventCount()*2;
val -= profile.getTunnelHistory().getRejectionRate().getRate(60*1000).getCurrentEventCount() * 50;
val -= profile.getTunnelHistory().getRejectionRate().getRate(60*1000).getLastEventCount() * 25;
val -= profile.getTunnelHistory().getRejectionRate().getRate(60*60*1000).getCurrentEventCount() * 5;
val -= profile.getTunnelHistory().getRejectionRate().getRate(60*60*1000).getLastEventCount() * 1;
val -= profile.getTunnelHistory().getRejectionRate().getRate(60*1000).getCurrentEventCount() * 10;
val -= profile.getTunnelHistory().getRejectionRate().getRate(60*1000).getLastEventCount() * 5;
val -= profile.getTunnelHistory().getRejectionRate().getRate(60*60*1000).getCurrentEventCount() * 1;
//val -= profile.getTunnelHistory().getRejectionRate().getRate(60*60*1000).getLastEventCount() * 1;
// penalize them heavily for dropping netDb requests
val -= profile.getDBHistory().getFailedLookupRate().getRate(60*1000).getCurrentEventCount() * 10;