Changeset 8a1f02aa
- Timestamp:
- Nov 13, 2015 9:18:21 PM (5 years ago)
- Branches:
- master
- Children:
- e664423
- Parents:
- a028bba
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
apps/routerconsole/java/src/net/i2p/router/web/TunnelRenderer.java
ra028bba r8a1f02aa 82 82 for (int i = 0; i < participating.size(); i++) { 83 83 HopConfig cfg = participating.get(i); 84 longcount = cfg.getProcessedMessagesCount();84 int count = cfg.getProcessedMessagesCount(); 85 85 if (count <= 0) { 86 86 inactive++; 87 87 continue; 88 88 } 89 processed += count; 89 // everything that isn't 'recent' is already in the tunnel.participatingMessageCount stat 90 processed += cfg.getRecentMessagesCount(); 90 91 if (++displayed > DISPLAY_LIMIT) 91 92 continue; … … 112 113 else 113 114 out.write("<td class=\"cells\" align=\"center\">(" + _t("grace period") + ")</td>"); 114 out.write("<td class=\"cells\" align=\"center\">" + c fg.getProcessedMessagesCount()+ " KB</td>");115 out.write("<td class=\"cells\" align=\"center\">" + count + " KB</td>"); 115 116 int lifetime = (int) ((_context.clock().now() - cfg.getCreation()) / 1000); 116 117 if (lifetime <= 0) … … 118 119 if (lifetime > 10*60) 119 120 lifetime = 10*60; 120 int bps = 1024 * c fg.getProcessedMessagesCount()/ lifetime;121 int bps = 1024 * count / lifetime; 121 122 out.write("<td class=\"cells\" align=\"center\">" + bps + " Bps</td>"); 122 123 if (cfg.getSendTo() == null) … … 189 190 out.write("<tr> <td class=\"cells\" align=\"center\"><img src=\"/themes/console/images/outbound.png\" alt=\"Outbound\" title=\"Outbound\"></td>"); 190 191 out.write(" <td class=\"cells\" align=\"center\">" + DataHelper.formatDuration2(timeLeft) + "</td>\n"); 191 out.write(" <td class=\"cells\" align=\"center\">" + info.getProcessedMessagesCount() + " KB</td>\n"); 192 int count = info.getProcessedMessagesCount(); 193 out.write(" <td class=\"cells\" align=\"center\">" + count + " KB</td>\n"); 192 194 for (int j = 0; j < info.getLength(); j++) { 193 195 Hash peer = info.getPeer(j); … … 207 209 208 210 if (info.isInbound()) 209 processedIn += info.getProcessedMessagesCount();210 else 211 processedOut += info.getProcessedMessagesCount();211 processedIn += count; 212 else 213 processedOut += count; 212 214 } 213 215 out.write("</table>\n"); -
history.txt
ra028bba r8a1f02aa 1 2015-11-13 zzz 2 * Console: Fix lifetime participating bandwidth display (ticket #1706) 3 1 4 2015-11-12 zzz 2 5 * Console /configclients: -
router/java/src/net/i2p/router/RouterThrottleImpl.java
ra028bba r8a1f02aa 277 277 // ok, we're not hosed, but can we handle the bandwidth requirements 278 278 // of another tunnel? 279 rs = _context.statManager().getRate("tunnel.participatingMessageCount ");279 rs = _context.statManager().getRate("tunnel.participatingMessageCountAvgPerTunnel"); 280 280 r = null; 281 281 double messagesPerTunnel = DEFAULT_MESSAGES_PER_TUNNEL_ESTIMATE; -
router/java/src/net/i2p/router/RouterVersion.java
ra028bba r8a1f02aa 19 19 public final static String ID = "Monotone"; 20 20 public final static String VERSION = CoreVersion.VERSION; 21 public final static long BUILD = 2 6;21 public final static long BUILD = 27; 22 22 23 23 /** for example "-test" */ -
router/java/src/net/i2p/router/tunnel/HopConfig.java
ra028bba r8a1f02aa 27 27 // these 4 were longs, let's save some space 28 28 // 2 billion * 1KB / 10 minutes = 3 GBps in a single tunnel 29 // we use synchronization instead of an AtomicInteger here to save space 29 30 private int _messagesProcessed; 30 31 private int _oldMessagesProcessed; … … 126 127 * Take note of a message being pumped through this tunnel. 127 128 * "processed" is for incoming and "sent" is for outgoing (could be dropped in between) 129 * We use synchronization instead of an AtomicInteger here to save space. 128 130 */ 129 public void incrementProcessedMessages() { _messagesProcessed++; }131 public synchronized void incrementProcessedMessages() { _messagesProcessed++; } 130 132 131 public int getProcessedMessagesCount() { return _messagesProcessed; }133 public synchronized int getProcessedMessagesCount() { return _messagesProcessed; } 132 134 133 public int getRecentMessagesCount() { 135 /** 136 * This returns the number of processed messages since 137 * the last time getAndResetRecentMessagesCount() was called. 138 * As of 0.9.23, does NOT reset the count, see getAndResetRecentMessagesCount(). 139 */ 140 public synchronized int getRecentMessagesCount() { 141 return _messagesProcessed - _oldMessagesProcessed; 142 } 143 144 /** 145 * This returns the number of processed messages since the last time this was called, 146 * and resets the count. It should only be called by code that updates the router stats. 147 * See TunnelDispatcher.updateParticipatingStats(). 148 * 149 * @since 0.9.23 150 */ 151 synchronized int getAndResetRecentMessagesCount() { 134 152 int rv = _messagesProcessed - _oldMessagesProcessed; 135 153 _oldMessagesProcessed = _messagesProcessed; … … 170 188 171 189 buf.append(" exp. ").append(TunnelCreatorConfig.format(_expiration)); 172 if (_messagesProcessed > 0) 173 buf.append(" used ").append(_messagesProcessed).append("KB"); 190 int messagesProcessed = getProcessedMessagesCount(); 191 if (messagesProcessed > 0) 192 buf.append(" used ").append(messagesProcessed).append("KB"); 174 193 return buf.toString(); 175 194 } -
router/java/src/net/i2p/router/tunnel/TunnelDispatcher.java
ra028bba r8a1f02aa 164 164 "Dropped for exceeding share limit", "Tunnels", 165 165 new long[] { 60*1000l, 60*10*1000l }); 166 // count for console 166 167 ctx.statManager().createRequiredRateStat("tunnel.participatingMessageCount", 167 168 "Number of 1KB participating messages", "Tunnels", 168 169 new long[] { 60*1000l, 60*10*1000l, 60*60*1000l }); 170 // estimate for RouterThrottleImpl 171 ctx.statManager().createRequiredRateStat("tunnel.participatingMessageCountAvgPerTunnel", 172 "Estimate of participating messages per tunnel lifetime", "Tunnels", 173 new long[] { 60*1000l }); 169 174 ctx.statManager().createRateStat("tunnel.ownedMessageCount", 170 175 "How many messages are sent through a tunnel we created (period == failures)?", "Tunnels", … … 712 717 long tooOld = tooYoung - 9*60*1000; 713 718 for (HopConfig cfg : _participatingConfig.values()) { 714 long c = cfg.get RecentMessagesCount();719 long c = cfg.getAndResetRecentMessagesCount(); 715 720 bw += c; 716 721 //bwOut += cfg.getRecentSentMessagesCount(); … … 721 726 count += c; 722 727 } 728 // This is an estimate of the average number of participating messages per tunnel 729 // in a tunnel lifetime, used only by RouterThrottleImpl 730 // 10 minutes / 50 seconds = 12 723 731 if (tcount > 0) 724 count = count * 30 / tcount; 725 _context.statManager().addRateData("tunnel.participatingMessageCount", count, ms); 732 count = count * (10*60*1000 / ms) / tcount; 733 _context.statManager().addRateData("tunnel.participatingMessageCountAvgPerTunnel", count, ms); 734 // This is a straight count of the total participating messages, used in the router console 735 _context.statManager().addRateData("tunnel.participatingMessageCount", bw, ms); 736 // Bandwidth in bits per second 726 737 _context.statManager().addRateData("tunnel.participatingBandwidth", bw*1024/(ms/1000), ms); 727 738 // moved to FIFOBandwidthRefiller
Note: See TracChangeset
for help on using the changeset viewer.