Package freenet.support

Examples of freenet.support.HTMLNode


    }
  }

  private void drawStoreSizeBox(HTMLNode storeSizeInfobox, double loc, long nodeUptimeSeconds) {
    storeSizeInfobox.addChild("div", "class", "infobox-header", l10n("datastore"));
    HTMLNode storeSizeInfoboxContent = storeSizeInfobox.addChild("div", "class", "infobox-content");

    HTMLNode scrollDiv = storeSizeInfoboxContent.addChild("div", "style", "overflow:scr");

    HTMLNode storeSizeTable = scrollDiv.addChild("table", "border", "0");
    HTMLNode row = storeSizeTable.addChild("tr");

    //FIXME - Non-breaking space? "Stat-name"?
    row.addChild("th", "");

    row.addChild("th", l10n("keys"));
    row.addChild("th", l10n("capacity"));
    row.addChild("th", l10n("datasize"));
    row.addChild("th", l10n("utilization"));
    row.addChild("th", l10n("readRequests"));
    row.addChild("th", l10n("successfulReads"));
    row.addChild("th", l10n("successRate"));
    row.addChild("th", l10n("writes"));
    row.addChild("th", l10n("accessRate"));
    row.addChild("th", l10n("writeRate"));
    row.addChild("th", l10n("falsePos"));
    row.addChild("th", l10n("avgLocation"));
    row.addChild("th", l10n("avgSuccessLoc"));
    row.addChild("th", l10n("furthestSuccess"));
    row.addChild("th", l10n("avgDist"));
    row.addChild("th", l10n("distanceStats"));


    Map<DataStoreInstanceType, DataStoreStats> storeStats = node.getDataStoreStats();
    for (Map.Entry<DataStoreInstanceType, DataStoreStats> entry : storeStats.entrySet()) {
      DataStoreInstanceType instance = entry.getKey();
      DataStoreStats stats = entry.getValue();
     
      StoreAccessStats sessionAccess = stats.getSessionAccessStats();
      StoreAccessStats totalAccess;
      long totalUptimeSeconds = 0;
      try {
        totalAccess = stats.getTotalAccessStats();
        // FIXME this is not necessarily the same as the datastore's uptime if we've switched.
        // Ideally we'd track uptime there too.
        totalUptimeSeconds =
          node.clientCore.bandwidthStatsPutter.getLatestUptimeData().totalUptime;
      } catch (StatsNotAvailableException e) {
        totalAccess = null;
      }
     
      row = storeSizeTable.addChild("tr");
      row.addChild("th", l10n(instance.store.name()) + "\n" + " (" + l10n(instance.key.name()) + ")");

      row.addChild("td", thousandPoint.format(stats.keys()));
      row.addChild("td", thousandPoint.format(stats.capacity()));
      row.addChild("td", SizeUtil.formatSize(stats.dataSize()));
      row.addChild("td", fix3p1pct.format(stats.utilization()));
      row.addChild("td", thousandPoint.format(sessionAccess.readRequests()) +
          (totalAccess == null ? "" : (" ("+thousandPoint.format(totalAccess.readRequests())+")")));
      row.addChild("td", thousandPoint.format(sessionAccess.successfulReads()) +
          (totalAccess == null ? "" : (" ("+thousandPoint.format(totalAccess.successfulReads())+")")));
      try {
        String rate = fix1p4.format(sessionAccess.successRate()) + "%";
        if(totalAccess != null) {
          try {
            rate += " (" + fix1p4.format(totalAccess.successRate()) + "%)";
          } catch (StatsNotAvailableException e) {
            // Ignore
          }
        }
        row.addChild("td", rate);
      } catch (StatsNotAvailableException e) {
        row.addChild("td", "N/A");
      }
      row.addChild("td", thousandPoint.format(sessionAccess.writes()) +
          (totalAccess == null ? "" : (" ("+thousandPoint.format(totalAccess.writes())+")")));
      String access = fix1p2.format(sessionAccess.accessRate(nodeUptimeSeconds)) + " /s";
      if(totalAccess != null)
        access += " (" + fix1p2.format(totalAccess.accessRate(totalUptimeSeconds)) + " /s)";
      row.addChild("td", access);
      access = fix1p2.format(sessionAccess.writeRate(nodeUptimeSeconds)) + " /s";
      if(totalAccess != null)
        access += " (" + fix1p2.format(totalAccess.writeRate(totalUptimeSeconds)) + " /s)";
      row.addChild("td", access);
      row.addChild("td", thousandPoint.format(sessionAccess.falsePos()) +
          (totalAccess == null ? "" : (" ("+thousandPoint.format(totalAccess.falsePos())+")")));
      try {
        row.addChild("td", fix1p4.format(stats.avgLocation()));
      } catch (StatsNotAvailableException e) {
        row.addChild("td", "N/A");
      }

      try {
        row.addChild("td", fix1p4.format(stats.avgSuccess()));
      } catch (StatsNotAvailableException e) {
        row.addChild("td", "N/A");
      }

      try {
        row.addChild("td", fix1p4.format(stats.furthestSuccess()));
      } catch (StatsNotAvailableException e) {
        row.addChild("td", "N/A");
      }

      try {
        row.addChild("td", fix1p4.format(stats.avgDist()));
      } catch (StatsNotAvailableException e) {
        row.addChild("td", "N/A");
      }

      try {
        row.addChild("td", fix3p1pct.format(stats.distanceStats()));
      } catch (StatsNotAvailableException e) {
        row.addChild("td", "N/A");
      }
    }

  }
View Full Code Here


  }

  private void drawUnclaimedFIFOMessageCountsBox(HTMLNode unclaimedFIFOMessageCountsInfobox) {
   
    unclaimedFIFOMessageCountsInfobox.addChild("div", "class", "infobox-header", "unclaimedFIFO Message Counts");
    HTMLNode unclaimedFIFOMessageCountsInfoboxContent = unclaimedFIFOMessageCountsInfobox.addChild("div", "class", "infobox-content");
    HTMLNode unclaimedFIFOMessageCountsList = unclaimedFIFOMessageCountsInfoboxContent.addChild("ul");
    Map<String, Integer> unclaimedFIFOMessageCountsMap = node.getUSM().getUnclaimedFIFOMessageCounts();
    STMessageCount[] unclaimedFIFOMessageCountsArray = new STMessageCount[unclaimedFIFOMessageCountsMap.size()];
    int i = 0;
    int totalCount = 0;
    for (Map.Entry<String, Integer> e : unclaimedFIFOMessageCountsMap.entrySet()) {
      String messageName = e.getKey();
      int messageCount = e.getValue();
      totalCount = totalCount + messageCount;
      unclaimedFIFOMessageCountsArray[i++] = new STMessageCount( messageName, messageCount );
    }
    Arrays.sort(unclaimedFIFOMessageCountsArray, new Comparator<STMessageCount>() {
      @Override
      public int compare(STMessageCount firstCount, STMessageCount secondCount) {
        return secondCount.messageCount - firstCount.messageCount;  // sort in descending order
      }
    });
    for (STMessageCount messageCountItem: unclaimedFIFOMessageCountsArray) {
      int thisMessageCount = messageCountItem.messageCount;
      double thisMessagePercentOfTotal = ((double) thisMessageCount) / ((double) totalCount);
      unclaimedFIFOMessageCountsList.addChild("li", "" + messageCountItem.messageName + ":\u00a0" + thisMessageCount + "\u00a0(" + fix3p1pct.format(thisMessagePercentOfTotal) + ')');
    }
    unclaimedFIFOMessageCountsList.addChild("li", "Unclaimed Messages Considered:\u00a0" + totalCount);
   
  }
View Full Code Here

    int swapsRejectedRecognizedID = node.getSwapsRejectedRecognizedID();
    double locChangeSession = node.getLocationChangeSession();
    int averageSwapTime = node.getAverageOutgoingSwapTime();
    long sendSwapInterval = node.getSendSwapInterval();

    HTMLNode locationSwapInfoboxContent = locationSwapInfobox.addChild("div", "class", "infobox-content");
    HTMLNode locationSwapList = locationSwapInfoboxContent.addChild("ul");
    locationSwapList.addChild("li", "location:\u00a0" + location);
    if (swaps > 0.0) {
      locationSwapList.addChild("li", "locChangeSession:\u00a0" + fix1p6sci.format(locChangeSession));
      locationSwapList.addChild("li", "locChangePerSwap:\u00a0" + fix1p6sci.format(locChangeSession/swaps));
    }
    if ((swaps > 0.0) && (nodeUptimeSeconds >= 60)) {
      locationSwapList.addChild("li", "locChangePerMinute:\u00a0" + fix1p6sci.format(locChangeSession/(nodeUptimeSeconds/60.0)));
    }
    if ((swaps > 0.0) && (nodeUptimeSeconds >= 60)) {
      locationSwapList.addChild("li", "swapsPerMinute:\u00a0" + fix1p6sci.format(swaps/(nodeUptimeSeconds/60.0)));
    }
    if ((noSwaps > 0.0) && (nodeUptimeSeconds >= 60)) {
      locationSwapList.addChild("li", "noSwapsPerMinute:\u00a0" + fix1p6sci.format(noSwaps/(nodeUptimeSeconds/60.0)));
    }
    if ((swaps > 0.0) && (noSwaps > 0.0)) {
      locationSwapList.addChild("li", "swapsPerNoSwaps:\u00a0" + fix1p6sci.format(swaps/noSwaps));
    }
    if (swaps > 0.0) {
      locationSwapList.addChild("li", "swaps:\u00a0" + (int)swaps);
    }
    if (noSwaps > 0.0) {
      locationSwapList.addChild("li", "noSwaps:\u00a0" + (int)noSwaps);
    }
    if (startedSwaps > 0) {
      locationSwapList.addChild("li", "startedSwaps:\u00a0" + startedSwaps);
    }
    if (swapsRejectedAlreadyLocked > 0) {
      locationSwapList.addChild("li", "swapsRejectedAlreadyLocked:\u00a0" + swapsRejectedAlreadyLocked);
    }
    if (swapsRejectedNowhereToGo > 0) {
      locationSwapList.addChild("li", "swapsRejectedNowhereToGo:\u00a0" + swapsRejectedNowhereToGo);
    }
    if (swapsRejectedRateLimit > 0) {
      locationSwapList.addChild("li", "swapsRejectedRateLimit:\u00a0" + swapsRejectedRateLimit);
    }
    if (swapsRejectedRecognizedID > 0) {
      locationSwapList.addChild("li", "swapsRejectedRecognizedID:\u00a0" + swapsRejectedRecognizedID);
    }
    locationSwapList.addChild("li", "averageSwapTime:\u00a0" + TimeUtil.formatTime(averageSwapTime, 2, true));
    locationSwapList.addChild("li", "sendSwapInterval:\u00a0" + TimeUtil.formatTime(sendSwapInterval, 2, true));
  }
View Full Code Here

      int numberOfNeverConnected, int numberOfDisabled, int numberOfBursting, int numberOfListening,
      int numberOfListenOnly, int numberOfSeedServers, int numberOfSeedClients, int numberOfRoutingDisabled,
      int numberOfClockProblem, int numberOfConnError, int numberOfDisconnecting, int numberOfNoLoadStats, Node node) {
   
    peerStatsInfobox.addChild("div", "class", "infobox-header", l10n("peerStatsTitle"));
    HTMLNode peerStatsContent = peerStatsInfobox.addChild("div", "class", "infobox-content");
    HTMLNode peerStatsList = peerStatsContent.addChild("ul");
    if (numberOfConnected > 0) {
      HTMLNode peerStatsConnectedListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsConnectedListItem.addChild("span", new String[] { "class", "title", "style" },
          new String[] { "peer_connected", l10nDark("connected"), "border-bottom: 1px dotted; cursor: help;" }, l10nDark("connectedShort"));
      peerStatsConnectedListItem.addChild("span", ":\u00a0" + numberOfConnected);
    }
    if (numberOfRoutingBackedOff > 0) {
      HTMLNode peerStatsRoutingBackedOffListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsRoutingBackedOffListItem.addChild("span", new String[] { "class", "title", "style" },
          new String[] { "peer_backed_off", l10nDark(advancedModeEnabled ? "backedOff" : "busy"),
          "border-bottom: 1px dotted; cursor: help;" }, l10nDark((advancedModeEnabled ? "backedOff" : "busy")+"Short"));
      peerStatsRoutingBackedOffListItem.addChild("span", ":\u00a0" + numberOfRoutingBackedOff);
    }
    if (numberOfTooNew > 0) {
      HTMLNode peerStatsTooNewListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsTooNewListItem.addChild("span", new String[] { "class", "title", "style" },
          new String[] { "peer_too_new", l10nDark("tooNew"), "border-bottom: 1px dotted; cursor: help;" }, l10nDark("tooNewShort"));
      peerStatsTooNewListItem.addChild("span", ":\u00a0" + numberOfTooNew);
    }
    if (numberOfTooOld > 0) {
      HTMLNode peerStatsTooOldListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsTooOldListItem.addChild("span", new String[] { "class", "title", "style" },
          new String[] { "peer_too_old", l10nDark("tooOld"), "border-bottom: 1px dotted; cursor: help;" }, l10nDark("tooOldShort"));
      peerStatsTooOldListItem.addChild("span", ":\u00a0" + numberOfTooOld);
    }
    if (numberOfDisconnected > 0) {
      HTMLNode peerStatsDisconnectedListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsDisconnectedListItem.addChild("span", new String[] { "class", "title", "style" },
          new String[] { "peer_disconnected", l10nDark("notConnected"), "border-bottom: 1px dotted; cursor: help;" }, l10nDark("notConnectedShort"));
      peerStatsDisconnectedListItem.addChild("span", ":\u00a0" + numberOfDisconnected);
    }
    if (numberOfNeverConnected > 0) {
      HTMLNode peerStatsNeverConnectedListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsNeverConnectedListItem.addChild("span", new String[] { "class", "title", "style" },
          new String[] { "peer_never_connected", l10nDark("neverConnected"), "border-bottom: 1px dotted; cursor: help;" }, l10nDark("neverConnectedShort"));
      peerStatsNeverConnectedListItem.addChild("span", ":\u00a0" + numberOfNeverConnected);
    }
    if (numberOfDisabled > 0) {
      HTMLNode peerStatsDisabledListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsDisabledListItem.addChild("span", new String[] { "class", "title", "style" },
          new String[] { "peer_disabled", l10nDark("disabled"), "border-bottom: 1px dotted; cursor: help;" }, l10nDark("disabledShort"));
      peerStatsDisabledListItem.addChild("span", ":\u00a0" + numberOfDisabled);
    }
    if (numberOfBursting > 0) {
      HTMLNode peerStatsBurstingListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsBurstingListItem.addChild("span", new String[] { "class", "title", "style" },
          new String[] { "peer_bursting", l10nDark("bursting"), "border-bottom: 1px dotted; cursor: help;" }, l10nDark("burstingShort"));
      peerStatsBurstingListItem.addChild("span", ":\u00a0" + numberOfBursting);
    }
    if (numberOfListening > 0) {
      HTMLNode peerStatsListeningListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsListeningListItem.addChild("span", new String[] { "class", "title", "style" },
          new String[] { "peer_listening", l10nDark("listening"), "border-bottom: 1px dotted; cursor: help;" }, l10nDark("listeningShort"));
      peerStatsListeningListItem.addChild("span", ":\u00a0" + numberOfListening);
    }
    if (numberOfListenOnly > 0) {
      HTMLNode peerStatsListenOnlyListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsListenOnlyListItem.addChild("span", new String[] { "class", "title", "style" },
          new String[] { "peer_listen_only", l10nDark("listenOnly"), "border-bottom: 1px dotted; cursor: help;" }, l10nDark("listenOnlyShort"));
      peerStatsListenOnlyListItem.addChild("span", ":\u00a0" + numberOfListenOnly);
    }
    if (numberOfClockProblem > 0) {
      HTMLNode peerStatsRoutingDisabledListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsRoutingDisabledListItem.addChild("span", new String[] { "class", "title", "style" }, new String[] { "peer_clock_problem", l10nDark("clockProblem"), "border-bottom: 1px dotted; cursor: help;" }, l10nDark("clockProblemShort"));
      peerStatsRoutingDisabledListItem.addChild("span", ":\u00a0" + numberOfClockProblem);
    }
    if (numberOfConnError > 0) {
      HTMLNode peerStatsRoutingDisabledListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsRoutingDisabledListItem.addChild("span", new String[] { "class", "title", "style" }, new String[] { "peer_routing_disabled", l10nDark("connError"), "border-bottom: 1px dotted; cursor: help;" }, l10nDark("connErrorShort"));
      peerStatsRoutingDisabledListItem.addChild("span", ":\u00a0" + numberOfClockProblem);
    }
    if (numberOfDisconnecting > 0) {
      HTMLNode peerStatsListenOnlyListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsListenOnlyListItem.addChild("span", new String[] { "class", "title", "style" }, new String[] { "peer_disconnecting", l10nDark("disconnecting"), "border-bottom: 1px dotted; cursor: help;" }, l10nDark("disconnectingShort"));
      peerStatsListenOnlyListItem.addChild("span", ":\u00a0" + numberOfDisconnecting);
    }
    if (numberOfSeedServers > 0) {
      HTMLNode peerStatsSeedServersListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsSeedServersListItem.addChild("span", new String[] { "class", "title", "style" },
          new String[] { "peer_listening" /* FIXME */, l10nDark("seedServers"), "border-bottom: 1px dotted; cursor: help;" }, l10nDark("seedServersShort"));
      peerStatsSeedServersListItem.addChild("span", ":\u00a0" + numberOfSeedServers);
    }
    if (numberOfSeedClients > 0) {
      HTMLNode peerStatsSeedClientsListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsSeedClientsListItem.addChild("span", new String[] { "class", "title", "style" },
          new String[] { "peer_listening" /* FIXME */, l10nDark("seedClients"), "border-bottom: 1px dotted; cursor: help;" }, l10nDark("seedClientsShort"));
      peerStatsSeedClientsListItem.addChild("span", ":\u00a0" + numberOfSeedClients);
    }
    if (numberOfRoutingDisabled > 0) {
      HTMLNode peerStatsRoutingDisabledListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsRoutingDisabledListItem.addChild("span", new String[] { "class", "title", "style" }, new String[] { "peer_routing_disabled", l10nDark("routingDisabled"), "border-bottom: 1px dotted; cursor: help;" }, l10nDark("routingDisabledShort"));
      peerStatsRoutingDisabledListItem.addChild("span", ":\u00a0" + numberOfRoutingDisabled);
    }
    if (numberOfNoLoadStats > 0) {
      HTMLNode peerStatsNoLoadStatsListItem = peerStatsList.addChild("li").addChild("span");
      peerStatsNoLoadStatsListItem.addChild("span", new String[] { "class", "title", "style" }, new String[] { "peer_no_load_stats", l10nDark("noLoadStats"), "border-bottom: 1px dotted; cursor: help;" }, l10nDark("noLoadStatsShort"));
      peerStatsNoLoadStatsListItem.addChild("span", ":\u00a0" + numberOfNoLoadStats);
    }
    OpennetManager om = node.getOpennet();
    if(om != null) {
      peerStatsList.addChild("li", l10n("maxTotalPeers")+": "+om.getNumberOfConnectedPeersToAimIncludingDarknet());
      peerStatsList.addChild("li", l10n("maxOpennetPeers")+": "+om.getNumberOfConnectedPeersToAim());
View Full Code Here

  private final DecimalFormat fix3p3pct = new DecimalFormat("##0.000%");
  private final NumberFormat thousandPoint = NumberFormat.getInstance();

  public void fillSuccessRateBox(HTMLNode parent) {
    HTMLNode list = parent.addChild("table", "border", "0");
    final RunningAverage[] averages = new RunningAverage[] {
        globalFetchPSuccess,
        chkLocalFetchPSuccess,
        chkRemoteFetchPSuccess,
        sskLocalFetchPSuccess,
        sskRemoteFetchPSuccess,
        blockTransferPSuccessBulk,
        blockTransferPSuccessRT,
        blockTransferPSuccessLocal,
        blockTransferFailTimeout
    };
    final String[] names = new String[] {
        l10n("allRequests"),
        l10n("localCHKs"),
        l10n("remoteCHKs"),
        l10n("localSSKs"),
        l10n("remoteSSKs"),
        l10n("blockTransfersBulk"),
        l10n("blockTransfersRT"),
        l10n("blockTransfersLocal"),
        l10n("transfersTimedOut")
    };
    HTMLNode row = list.addChild("tr");
    row.addChild("th", l10n("group"));
    row.addChild("th", l10n("pSuccess"));
    row.addChild("th", l10n("count"));

    for(int i=0;i<averages.length;i++) {
      row = list.addChild("tr");
      row.addChild("td", names[i]);
      if (averages[i].countReports()==0) {
        row.addChild("td", "-");
        row.addChild("td", "0");
      } else {
        row.addChild("td", fix3p3pct.format(averages[i].currentValue()));
        row.addChild("td", thousandPoint.format(averages[i].countReports()));
      }
    }

    row = list.addChild("tr");
    long[] bulkSuccess = BulkTransmitter.transferSuccess();
    row = list.addChild("tr");
    row.addChild("td", l10n("bulkSends"));
    row.addChild("td", fix3p3pct.format(((double)bulkSuccess[1])/((double)bulkSuccess[0])));
    row.addChild("td", Long.toString(bulkSuccess[0]));
  }
View Full Code Here

  }
 
  private void drawActivityBox(HTMLNode activityInfobox, boolean advancedModeEnabled) {
   
    activityInfobox.addChild("div", "class", "infobox-header", l10nDark("activityTitle"));
    HTMLNode activityInfoboxContent = activityInfobox.addChild("div", "class", "infobox-content");
   
    HTMLNode activityList = drawActivity(activityInfoboxContent, node);
   
    int numARKFetchers = node.getNumARKFetchers();

    if (advancedModeEnabled && activityList != null) {
      if (numARKFetchers > 0)
        activityList.addChild("li", "ARK\u00a0Fetch\u00a0Requests:\u00a0" + numARKFetchers);
      activityList.addChild("li", "BackgroundFetcherByUSKSize:\u00a0" + node.clientCore.uskManager.getBackgroundFetcherByUSKSize());
      activityList.addChild("li", "temporaryBackgroundFetchersLRUSize:\u00a0" + node.clientCore.uskManager.getTemporaryBackgroundFetchersLRU());
      activityList.addChild("li", "outputBandwidthLiabilityUsage:\u00a0" + this.fix3p1pct.format(node.nodeStats.getBandwidthLiabilityUsage()));
    }
   
  }
View Full Code Here

        (numCHKOfferReplys == 0) && (numSSKOfferReplys == 0)) {
      activityInfoboxContent.addChild("#", l10n("noRequests"));
     
      return null;
    } else {
      HTMLNode activityList = activityInfoboxContent.addChild("ul");
      if (numCHKInserts > 0 || numSSKInserts > 0) {
        activityList.addChild("li", NodeL10n.getBase().getString("StatisticsToadlet.activityInserts",
            new String[] { "CHKhandlers", "SSKhandlers", "local" } ,
            new String[] { Integer.toString(numCHKInserts), Integer.toString(numSSKInserts), Integer.toString(numLocalCHKInserts)+"/" + Integer.toString(numLocalSSKInserts)}));
      }
      if (numCHKRequests > 0 || numSSKRequests > 0) {
        activityList.addChild("li", NodeL10n.getBase().getString("StatisticsToadlet.activityRequests",
            new String[] { "CHKhandlers", "SSKhandlers", "local" } ,
            new String[] { Integer.toString(numCHKRequests), Integer.toString(numSSKRequests), Integer.toString(numLocalCHKRequests)+"/" + Integer.toString(numLocalSSKRequests)}));
      }
      if (numTransferringRequests > 0 || numTransferringRequestHandlers > 0) {
        activityList.addChild("li", NodeL10n.getBase().getString("StatisticsToadlet.transferringRequests",
            new String[] { "senders", "receivers", "turtles" }, new String[] { Integer.toString(numTransferringRequests), Integer.toString(numTransferringRequestHandlers), "0"}));
      }
      if (numCHKOfferReplys > 0 || numSSKOfferReplys > 0) {
        activityList.addChild("li", NodeL10n.getBase().getString("StatisticsToadlet.offerReplys",
            new String[] { "chk", "ssk" }, new String[] { Integer.toString(numCHKOfferReplys), Integer.toString(numSSKOfferReplys) }));
      }
      activityList.addChild("li", NodeL10n.getBase().getString("StatisticsToadlet.runningBlockTransfers",
          new String[] { "sends", "receives" }, new String[] { Integer.toString(BlockTransmitter.getRunningSends()), Integer.toString(BlockReceiver.getRunningReceives()) }));
      return activityList;
    }
  }
View Full Code Here

    }
    (isRealtime ? localSSKFetchTimeAverageRT : localSSKFetchTimeAverageBulk).report(rtt);
  }

  public void fillDetailedTimingsBox(HTMLNode html) {
    HTMLNode table = html.addChild("table");
    HTMLNode row = table.addChild("tr");
    row.addChild("td");
    row.addChild("td", "colspan", "2", "CHK");
    row.addChild("td", "colspan", "2", "SSK");
    row = table.addChild("tr");
    row.addChild("td", l10n("successfulHeader"));
    row.addChild("td", TimeUtil.formatTime((long)successfulLocalCHKFetchTimeAverageBulk.currentValue(), 2, true));
    row.addChild("td", TimeUtil.formatTime((long)successfulLocalCHKFetchTimeAverageRT.currentValue(), 2, true));
    row.addChild("td", TimeUtil.formatTime((long)successfulLocalSSKFetchTimeAverageBulk.currentValue(), 2, true));
    row.addChild("td", TimeUtil.formatTime((long)successfulLocalSSKFetchTimeAverageRT.currentValue(), 2, true));
    row = table.addChild("tr");
    row.addChild("td", l10n("unsuccessfulHeader"));
    row.addChild("td", TimeUtil.formatTime((long)unsuccessfulLocalCHKFetchTimeAverageBulk.currentValue(), 2, true));
    row.addChild("td", TimeUtil.formatTime((long)unsuccessfulLocalCHKFetchTimeAverageRT.currentValue(), 2, true));
    row.addChild("td", TimeUtil.formatTime((long)unsuccessfulLocalSSKFetchTimeAverageBulk.currentValue(), 2, true));
    row.addChild("td", TimeUtil.formatTime((long)unsuccessfulLocalSSKFetchTimeAverageRT.currentValue(), 2, true));
    row = table.addChild("tr");
    row.addChild("td", l10n("averageHeader"));
    row.addChild("td", TimeUtil.formatTime((long)localCHKFetchTimeAverageBulk.currentValue(), 2, true));
    row.addChild("td", TimeUtil.formatTime((long)localCHKFetchTimeAverageRT.currentValue(), 2, true));
    row.addChild("td", TimeUtil.formatTime((long)localSSKFetchTimeAverageBulk.currentValue(), 2, true));
    row.addChild("td", TimeUtil.formatTime((long)localSSKFetchTimeAverageRT.currentValue(), 2, true));
  }
View Full Code Here

  }

  private void drawOverviewBox(HTMLNode overviewInfobox, long nodeUptimeSeconds, long nodeUptimeTotal, long now, double swaps, double noSwaps) {
   
    overviewInfobox.addChild("div", "class", "infobox-header", "Node status overview");
    HTMLNode overviewInfoboxContent = overviewInfobox.addChild("div", "class", "infobox-content");
    HTMLNode overviewList = overviewInfoboxContent.addChild("ul");
    /* node status values */
    int bwlimitDelayTime = (int) stats.getBwlimitDelayTime();
    int bwlimitDelayTimeBulk = (int) stats.getBwlimitDelayTimeBulk();
    int bwlimitDelayTimeRT = (int) stats.getBwlimitDelayTimeRT();
    int nodeAveragePingTime = (int) stats.getNodeAveragePingTime();
    double numberOfRemotePeerLocationsSeenInSwaps = node.getNumberOfRemotePeerLocationsSeenInSwaps();

    // Darknet
    int darknetSizeEstimateSession = stats.getDarknetSizeEstimate(-1);
    int darknetSizeEstimate24h = 0;
    int darknetSizeEstimate48h = 0;
    if(nodeUptimeSeconds > HOURS.toSeconds(24)) {
      darknetSizeEstimate24h = stats.getDarknetSizeEstimate(now - HOURS.toMillis(24));
    }
    if(nodeUptimeSeconds > HOURS.toSeconds(48)) {
      darknetSizeEstimate48h = stats.getDarknetSizeEstimate(now - HOURS.toMillis(48));
    }
    // Opennet
    int opennetSizeEstimateSession = stats.getOpennetSizeEstimate(-1);
    int opennetSizeEstimate24h = 0;
    int opennetSizeEstimate48h = 0;
    if (nodeUptimeSeconds > HOURS.toSeconds(24)) {
      opennetSizeEstimate24h = stats.getOpennetSizeEstimate(now - HOURS.toMillis(24));
    }
    if (nodeUptimeSeconds > HOURS.toSeconds(48)) {
      opennetSizeEstimate48h = stats.getOpennetSizeEstimate(now - HOURS.toMillis(48));
    }
   
    double routingMissDistanceLocal =  stats.routingMissDistanceLocal.currentValue();
    double routingMissDistanceRemote =  stats.routingMissDistanceRemote.currentValue();
    double routingMissDistanceOverall =  stats.routingMissDistanceOverall.currentValue();
    double routingMissDistanceBulk =  stats.routingMissDistanceBulk.currentValue();
    double routingMissDistanceRT =  stats.routingMissDistanceRT.currentValue();
    double backedOffPercent =  stats.backedOffPercent.currentValue();
    overviewList.addChild("li", "bwlimitDelayTime:\u00a0" + bwlimitDelayTime + "ms");
    overviewList.addChild("li", "bwlimitDelayTimeBulk:\u00a0" + bwlimitDelayTimeBulk + "ms");
    overviewList.addChild("li", "bwlimitDelayTimeRT:\u00a0" + bwlimitDelayTimeRT + "ms");
    overviewList.addChild("li", "nodeAveragePingTime:\u00a0" + nodeAveragePingTime + "ms");
    overviewList.addChild("li", "darknetSizeEstimateSession:\u00a0" + darknetSizeEstimateSession + "\u00a0nodes");
    if(nodeUptimeSeconds > DAYS.toSeconds(1)) {
      overviewList.addChild("li", "darknetSizeEstimate24h:\u00a0" + darknetSizeEstimate24h + "\u00a0nodes");
    }
    if(nodeUptimeSeconds > DAYS.toSeconds(2)) {
      overviewList.addChild("li", "darknetSizeEstimate48h:\u00a0" + darknetSizeEstimate48h + "\u00a0nodes");
    }
    overviewList.addChild("li", "opennetSizeEstimateSession:\u00a0" + opennetSizeEstimateSession + "\u00a0nodes");
    if (nodeUptimeSeconds > DAYS.toSeconds(1)) {
      overviewList.addChild("li", "opennetSizeEstimate24h:\u00a0" + opennetSizeEstimate24h + "\u00a0nodes");
    }
    if (nodeUptimeSeconds > DAYS.toSeconds(2)) {
      overviewList.addChild("li", "opennetSizeEstimate48h:\u00a0" + opennetSizeEstimate48h + "\u00a0nodes");
    }
    if ((numberOfRemotePeerLocationsSeenInSwaps > 0.0) && ((swaps > 0.0) || (noSwaps > 0.0))) {
      overviewList.addChild("li", "avrConnPeersPerNode:\u00a0" + fix6p6.format(numberOfRemotePeerLocationsSeenInSwaps/(swaps+noSwaps)) + "\u00a0peers");
    }
    overviewList.addChild("li", "nodeUptimeSession:\u00a0" + TimeUtil.formatTime(MILLISECONDS.convert(nodeUptimeSeconds, SECONDS)));
    overviewList.addChild("li", "nodeUptimeTotal:\u00a0" + TimeUtil.formatTime(nodeUptimeTotal));
    overviewList.addChild("li", "routingMissDistanceLocal:\u00a0" + fix1p4.format(routingMissDistanceLocal));
    overviewList.addChild("li", "routingMissDistanceRemote:\u00a0" + fix1p4.format(routingMissDistanceRemote));
    overviewList.addChild("li", "routingMissDistanceOverall:\u00a0" + fix1p4.format(routingMissDistanceOverall));
    overviewList.addChild("li", "routingMissDistanceBulk:\u00a0" + fix1p4.format(routingMissDistanceBulk));
    overviewList.addChild("li", "routingMissDistanceRT:\u00a0" + fix1p4.format(routingMissDistanceRT));
    overviewList.addChild("li", "backedOffPercent:\u00a0" + fix3p1pct.format(backedOffPercent));
    overviewList.addChild("li", "pInstantReject:\u00a0" + fix3p1pct.format(stats.pRejectIncomingInstantly()));
    overviewList.addChild("li", "pInstantRejectRequestBulk:\u00a0" + fix3p1pct.format(stats.pRejectIncomingInstantlyCHKRequestBulk())+" (CHK) "+fix3p1pct.format(stats.pRejectIncomingInstantlySSKRequestBulk())+" (SSK)");
    overviewList.addChild("li", "pInstantRejectInsertBulk:\u00a0" + fix3p1pct.format(stats.pRejectIncomingInstantlyCHKInsertBulk())+" (CHK) "+fix3p1pct.format(stats.pRejectIncomingInstantlySSKInsertBulk())+" (SSK)");
    overviewList.addChild("li", "pInstantRejectRequestRT:\u00a0" + fix3p1pct.format(stats.pRejectIncomingInstantlyCHKRequestRT())+" (CHK) "+fix3p1pct.format(stats.pRejectIncomingInstantlySSKRequestRT())+" (SSK)");
    overviewList.addChild("li", "pInstantRejectInsertRT:\u00a0" + fix3p1pct.format(stats.pRejectIncomingInstantlyCHKInsertRT())+" (CHK) "+fix3p1pct.format(stats.pRejectIncomingInstantlySSKInsertRT())+" (SSK)");
    overviewList.addChild("li", "unclaimedFIFOSize:\u00a0" + node.getUnclaimedFIFOSize());
    overviewList.addChild("li", "RAMBucketPoolSize:\u00a0" + SizeUtil.formatSize(core.tempBucketFactory.getRamUsed())+ " / "+ SizeUtil.formatSize(core.tempBucketFactory.getMaxRamUsed()));
    overviewList.addChild("li", "uptimeAverage:\u00a0" + fix3p1pct.format(node.uptime.getUptime()));
   
    long[] decoded = IncomingPacketFilterImpl.getDecodedPackets();
    if(decoded != null) {
      overviewList.addChild("li", "packetsDecoded:\u00a0"+fix3p1pct.format(((double)decoded[0])/((double)decoded[1]))+"\u00a0("+decoded[1]+")");
    }
   
  }
View Full Code Here

  }

  private void drawBandwidthBox(HTMLNode bandwidthInfobox, long nodeUptimeSeconds, boolean isAdvancedModeEnabled) {
   
    bandwidthInfobox.addChild("div", "class", "infobox-header", l10n("bandwidthTitle"));
    HTMLNode bandwidthInfoboxContent = bandwidthInfobox.addChild("div", "class", "infobox-content");
    HTMLNode bandwidthList = bandwidthInfoboxContent.addChild("ul");
    drawBandwidth(bandwidthList, node, nodeUptimeSeconds, isAdvancedModeEnabled);
   
  }
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.