Package freenet.support

Examples of freenet.support.HTMLNode


  private void addNodeCircle (HTMLNode circleTable, double myLocation) {
    int[] histogram = new int[HISTOGRAM_LENGTH];
    for (int i = 0; i < HISTOGRAM_LENGTH; i++) {
      histogram[i] = 0;
    }
    HTMLNode nodeCircleTableRow = circleTable.addChild("tr");
    HTMLNode nodeHistogramLegendTableRow = circleTable.addChild("tr");
    HTMLNode nodeHistogramGraphTableRow = circleTable.addChild("tr");
    HTMLNode nodeCircleTableCell = nodeCircleTableRow.addChild("td", new String[] { "class", "colspan" }, new String[] {"first", "10"});
    HTMLNode nodeHistogramLegendCell;
    HTMLNode nodeHistogramGraphCell;
    HTMLNode nodeCircleInfoboxContent = nodeCircleTableCell.addChild("div", new String[] { "style", "class" }, new String[] {"position: relative; height: " + ((PEER_CIRCLE_RADIUS + PEER_CIRCLE_ADDITIONAL_FREE_SPACE) * 2) + "px; width: " + ((PEER_CIRCLE_RADIUS + PEER_CIRCLE_ADDITIONAL_FREE_SPACE) * 2) + "px", "peercircle" });
    nodeCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0, false, 1.0),   "mark" }, "|");
    nodeCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.125, false, 1.0), "mark" }, "+");
    nodeCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.25, false, 1.0)"mark" }, "--");
    nodeCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.375, false, 1.0), "mark" }, "+");
    nodeCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.5, false, 1.0),   "mark" }, "|");
    nodeCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.625, false, 1.0), "mark" }, "+");
    nodeCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.75, false, 1.0)"mark" }, "--");
    nodeCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.875, false, 1.0), "mark" }, "+");
    nodeCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { "position: absolute; top: " + PEER_CIRCLE_RADIUS + "px; left: " + (PEER_CIRCLE_RADIUS + PEER_CIRCLE_ADDITIONAL_FREE_SPACE) + "px", "mark" }, "+");
    final Object[] knownLocsCopy = stats.getKnownLocations(-1);
    final Double[] locations = (Double[])knownLocsCopy[0];
    final Long[] timestamps = (Long[])knownLocsCopy[1];
    Double location;
    Long locationTime;
    double strength = 1.0;
    long now = System.currentTimeMillis();
    long age = 1;
    int histogramIndex;
    for(int i=0; i<locations.length; i++){
      location = locations[i];
      locationTime = timestamps[i];
      age = now - locationTime.longValue();
      if( age > MAX_CIRCLE_AGE_THRESHOLD ) {
        age = MAX_CIRCLE_AGE_THRESHOLD;
      }
      strength = 1 - ((double) age / MAX_CIRCLE_AGE_THRESHOLD );
      histogramIndex = (int) (Math.floor(location.doubleValue() * HISTOGRAM_LENGTH));
      histogram[histogramIndex]++;
     
      nodeCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(location.doubleValue(), false, strength), "connected" }, "x");
    }
    nodeCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(myLocation, true, 1.0), "me" }, "x");
    //
    int histogramDiv = simpleHistogramDivisor(histogram); // Prevent division by 0 on empty histograms.
    double histogramPercent;
    for (int i = 0; i < HISTOGRAM_LENGTH; i++) {
      nodeHistogramLegendCell = nodeHistogramLegendTableRow.addChild("td");
View Full Code Here


  }

  public void drawNewLoadManagementDelayTimes(HTMLNode content) {
    WaitingForSlots waitingSlots = node.tracker.countRequestsWaitingForSlots();
    content.addChild("p").addChild("#", l10n("slotsWaiting", new String[] { "local", "remote" }, new String[] { Integer.toString(waitingSlots.local), Integer.toString(waitingSlots.remote) }));
    HTMLNode table = content.addChild("table", "border", "0");
    HTMLNode header = table.addChild("tr");
    header.addChild("th", l10n("delayTimes"));
    header.addChild("th", l10n("localHeader"));
    header.addChild("th", l10n("remoteHeader"));
    HTMLNode row = table.addChild("tr");
    row.addChild("th", l10n("realTimeHeader"));
    row.addChild("td", TimeUtil.formatTime((int)nlmDelayRTLocal.currentValue(), 2, true));
    row.addChild("td", TimeUtil.formatTime((int)nlmDelayRTRemote.currentValue(), 2, true));
    row = table.addChild("tr");
    row.addChild("th", l10n("bulkHeader"));
    row.addChild("td", TimeUtil.formatTime((int)nlmDelayBulkLocal.currentValue(), 2, true));
    row.addChild("td", TimeUtil.formatTime((int)nlmDelayBulkRemote.currentValue(), 2, true));
   
    synchronized(slotTimeoutsSync) {
      if(fatalTimeoutsInWaitLocal + fatalTimeoutsInWaitRemote +
          allocatedSlotLocal + allocatedSlotRemote > 0) {
        content.addChild("b", l10n("timeoutFractions"));
        table = content.addChild("table", "border", "0");
        header = table.addChild("tr");
        header.addChild("th", l10n("localHeader"));
        header.addChild("th", l10n("remoteHeader"));
        row = table.addChild("tr");
        row.addChild("td", this.fix3p3pct.format(((double)fatalTimeoutsInWaitLocal)/((double)(fatalTimeoutsInWaitLocal + allocatedSlotLocal))));
        row.addChild("td", this.fix3p3pct.format(((double)fatalTimeoutsInWaitRemote)/((double)(fatalTimeoutsInWaitRemote + allocatedSlotRemote))));
      }
    }
  }
View Full Code Here

      nodeHistogramGraphCell.addChild("%", "<div class=\"histogramConnected\" style=\"height: " + fix3pctUS.format(histogramPercent) + "; width: 100%;\">\u00a0</div>");
    }
  }
 
  private void addSpecialisation(HTMLNode table, double peerLocation, int[] incomingRequestLocation) {
    HTMLNode nodeHistogramLegendTableRow = table.addChild("tr");
    HTMLNode nodeHistogramGraphTableRow = table.addChild("tr");
    int myIndex = (int)(peerLocation * incomingRequestLocation.length);
    int histogramDiv = simpleHistogramDivisor(incomingRequestLocation);
    for (int i = 0; i<incomingRequestLocation.length; i++) {
      HTMLNode nodeHistogramLegendCell = nodeHistogramLegendTableRow.addChild("td");
      HTMLNode nodeHistogramGraphCell = nodeHistogramGraphTableRow.addChild("td", "style", "height: 100px;");
      HTMLNode nodeHistogramGraphCell2 = nodeHistogramLegendCell.addChild("div", "class", "histogramLabel");
      if(i == myIndex)
         nodeHistogramGraphCell2 = nodeHistogramGraphCell2.addChild("span", "class", "me");
      nodeHistogramGraphCell2.addChild("#", fix1p1.format(((double) i) / incomingRequestLocation.length ));
      nodeHistogramGraphCell.addChild("div", new String[] { "class", "style" }, new String[] { "histogramConnected", "height: " + fix3pctUS.format(((double)incomingRequestLocation[i]) / histogramDiv) + "; width: 100%;" }, "\u00a0");
    }
  }
View Full Code Here

    }
  }
 
  private void addCombinedSpecialisation(HTMLNode table, double peerLocation, int[] locallyOriginatingRequests, int[] remotelyOriginatingRequests) {
    assert(locallyOriginatingRequests.length == remotelyOriginatingRequests.length);
    HTMLNode nodeHistogramLegendTableRow = table.addChild("tr");
    HTMLNode nodeHistogramGraphTableRow = table.addChild("tr");
    int myIndex = (int)(peerLocation * locallyOriginatingRequests.length);
    int histogramDiv = combinedHistogramDivisor(locallyOriginatingRequests, remotelyOriginatingRequests);
    for (int i = 0; i<locallyOriginatingRequests.length; i++) {
      HTMLNode nodeHistogramLegendCell = nodeHistogramLegendTableRow.addChild("td");
      HTMLNode nodeHistogramGraphCell = nodeHistogramGraphTableRow.addChild("td", "style", "height: 100px;");
      HTMLNode nodeHistogramGraphCell2 = nodeHistogramLegendCell.addChild("div", "class", "histogramLabel");
      if(i == myIndex)
         nodeHistogramGraphCell2 = nodeHistogramGraphCell2.addChild("span", "class", "me");
      nodeHistogramGraphCell2.addChild("#", fix1p1.format(((double) i) / locallyOriginatingRequests.length ));
      nodeHistogramGraphCell.addChild("div",
        new String[] { "class", "style" },
        new String[] { "histogramConnected", "height: " +
          fix3pctUS.format(((double)locallyOriginatingRequests[i]) / histogramDiv) +
          "; width: 100%;" },
View Full Code Here

  }

  private void addFOAFLinkLengthHistogram(HTMLNode circleTable, PeerNodeStatus[] peerNodeStatuses) {
    int[] peersLinkHistogram = new int[HISTOGRAM_LENGTH];
   
    HTMLNode peerHistogramLegendTableRow = circleTable.addChild("tr");
    HTMLNode peerHistogramGraphTableRow = circleTable.addChild("tr");
    HTMLNode peerHistogramLegendCell;
    HTMLNode peerHistogramGraphCell;

    int peersLinkCount = 0;
    for (PeerNodeStatus pns : peerNodeStatuses) {
      if (!pns.isSearchable()) continue;
      if (!pns.isRoutable()) continue;

      double peerLoc = pns.getLocation();
      if (!Location.isValid(peerLoc)) continue;

      double[] foafLocs = pns.getPeersLocation();
      if (foafLocs == null) continue;
     
      for (double foafLoc : foafLocs) {
        if (!Location.isValid(foafLoc)) continue;
       
        int idx = (int)Math.floor(Location.distance(peerLoc, foafLoc) * HISTOGRAM_LENGTH / 0.5);
        peersLinkHistogram[idx]++;
        peersLinkCount++;
      }
    }
   
    double cumulativeFraction = 0;
    for (int i = 0; i < HISTOGRAM_LENGTH; i++) {
      peerHistogramLegendCell = peerHistogramLegendTableRow.addChild("td");
      peerHistogramGraphCell = peerHistogramGraphTableRow.addChild("td", "style", "height: 100px;");
      peerHistogramLegendCell.addChild("div", "class", "histogramLabel").addChild("#", fix1p2.format(((double)i) / HISTOGRAM_LENGTH * 0.5));
      if (peersLinkCount == 0) continue;

      double histogramFraction = ((double)peersLinkHistogram[i]) / peersLinkCount;
      peerHistogramGraphCell.addChild("div", new String[] { "class", "style" }, new String[] { "histogramConnected", "height: " + fix3pctUS.format(histogramFraction) + "; width: 100%;" }, "\u00a0");
      peerHistogramGraphCell.addChild("div", new String[] { "class", "style" }, new String[] { "histogramDisconnected", "height: " + fix3pctUS.format(cumulativeFraction) + "; width: 100%;" }, "\u00a0");
      cumulativeFraction += histogramFraction;
    }
  }
View Full Code Here

    int[] histogramDisconnected = new int[HISTOGRAM_LENGTH];
    for (int i = 0; i < HISTOGRAM_LENGTH; i++) {
      histogramConnected[i] = 0;
      histogramDisconnected[i] = 0;
    }
    HTMLNode peerCircleTableRow = circleTable.addChild("tr");
    HTMLNode peerHistogramLegendTableRow = circleTable.addChild("tr");
    HTMLNode peerHistogramGraphTableRow = circleTable.addChild("tr");
    HTMLNode peerCircleTableCell = peerCircleTableRow.addChild("td", new String[] { "class", "colspan" }, new String[] {"first", "10"});
    HTMLNode peerHistogramLegendCell;
    HTMLNode peerHistogramGraphCell;
    HTMLNode peerCircleInfoboxContent = peerCircleTableCell.addChild("div", new String[] { "style", "class" }, new String[] {"position: relative; height: " + ((PEER_CIRCLE_RADIUS + PEER_CIRCLE_ADDITIONAL_FREE_SPACE) * 2) + "px; width: " + ((PEER_CIRCLE_RADIUS + PEER_CIRCLE_ADDITIONAL_FREE_SPACE) * 2) + "px", "peercircle" });
    peerCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0, false, 1.0),   "mark" }, "|");
    peerCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.125, false, 1.0), "mark" }, "+");
    peerCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.25, false, 1.0)"mark" }, "--");
    peerCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.375, false, 1.0), "mark" }, "+");
    peerCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.5, false, 1.0),   "mark" }, "|");
    peerCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.625, false, 1.0), "mark" }, "+");
    peerCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.75, false, 1.0)"mark" }, "--");
    peerCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.875, false, 1.0), "mark" }, "+");
    peerCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { "position: absolute; top: " + PEER_CIRCLE_RADIUS + "px; left: " + (PEER_CIRCLE_RADIUS + PEER_CIRCLE_ADDITIONAL_FREE_SPACE) + "px", "mark" }, "+");

    PeerNodeStatus peerNodeStatus;
    double peerLocation;
    double peerDistance;
    int histogramIndex;
    int peerCount = peerNodeStatuses.length;
    for (int peerIndex = 0; peerIndex < peerCount; peerIndex++) {
      peerNodeStatus = peerNodeStatuses[peerIndex];
      peerLocation = peerNodeStatus.getLocation();
      if(!peerNodeStatus.isSearchable()) continue;
      if(peerLocation < 0.0 || peerLocation > 1.0) continue;
      double[] foafLocations=peerNodeStatus.getPeersLocation();
      if (foafLocations!=null && peerNodeStatus.isRoutable()) {
        for (double foafLocation : foafLocations) {
          //one grey dot for each "Friend-of-a-friend"
          peerCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(foafLocation, false, 0.9), "disconnected" }, ".");
        }
      }
      peerDistance = Location.distance( myLocation, peerLocation );
      histogramIndex = (int) (Math.floor(peerDistance * HISTOGRAM_LENGTH * 2));
      if (peerNodeStatus.isConnected()) {
        histogramConnected[histogramIndex]++;
      } else {
        histogramDisconnected[histogramIndex]++;
      }
      peerCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(peerLocation, false, (1.0 - peerNodeStatus.getPReject())), ((peerNodeStatus.isConnected())?"connected":"disconnected") }, ((peerNodeStatus.isOpennet())?"o":"x"));
    }
    peerCircleInfoboxContent.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(myLocation, true, 1.0), "me" }, "x");
    //
    int histogramDiv = combinedHistogramDivisor(histogramConnected, histogramDisconnected);
    double histogramPercent;
    for (int i = 0; i < HISTOGRAM_LENGTH; i++) {
      peerHistogramLegendCell = peerHistogramLegendTableRow.addChild("td");
View Full Code Here

      }
    }

    node.clientCore.bandwidthStatsPutter.updateData(node);

    HTMLNode pageNode;
   
    // Synchronize to avoid problems with DecimalFormat.
    synchronized(this) {
   
    /* gather connection statistics */
    PeerNodeStatus[] peerNodeStatuses = peers.getPeerNodeStatuses(true);
    Arrays.sort(peerNodeStatuses, new Comparator<PeerNodeStatus>() {
      @Override
      public int compare(PeerNodeStatus firstNode, PeerNodeStatus secondNode) {
        int statusDifference = firstNode.getStatusValue() - secondNode.getStatusValue();
        if (statusDifference != 0) {
          return statusDifference;
        }
        return 0;
      }
    });

    int numberOfConnected = getPeerStatusCount(peerNodeStatuses, PeerManager.PEER_NODE_STATUS_CONNECTED);
    int numberOfRoutingBackedOff = getPeerStatusCount(peerNodeStatuses, PeerManager.PEER_NODE_STATUS_ROUTING_BACKED_OFF);
    int numberOfTooNew = getPeerStatusCount(peerNodeStatuses, PeerManager.PEER_NODE_STATUS_TOO_NEW);
    int numberOfTooOld = getPeerStatusCount(peerNodeStatuses, PeerManager.PEER_NODE_STATUS_TOO_OLD);
    int numberOfDisconnected = getPeerStatusCount(peerNodeStatuses, PeerManager.PEER_NODE_STATUS_DISCONNECTED);
    int numberOfNeverConnected = getPeerStatusCount(peerNodeStatuses, PeerManager.PEER_NODE_STATUS_NEVER_CONNECTED);
    int numberOfDisabled = getPeerStatusCount(peerNodeStatuses, PeerManager.PEER_NODE_STATUS_DISABLED);
    int numberOfBursting = getPeerStatusCount(peerNodeStatuses, PeerManager.PEER_NODE_STATUS_BURSTING);
    int numberOfListening = getPeerStatusCount(peerNodeStatuses, PeerManager.PEER_NODE_STATUS_LISTENING);
    int numberOfListenOnly = getPeerStatusCount(peerNodeStatuses, PeerManager.PEER_NODE_STATUS_LISTEN_ONLY);
    int numberOfSeedServers = getCountSeedServers(peerNodeStatuses);
    int numberOfSeedClients = getCountSeedClients(peerNodeStatuses);
    int numberOfRoutingDisabled = getPeerStatusCount(peerNodeStatuses, PeerManager.PEER_NODE_STATUS_ROUTING_DISABLED);
    int numberOfClockProblem = getPeerStatusCount(peerNodeStatuses, PeerManager.PEER_NODE_STATUS_CLOCK_PROBLEM);
    int numberOfConnError = getPeerStatusCount(peerNodeStatuses, PeerManager.PEER_NODE_STATUS_CONN_ERROR);
    int numberOfDisconnecting = PeerNodeStatus.getPeerStatusCount(peerNodeStatuses, PeerManager.PEER_NODE_STATUS_DISCONNECTING);
    int numberOfNoLoadStats = PeerNodeStatus.getPeerStatusCount(peerNodeStatuses, PeerManager.PEER_NODE_STATUS_NO_LOAD_STATS);

    PageNode page = ctx.getPageMaker().getPageNode(l10n("fullTitle"), ctx);
    boolean advancedMode = ctx.isAdvancedModeEnabled();
    pageNode = page.outer;
    HTMLNode contentNode = page.content;

    // FIXME! We need some nice images
    final long now = System.currentTimeMillis();
    double myLocation = node.getLocation();
    final long nodeUptimeSeconds = (now - node.startupTime) / 1000;

    if(ctx.isAllowedFullAccess())
      contentNode.addChild(ctx.getAlertManager().createSummary());

    double swaps = node.getSwaps();
    double noSwaps = node.getNoSwaps();

    HTMLNode overviewTable = contentNode.addChild("table", "class", "column");

    HTMLNode overviewTableRow = overviewTable.addChild("tr");
    HTMLNode nextTableCell = overviewTableRow.addChild("td", "class", "first");

    // node version information box
    HTMLNode versionInfobox = nextTableCell.addChild("div", "class", "infobox");
   
    drawNodeVersionBox(versionInfobox);
   
    // jvm stats box
    HTMLNode jvmStatsInfobox = nextTableCell.addChild("div", "class", "infobox");
   
    drawJVMStatsBox(jvmStatsInfobox, advancedMode);
   
    // Statistic gathering box
    HTMLNode statGatheringContent = ctx.getPageMaker().getInfobox("#", l10n("statisticGatheringTitle"), nextTableCell, "statistics-generating", true);
    // Generate a Thread-Dump
    if(node.isUsingWrapper()){
      HTMLNode threadDumpForm = ctx.addFormChild(statGatheringContent, "/", "threadDumpForm");
      threadDumpForm.addChild("input", new String[] { "type", "name", "value" }, new String[] { "submit", "getThreadDump", l10n("threadDumpButton")});
    }
    // Get logs
    HTMLNode logsList = statGatheringContent.addChild("ul");
    if(nodeConfig.config.get("logger").getBoolean("enabled"))
      logsList.addChild("li").addChild("a", new String[]{ "href", "target"}, new String[]{ "/?latestlog", "_blank"}, l10n("getLogs"));
    logsList.addChild("li").addChild("a", "href", TranslationToadlet.TOADLET_URL+"?getOverrideTranlationFile").addChild("#", NodeL10n.getBase().getString("TranslationToadlet.downloadTranslationsFile"));
    logsList.addChild("li").addChild("a", "href", DiagnosticToadlet.TOADLET_URL).addChild("#", NodeL10n.getBase().getString("FProxyToadlet.diagnostic"));
   
    if(advancedMode) {
      // store size box
      //HTMLNode storeSizeInfobox = nextTableCell.addChild("div", "class", "infobox");
             HTMLNode storeSizeInfobox = contentNode.addChild("div","class", "infobox");
     
      drawStoreSizeBox(storeSizeInfobox, myLocation, nodeUptimeSeconds);
          
     
      if(numberOfConnected + numberOfRoutingBackedOff > 0) {
       
        HTMLNode loadStatsInfobox = nextTableCell.addChild("div", "class", "infobox");
       
        drawLoadBalancingBox(loadStatsInfobox, false);
       
        loadStatsInfobox = nextTableCell.addChild("div", "class", "infobox");
       
        drawLoadBalancingBox(loadStatsInfobox, true);
       
        HTMLNode newLoadManagementBox = nextTableCell.addChild("div", "class", "infobox");
        drawNewLoadManagementBox(newLoadManagementBox);
               
        // Psuccess box
        HTMLNode successRateBox = nextTableCell.addChild("div", "class", "infobox");
        successRateBox.addChild("div", "class", "infobox-header", l10n("successRate"));
        HTMLNode successRateContent = successRateBox.addChild("div", "class", "infobox-content");
        stats.fillSuccessRateBox(successRateContent);
       
        HTMLNode timeDetailBox = nextTableCell.addChild("div", "class", "infobox");
        timeDetailBox.addChild("div", "class", "infobox-header", l10n("chkDetailTiming"));
        HTMLNode timingsContent = timeDetailBox.addChild("div", "class", "infobox-content");
        stats.fillDetailedTimingsBox(timingsContent);
       
        HTMLNode byHTLBox = nextTableCell.addChild("div", "class", "infobox");
        byHTLBox.addChild("div", "class", "infobox-header", l10n("successByHTLBulk"));
        HTMLNode byHTLContent = byHTLBox.addChild("div", "class", "infobox-content");
        stats.fillRemoteRequestHTLsBox(byHTLContent, false);
       
        byHTLBox = nextTableCell.addChild("div", "class", "infobox");
        byHTLBox.addChild("div", "class", "infobox-header", l10n("successByHTLRT"));
        byHTLContent = byHTLBox.addChild("div", "class", "infobox-content");
        stats.fillRemoteRequestHTLsBox(byHTLContent, true);
      }
    }

    if(advancedMode || numberOfConnected + numberOfRoutingBackedOff > 0) {

      // Activity box
      nextTableCell = overviewTableRow.addChild("td", "class", "last");
      HTMLNode activityInfobox = nextTableCell.addChild("div", "class", "infobox");
     
      drawActivityBox(activityInfobox, advancedMode);

      /* node status overview box */
      if(advancedMode) {
        HTMLNode overviewInfobox = nextTableCell.addChild("div", "class", "infobox");
        drawOverviewBox(overviewInfobox, nodeUptimeSeconds, node.clientCore.bandwidthStatsPutter.getLatestUptimeData().totalUptime, now, swaps, noSwaps);
      }

      // Peer statistics box
      HTMLNode peerStatsInfobox = nextTableCell.addChild("div", "class", "infobox");
     
      drawPeerStatsBox(peerStatsInfobox, advancedMode, numberOfConnected, numberOfRoutingBackedOff,
          numberOfTooNew, numberOfTooOld, numberOfDisconnected, numberOfNeverConnected, numberOfDisabled,
          numberOfBursting, numberOfListening, numberOfListenOnly, numberOfSeedServers, numberOfSeedClients,
          numberOfRoutingDisabled, numberOfClockProblem, numberOfConnError, numberOfDisconnecting, numberOfNoLoadStats, node);

      // Bandwidth box
      HTMLNode bandwidthInfobox = nextTableCell.addChild("div", "class", "infobox");
     
      drawBandwidthBox(bandwidthInfobox, nodeUptimeSeconds, advancedMode);
    }

    if(advancedMode) {

      // Peer routing backoff reason box
      HTMLNode backoffReasonInfobox = nextTableCell.addChild("div", "class", "infobox");
      backoffReasonInfobox.addChild("div", "class", "infobox-header", "Peer Backoff");
      HTMLNode backoffReasonContent = backoffReasonInfobox.addChild("div", "class", "infobox-content");

      HTMLNode curBackoffReasonInfobox = backoffReasonContent.addChild("div", "class", "infobox");
      curBackoffReasonInfobox.addChild("div", "class", "infobox-header", "Current backoff reasons (bulk)");
      HTMLNode curBackoffReasonContent = curBackoffReasonInfobox.addChild("div", "class", "infobox-content");

      String [] routingBackoffReasons = peers.getPeerNodeRoutingBackoffReasons(false);
      if(routingBackoffReasons.length == 0) {
        curBackoffReasonContent.addChild("#", l10n("notBackedOff"));
      } else {
        HTMLNode reasonList = curBackoffReasonContent.addChild("ul");
        for(String routingBackoffReason: routingBackoffReasons) {
          int reasonCount = peers.getPeerNodeRoutingBackoffReasonSize(routingBackoffReason, false);
          if(reasonCount > 0) {
            reasonList.addChild("li", routingBackoffReason + '\u00a0' + reasonCount);
          }
        }
      }

      curBackoffReasonInfobox = backoffReasonContent.addChild("div", "class", "infobox");
      curBackoffReasonInfobox.addChild("div", "class", "infobox-header", "Current backoff reasons (realtime)");
      curBackoffReasonContent = curBackoffReasonInfobox.addChild("div", "class", "infobox-content");

      routingBackoffReasons = peers.getPeerNodeRoutingBackoffReasons(true);
      if(routingBackoffReasons.length == 0) {
        curBackoffReasonContent.addChild("#", l10n("notBackedOff"));
      } else {
        HTMLNode reasonList = curBackoffReasonContent.addChild("ul");
        for(String routingBackoffReason: routingBackoffReasons) {
          int reasonCount = peers.getPeerNodeRoutingBackoffReasonSize(routingBackoffReason, true);
          if(reasonCount > 0) {
            reasonList.addChild("li", routingBackoffReason + '\u00a0' + reasonCount);
          }
        }
      }

      // Per backoff-type count and avg backoff lengths

      // Mandatory backoff - bulk
      HTMLNode mandatoryBackoffStatisticsTableBulk = backoffReasonInfobox.addChild("table", "border", "0");
      HTMLNode row = mandatoryBackoffStatisticsTableBulk.addChild("tr");
      row.addChild("th", l10n("mandatoryBackoffReason") + " (bulk)");
      row.addChild("th", l10n("count"));
      row.addChild("th", l10n("avgTime"));
      row.addChild("th", l10n("totalTime"));

      for(NodeStats.TimedStats entry : stats.getMandatoryBackoffStatistics(false)) {
        row = mandatoryBackoffStatisticsTableBulk.addChild("tr");
        row.addChild("td", entry.keyStr);
        row.addChild("td", Long.toString(entry.count));
        row.addChild("td", TimeUtil.formatTime(entry.avgTime, 2, true));
        row.addChild("td", TimeUtil.formatTime(entry.totalTime, 2, true));
      }

      // Mandatory backoff - realtime
      HTMLNode mandatoryBackoffStatisticsTableRT = backoffReasonInfobox.addChild("table", "border", "0");
      row = mandatoryBackoffStatisticsTableRT.addChild("tr");
      row.addChild("th", l10n("mandatoryBackoffReason") + " (realtime)");
      row.addChild("th", l10n("count"));
      row.addChild("th", l10n("avgTime"));
      row.addChild("th", l10n("totalTime"));

      for(NodeStats.TimedStats entry : stats.getMandatoryBackoffStatistics(true)) {
        row = mandatoryBackoffStatisticsTableRT.addChild("tr");
        row.addChild("td", entry.keyStr);
        row.addChild("td", Long.toString(entry.count));
        row.addChild("td", TimeUtil.formatTime(entry.avgTime, 2, true));
        row.addChild("td", TimeUtil.formatTime(entry.totalTime, 2, true));
      }

      // Routing Backoff bulk
      HTMLNode routingBackoffStatisticsTableBulk = backoffReasonInfobox.addChild("table", "border", "0");
      row = routingBackoffStatisticsTableBulk.addChild("tr");
      row.addChild("th", l10n("routingBackoffReason") + " (bulk)");
      row.addChild("th", l10n("count"));
      row.addChild("th", l10n("avgTime"));
      row.addChild("th", l10n("totalTime"));

      for(NodeStats.TimedStats entry : stats.getRoutingBackoffStatistics(false)) {
        row = routingBackoffStatisticsTableBulk.addChild("tr");
        row.addChild("td", entry.keyStr);
        row.addChild("td", Long.toString(entry.count));
        row.addChild("td", TimeUtil.formatTime(entry.avgTime, 2, true));
        row.addChild("td", TimeUtil.formatTime(entry.totalTime, 2, true));
      }

      // Routing Backoff realtime
      HTMLNode routingBackoffStatisticsTableRT = backoffReasonInfobox.addChild("table", "border", "0");
      row = routingBackoffStatisticsTableRT.addChild("tr");
      row.addChild("th", l10n("routingBackoffReason") + " (realtime)");
      row.addChild("th", l10n("count"));
      row.addChild("th", l10n("avgTime"));
      row.addChild("th", l10n("totalTime"));

      for(NodeStats.TimedStats entry : stats.getRoutingBackoffStatistics(true)) {
        row = routingBackoffStatisticsTableRT.addChild("tr");
        row.addChild("td", entry.keyStr);
        row.addChild("td", Long.toString(entry.count));
        row.addChild("td", TimeUtil.formatTime(entry.avgTime, 2, true));
        row.addChild("td", TimeUtil.formatTime(entry.totalTime, 2, true));
      }

      // Transfer Backoff bulk
      HTMLNode transferBackoffStatisticsTableBulk = backoffReasonInfobox.addChild("table", "border", "0");
      row = transferBackoffStatisticsTableBulk.addChild("tr");
      row.addChild("th", l10n("transferBackoffReason") + " (bulk)");
      row.addChild("th", l10n("count"));
      row.addChild("th", l10n("avgTime"));
      row.addChild("th", l10n("totalTime"));

      for(NodeStats.TimedStats entry : stats.getTransferBackoffStatistics(false)) {
        row = transferBackoffStatisticsTableBulk.addChild("tr");
        row.addChild("td", entry.keyStr);
        row.addChild("td", Long.toString(entry.count));
        row.addChild("td", TimeUtil.formatTime(entry.avgTime, 2, true));
        row.addChild("td", TimeUtil.formatTime(entry.totalTime, 2, true));
      }
      // Transfer Backoff realtime
      HTMLNode transferBackoffStatisticsTableRT = backoffReasonInfobox.addChild("table", "border", "0");
      row = transferBackoffStatisticsTableRT.addChild("tr");
      row.addChild("th", l10n("transferBackoffReason") + " (realtime)");
      row.addChild("th", l10n("count"));
      row.addChild("th", l10n("avgTime"));
      row.addChild("th", l10n("totalTime"));

      for(NodeStats.TimedStats entry : stats.getTransferBackoffStatistics(true)) {
        row = transferBackoffStatisticsTableRT.addChild("tr");
        row.addChild("td", entry.keyStr);
        row.addChild("td", Long.toString(entry.count));
        row.addChild("td", TimeUtil.formatTime(entry.avgTime, 2, true));
        row.addChild("td", TimeUtil.formatTime(entry.totalTime, 2, true));
      }

      //Swap statistics box
      HTMLNode locationSwapInfobox = nextTableCell.addChild("div", "class", "infobox");
      drawSwapStatsBox(locationSwapInfobox, myLocation, nodeUptimeSeconds, swaps, noSwaps);

      // unclaimedFIFOMessageCounts box
      HTMLNode unclaimedFIFOMessageCountsInfobox = nextTableCell.addChild("div", "class", "infobox");
      drawUnclaimedFIFOMessageCountsBox(unclaimedFIFOMessageCountsInfobox);

           
      HTMLNode threadsPriorityInfobox = nextTableCell.addChild("div", "class", "infobox");
      drawThreadPriorityStatsBox(threadsPriorityInfobox);
     
      nextTableCell = overviewTableRow.addChild("td");

      // thread usage box
      HTMLNode threadUsageInfobox = nextTableCell.addChild("div", "class", "infobox");
      threadUsageInfobox.addChild("div", "class", "infobox-header", "Thread usage");
      HTMLNode threadUsageContent = threadUsageInfobox.addChild("div", "class", "infobox-content");
      HTMLNode threadUsageList = threadUsageContent.addChild("ul");
      getThreadNames(threadUsageList);
     
      // rejection reasons box
      drawRejectReasonsBox(nextTableCell, false);
      drawRejectReasonsBox(nextTableCell, true);
     
      OpennetManager om = node.getOpennet();
      if(om != null) {
        // opennet stats box
        drawOpennetStatsBox(nextTableCell.addChild("div", "class", "infobox"), om);
       
        if(node.isSeednode())
          drawSeedStatsBox(nextTableCell.addChild("div", "class", "infobox"), om);
      }

      // peer distribution box
      overviewTableRow = overviewTable.addChild("tr");
      nextTableCell = overviewTableRow.addChild("td", "class", "first");
      HTMLNode peerCircleInfobox = nextTableCell.addChild("div", "class", "infobox");
      peerCircleInfobox.addChild("div", "class", "infobox-header", "Peer\u00a0Location\u00a0Distribution (w/pReject)");
      HTMLNode peerCircleTable = peerCircleInfobox.addChild("div", "class", "infobox-content").addChild("table");
      addPeerCircle(peerCircleTable, peerNodeStatuses, myLocation);
      nextTableCell = overviewTableRow.addChild("td");

      // node distribution box
      HTMLNode nodeCircleInfobox = nextTableCell.addChild("div", "class", "infobox");
      nodeCircleInfobox.addChild("div", "class", "infobox-header", "Node\u00a0Location\u00a0Distribution (w/Swap\u00a0Age)");
      HTMLNode nodeCircleTable = nodeCircleInfobox.addChild("div", "class", "infobox-content").addChild("table");
      addNodeCircle(nodeCircleTable, myLocation);
     
     
      overviewTableRow = overviewTable.addChild("tr");
      nextTableCell = overviewTableRow.addChild("td", "class", "first");
      // specialisation box
      int[] incomingRequestCountArray = new int[1];
      int[] incomingRequestLocation = stats.getIncomingRequestLocation(incomingRequestCountArray);
      int incomingRequestsCount = incomingRequestCountArray[0];
     
      if(incomingRequestsCount > 0) {
        HTMLNode nodeSpecialisationInfobox = nextTableCell.addChild("div", "class", "infobox");
        nodeSpecialisationInfobox.addChild("div", "class", "infobox-header", "Incoming\u00a0Request\u00a0Distribution");
        HTMLNode nodeSpecialisationTable = nodeSpecialisationInfobox.addChild("div", "class", "infobox-content").addChild("table");
        addSpecialisation(nodeSpecialisationTable, myLocation, incomingRequestLocation);
      }
     
      nextTableCell = overviewTableRow.addChild("td");
      int[] outgoingLocalRequestCountArray = new int[1];
      int[] outgoingLocalRequestLocation = stats.getOutgoingLocalRequestLocation(outgoingLocalRequestCountArray);
      int outgoingLocalRequestsCount = outgoingLocalRequestCountArray[0];
      int[] outgoingRequestCountArray = new int[1];
      int[] outgoingRequestLocation = stats.getOutgoingRequestLocation(outgoingRequestCountArray);
      int outgoingRequestsCount = outgoingRequestCountArray[0];
     
      if(outgoingLocalRequestsCount > 0 && outgoingRequestsCount > 0) {
        HTMLNode nodeSpecialisationInfobox = nextTableCell.addChild("div", "class", "infobox");
        nodeSpecialisationInfobox.addChild("div", "class", "infobox-header", "Outgoing\u00a0Request\u00a0Distribution");
        HTMLNode nodeSpecialisationTable = nodeSpecialisationInfobox.addChild("div", "class", "infobox-content").addChild("table");
        addCombinedSpecialisation(nodeSpecialisationTable, myLocation, outgoingLocalRequestLocation, outgoingRequestLocation);
      }

      overviewTableRow = overviewTable.addChild("tr");
      nextTableCell = overviewTableRow.addChild("td", "class", "first");

      // success rate per location
      int[] locationSuccessRatesArray = stats.chkSuccessRatesByLocation.getPercentageArray(1000);
      HTMLNode nodeSpecialisationInfobox = nextTableCell.addChild("div", "class", "infobox");
      nodeSpecialisationInfobox.addChild("div", "class", "infobox-header", "Local\u00a0CHK\u00a0Success\u00a0Rates\u00a0By\u00a0Location");
      HTMLNode nodeSpecialisationTable = nodeSpecialisationInfobox.addChild("div", "class", "infobox-content").addChild("table");
      addSpecialisation(nodeSpecialisationTable, myLocation, locationSuccessRatesArray);
      nextTableCell = overviewTableRow.addChild("td");
     
      // FOAF link-length distribution box
      HTMLNode foafLinkInfobox = nextTableCell.addChild("div", "class", "infobox");
      foafLinkInfobox.addChild("div", "class", "infobox-header", "FOAF\u00a0Link-Length\u00a0Distribution");
      HTMLNode foafLinkTable = foafLinkInfobox.addChild("div", "class", "infobox-content").addChild("table");
      addFOAFLinkLengthHistogram(foafLinkTable, peerNodeStatuses);
    }
   
    }

View Full Code Here

    this.writeHTMLReply(ctx, 200, "OK", pageNode.generate());
  }

  private void showRequesters(HTTPRequest request, ToadletContext ctx) throws ToadletContextClosedException, IOException {
    PageNode page = ctx.getPageMaker().getPageNode(l10n("fullTitle"), ctx);
    HTMLNode pageNode = page.outer;
    HTMLNode contentNode = page.content;

    drawClientRequestersBox(contentNode);
    writeHTMLReply(ctx, 200, "OK", pageNode.generate());
  }
View Full Code Here

  private void drawLoadBalancingBox(HTMLNode loadStatsInfobox, boolean realTime) {
    // Load balancing box
    // Include overall window, and RTTs for each
   
    loadStatsInfobox.addChild("div", "class", "infobox-header", "Load limiting "+(realTime ? "RealTime" : "Bulk"));
    HTMLNode loadStatsContent = loadStatsInfobox.addChild("div", "class", "infobox-content");
    RequestStarterGroup starters = core.requestStarters;
    double window = starters.getWindow(realTime);
    double realWindow = starters.getRealWindow(realTime);
    HTMLNode loadStatsList = loadStatsContent.addChild("ul");
    loadStatsList.addChild("li", l10n("globalWindow")+": "+window);
    loadStatsList.addChild("li", l10n("realGlobalWindow")+": "+realWindow);
    loadStatsList.addChild("li", starters.statsPageLine(false, false, realTime));
    loadStatsList.addChild("li", starters.statsPageLine(true, false, realTime));
    loadStatsList.addChild("li", starters.statsPageLine(false, true, realTime));
    loadStatsList.addChild("li", starters.statsPageLine(true, true, realTime));
    loadStatsList.addChild("li", starters.diagnosticThrottlesLine(false));
    loadStatsList.addChild("li", starters.diagnosticThrottlesLine(true));
  }
View Full Code Here

    loadStatsList.addChild("li", starters.diagnosticThrottlesLine(true));
  }
 
  private void drawNewLoadManagementBox(HTMLNode infobox) {
    infobox.addChild("div", "class", "infobox-header", l10n("newLoadManagementTitle"));
    HTMLNode content = infobox.addChild("div", "class", "infobox-content");
    node.nodeStats.drawNewLoadManagementDelayTimes(content);
  }
View Full Code Here

TOP

Related Classes of freenet.support.HTMLNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.