Changeset 56dc96d


Ignore:
Timestamp:
Jun 1, 2009 7:55:36 PM (11 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
0bc67f5a
Parents:
3ccbf37b
Message:

Report average tx and rx rates, effective in next release

File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/StatisticsManager.java

    r3ccbf37b r56dc96d  
    8888        if (_includePeerRankings) {
    8989            long publishedUptime = _context.router().getUptime();
     90            boolean commentOutIn074 = RouterVersion.VERSION.equals("0.7.3");
    9091            // Don't publish these for first hour
    91             if (publishedUptime > 60*60*1000)
    92                 includeThroughput(stats);
     92            if (publishedUptime > 62*60*1000) {
     93                if (commentOutIn074)
     94                    includeThroughput(stats);
     95                else
     96                    includeAverageThroughput(stats);
     97            }
    9398            //includeRate("router.invalidMessageTime", stats, new long[] { 10*60*1000 });
    9499            //includeRate("router.duplicateMessageId", stats, new long[] { 24*60*60*1000 });
     
    224229    }
    225230
     231    /* report the same data for tx and rx, for enhanced anonymity */
     232    private void includeAverageThroughput(Properties stats) {
     233        RateStat sendRate = _context.statManager().getRate("bw.sendRate");
     234        RateStat recvRate = _context.statManager().getRate("bw.recvRate");
     235        if (sendRate == null || recvRate == null)
     236            return;
     237        Rate s = sendRate.getRate(60*60*1000);
     238        Rate r = recvRate.getRate(60*60*1000);
     239        if (s == null || r == null)
     240            return;
     241        double speed = (s.getAverageValue() + r.getAverageValue()) / 2;
     242        double max = Math.max(s.getExtremeAverageValue(), r.getExtremeAverageValue());
     243        String str = num(speed) + ';' + num(max) + ";0;0;";
     244        stats.setProperty("stat_bandwidthSendBps.60m", str);
     245        stats.setProperty("stat_bandwidthReceiveBps.60m", str);
     246    }
     247
    226248    private void includeThroughput(Properties stats) {
    227249        RateStat sendRate = _context.statManager().getRate("bw.sendRate");
    228250        if (sendRate != null) {
    229             /****
    230             if (_context.router().getUptime() > 5*60*1000) {
    231                 Rate r = sendRate.getRate(5*60*1000);
    232                 if (r != null)
    233                     stats.setProperty("stat_bandwidthSendBps.5m", num(r.getAverageValue()) + ';' + num(r.getExtremeAverageValue()) + ";0;0;");
    234             }
    235             ****/
    236251            if (_context.router().getUptime() > 60*60*1000) {
    237252                Rate r = sendRate.getRate(60*60*1000);
     
    243258        RateStat recvRate = _context.statManager().getRate("bw.recvRate");
    244259        if (recvRate != null) {
    245             /****
    246             if (_context.router().getUptime() > 5*60*1000) {
    247                 Rate r = recvRate.getRate(5*60*1000);
    248                 if (r != null)
    249                     stats.setProperty("stat_bandwidthReceiveBps.5m", num(r.getAverageValue()) + ';' + num(r.getExtremeAverageValue()) + ";0;0;");
    250             }
    251             ****/
    252260            if (_context.router().getUptime() > 60*60*1000) {
    253261                Rate r = recvRate.getRate(60*60*1000);
Note: See TracChangeset for help on using the changeset viewer.