Update of /cvsroot/freenet/freenet/src/freenet/client/http
In directory sc8-pr-cvs1:/tmp/cvs-serv10299/src/freenet/client/http

Modified Files:
      Tag: ngrouting
        NodeStatusServlet.java 
Log Message:
Track total request time, use it in the NGRouting calculation - we were supposed to do 
this in the first place. Major source of skew for NGRouting corrected, we will see how 
it works in practice...


Index: NodeStatusServlet.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/client/http/NodeStatusServlet.java,v
retrieving revision 1.65.2.7
retrieving revision 1.65.2.8
diff -u -r1.65.2.7 -r1.65.2.8
--- NodeStatusServlet.java      23 Aug 2003 17:15:49 -0000      1.65.2.7
+++ NodeStatusServlet.java      27 Aug 2003 15:54:35 -0000      1.65.2.8
@@ -469,6 +469,8 @@
                } else {
                    sendIndexPage(resp, baseURL);
                }
+           } else if(uri.endsWith("global.bmp")) {
+               sendGlobalGraph(req, resp);
            } else if (uri.endsWith("ocmContents.html")) {
                 sendOcmContents(resp,req);
             } else if (uri.endsWith("diagnostics/index.html")) {
@@ -1096,6 +1098,42 @@
        }
     }
     
+    private void sendGlobalGraph(HttpServletRequest req, 
+                                HttpServletResponse resp) throws IOException {
+       RoutingTable rt = Main.origRT;
+       if(rt instanceof NGRoutingTable) {
+           NGRoutingTable ngrt = (NGRoutingTable)rt;
+           TimeEstimator e = ngrt.getGlobalEstimator();
+           int width = 640;
+           String pwidth = req.getParameter("width");
+           if(pwidth != null) {
+               try {
+                   width = Integer.parseInt(pwidth);
+               } catch (NumberFormatException ex) {
+                   width = 640;
+               }
+           }
+           int height = 200;
+           String pheight = req.getParameter("height");
+           if(pheight != null) {
+               try {
+                   height = Integer.parseInt(pheight);
+               } catch (NumberFormatException ex) {
+                   height = 480;
+               }
+           }
+           String clip = req.getParameter("clippoints");
+           boolean clippoints = true;
+           if(clip != null && 
+              (clip.equalsIgnoreCase("false") || clip.equalsIgnoreCase("no")))
+               clippoints = false;
+           resp.setContentType("image/bmp");
+           e.drawGraphBMP(width, height, clippoints, resp.getOutputStream());
+       } else {
+           resp.sendError(404, "Not an NGRoutingTable");
+       }
+    }
+    
     private void sendStatusPage(HttpServletResponse resp) throws IOException {
         long now = System.currentTimeMillis();
         DateFormat df = DateFormat.getDateTimeInstance();
@@ -1129,8 +1167,11 @@
         makePerTableData(status, tableData, pw);
 
         makeRefDownloadForm(refData, pw);
-
-       pw.println("<p><div align=\"center\"><img 
src=\"/servlet/nodeinfo/internal/rthist/rthist.bmp?length=800&height=50\"></div></p>");
+       
+       if(typeName.equals("freenet.node.rt.CPAlgoRoutingTable"))
+           pw.println("<p><div align=\"center\"><img 
src=\"/servlet/nodeinfo/internal/rthist/rthist.bmp?length=800&height=50\"></div></p>");
+       else
+           pw.println("<p><div align=\"center\"><img src=\"global.bmp\"></div></p>");
        
         pw.println("<p>");
 

_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to