Changeset 95e0492b


Ignore:
Timestamp:
Nov 24, 2009 8:20:30 PM (11 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
105524d9
Parents:
234c084
Message:
  • Profiles: Record successes in the DB fail rate too, so we can calculate a percentage
  • profiles.jsp:
    • Change fail rate from count to percent
    • Hide standard profiles by default
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/ProfileOrganizerRenderer.java

    r234c084 r95e0492b  
    3333        _comparator = new ProfileComparator();
    3434    }
    35     public void renderStatusHTML(Writer out) throws IOException {
     35    public void renderStatusHTML(Writer out, boolean full) throws IOException {
    3636        Set peers = _organizer.selectAllPeers();
    3737       
     
    4141        TreeSet order = new TreeSet(_comparator);
    4242        TreeSet integratedPeers = new TreeSet(_comparator);
     43        int older = 0;
     44        int standard = 0;
    4345        for (Iterator iter = peers.iterator(); iter.hasNext();) {
    4446            Hash peer = (Hash)iter.next();
     
    5254                    integratedPeers.add(prof);
    5355            }
    54             if (prof.getLastSendSuccessful() <= hideBefore) continue;
     56            if (prof.getLastSendSuccessful() <= hideBefore) {
     57                older++;
     58                continue;
     59            }
     60            if ((!full) && !_organizer.isHighCapacity(peer)) {
     61                standard++;
     62                continue;
     63            }
    5564            order.add(prof);
    5665        }
     
    6372        buf.append("<h2>").append(_("Peer Profiles")).append("</h2>\n<p>");
    6473        buf.append(_("Showing {0} recent profiles.", order.size())).append('\n');
    65         buf.append(_("Hiding {0} older profiles.", peers.size()-order.size()));
     74        if (older > 0)
     75            buf.append(_("Hiding {0} older profiles.", older)).append('\n');
     76        if (standard > 0)
     77            buf.append("<a href=\"/profiles.jsp?f=1\">").append(_("Hiding {0} standard profiles.", standard)).append("</a>\n");
    6678        buf.append("</p>");
    6779                   buf.append("<table>");
     
    170182        buf.append("</table>");
    171183
    172         buf.append("<h2>").append(_("Floodfill and Integrated Peers")).append("</h2>\n");
     184        buf.append("<h2><a name=\"flood\"></a>").append(_("Floodfill and Integrated Peers")).append("</h2>\n");
    173185        buf.append("<table>");
    174186        buf.append("<tr>");
     
    232244                    buf.append("<td align=\"right\">").append(_(NA));
    233245            }
     246            buf.append("</tr>\n");
    234247        }
    235248        buf.append("</table>");
     
    325338            RateStat rs = dbh.getFailedLookupRate();
    326339            if (rs == null)
    327                 return _(NA);
     340                return "0%";
    328341            Rate r = rs.getRate(rate);
    329342            if (r == null)
    330                 return _(NA);
     343                return "0%";
    331344            long c = r.getCurrentEventCount() + r.getLastEventCount();
    332             return "" + c;
     345            if (c <= 0)
     346                return "0%";
     347            double avg = 0.5 + 100 * (r.getCurrentTotalValue() + r.getLastTotalValue()) / c;
     348            return ((int) avg) + "%";
    333349    }
    334350
  • apps/routerconsole/java/src/net/i2p/router/web/ProfilesHelper.java

    r234c084 r95e0492b  
    55
    66public class ProfilesHelper extends HelperBase {
     7    private boolean _full;
     8
    79    public ProfilesHelper() {}
    810   
     11    public void setFull(String f) {
     12        _full = f != null;
     13    }
     14
    915    /** @return empty string, writes directly to _out */
    1016    public String getProfileSummary() {
    1117        try {
    1218            ProfileOrganizerRenderer rend = new ProfileOrganizerRenderer(_context.profileOrganizer(), _context);
    13             rend.renderStatusHTML(_out);
     19            rend.renderStatusHTML(_out, _full);
    1420        } catch (IOException ioe) {
    1521            ioe.printStackTrace();
  • apps/routerconsole/jsp/profiles.jsp

    r234c084 r95e0492b  
    1212 <jsp:setProperty name="profilesHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
    1313 <jsp:setProperty name="profilesHelper" property="writer" value="<%=out%>" />
     14 <jsp:setProperty name="profilesHelper" property="full" value="<%=request.getParameter("f")%>" />
    1415 <jsp:getProperty name="profilesHelper" property="profileSummary" />
    1516 <a name="shitlist"> </a><h2><%=intl._("Banned Peers")%></h2>
  • router/java/src/net/i2p/router/peermanager/DBHistory.java

    r234c084 r95e0492b  
    115115    public void lookupSuccessful() {
    116116        _successfulLookups++;
     117        _failedLookupRate.addData(0, 0);
    117118        _lastLookupSuccessful = _context.clock().now();
    118119    }
     
    133134     */
    134135    public void storeSuccessful() {
     136        // Fixme, redefined this to include both lookup and store fails,
     137        // need to fix the javadocs
     138        _failedLookupRate.addData(0, 0);
    135139        _lastStoreSuccessful = _context.clock().now();
    136140    }
Note: See TracChangeset for help on using the changeset viewer.