I did a small hack in NodeStatusServlet.java to add a count of total
trials, success rate and Trials /sec. The idea was to get a measure of how
busy my node was.

If GJ likes it he can put it into CVS, I dont have access ;)

--
| Are ?rseth    | elrond at idi.ntnu.no | http://ctemp.dhs.org/ |
| tlf: 73886876 | mob: 410 00548
-------------- next part --------------
*** Freenet/client/http/NodeStatusServlet.java  Thu Dec  6 18:26:51 2001
--- Freenet/client/http/NodeStatusServlet.java  Mon Dec 10 16:36:53 2001
***************
*** 41,46 ****
--- 41,47 ----
   * @author giannij
   **/
  public class NodeStatusServlet extends HttpServlet  {
+       private long firstAccess = -1;

      public void init() {
          ServletContext context = getServletContext();
***************
*** 227,232 ****
--- 229,236 ----
          String date = df.format(new Date(now));
          int backedOffCount = 0;
          int contacted = 0;
+         long trials = 0;
+         long successCount = 0;

          for (int i = 0; i < status.length; i++) {
              if (((status[i].failureIntervals > 0) && (now - 
status[i].lastRetryMs < 15000)) ||
***************
*** 237,244 ****
--- 241,258 ----
              if (status[i].successCount > 0) {
                  contacted++;
              }
+ 
+                       successCount += status[i].successCount;
+               trials += status[i].trials;
          }

+       if (firstAccess == -1) firstAccess = now-1;
+ 
+     float trialsPrSec = (float)trials/((float)(now - firstAccess)/1000);
+     float successPrSec = (float)successCount/((float)(now - 
firstAccess)/1000);
+ 
+     long successRate = (100*successCount)/trials;
+ 
        resp.setStatus(HttpServletResponse.SC_OK);
        resp.setContentType("text/html");
        PrintWriter pw = resp.getWriter();
***************
*** 257,263 ****

          pw.println("Backed off node references: " + backedOffCount +
                     " &nbsp &nbsp (" + ((100*backedOffCount) / status.length) +
!                    "%) <p>");

          pw.println("<form action=\"/noderefs.txt\" method=\"Get\">");
          pw.println("<b>Minimum contact probability:</b> ");
--- 271,281 ----

          pw.println("Backed off node references: " + backedOffCount +
                     " &nbsp &nbsp (" + ((100*backedOffCount) / status.length) +
!                    "%) <br>");
!         pw.println("Total trials: " + trials + " (<font color=\"green\">" + 
successCount + "</font>) <br>");
!         pw.println("Trials/sec: " + trialsPrSec + " (<font color=\"green\">" 
+ successPrSec + "</font>) <br>");
!         pw.println("Success rate: " + successRate + "% <br>");
!         pw.println("<p>");

          pw.println("<form action=\"/noderefs.txt\" method=\"Get\">");
          pw.println("<b>Minimum contact probability:</b> ");

Reply via email to