Package freenet.support

Examples of freenet.support.BandwidthStatsContainer


    long total_output_rate = (total[0]) / nodeUptimeSeconds;
    long total_input_rate = (total[1]) / nodeUptimeSeconds;
    long totalPayload = node.getTotalPayloadSent();
    long total_payload_rate = totalPayload / nodeUptimeSeconds;
    if(node.clientCore == null) throw new NullPointerException();
    BandwidthStatsContainer stats = node.clientCore.bandwidthStatsPutter.getLatestBWData();
    if(stats == null) throw new NullPointerException();
    long overall_total_out = stats.totalBytesOut;
    long overall_total_in = stats.totalBytesIn;
    int percent = (int) (100 * totalPayload / total[0]);
    long[] rate = node.nodeStats.getNodeIOStats();
View Full Code Here


      long total_output_rate = (total[0]) / nodeUptimeSeconds;
      long total_input_rate = (total[1]) / nodeUptimeSeconds;
      long totalPayload = node.getTotalPayloadSent();
      long total_payload_rate = totalPayload / nodeUptimeSeconds;
      if(node.clientCore == null) throw new NullPointerException();
      BandwidthStatsContainer stats = node.clientCore.bandwidthStatsPutter.getLatestBWData();
      if(stats == null) throw new NullPointerException();
      long overall_total_out = stats.totalBytesOut;
      long overall_total_in = stats.totalBytesIn;
      int percent = (int) (100 * totalPayload / total[0]);
      long[] rate = node.nodeStats.getNodeIOStats();
      long delta = (rate[5] - rate[2]) / 1000;
      if(delta > 0) {
        long output_rate = (rate[3] - rate[0]) / delta;
        long input_rate = (rate[4] - rate[1]) / delta;
        int outputBandwidthLimit = nodeConfig.getInt("outputBandwidthLimit");
        int inputBandwidthLimit = nodeConfig.getInt("inputBandwidthLimit");
        if(inputBandwidthLimit == -1) {
          inputBandwidthLimit = outputBandwidthLimit * 4;
        }
        textBuilder.append(l10n("inputRate", new String[] { "rate", "max" }, new String[] { SizeUtil.formatSize(input_rate, true), SizeUtil.formatSize(inputBandwidthLimit, true) })).append("\n");
        textBuilder.append(l10n("outputRate", new String[] { "rate", "max" }, new String[] { SizeUtil.formatSize(output_rate, true), SizeUtil.formatSize(outputBandwidthLimit, true) })).append("\n");
      }
      textBuilder.append(l10n("totalInputSession", new String[] { "total", "rate" }, new String[] { SizeUtil.formatSize(total[1], true), SizeUtil.formatSize(total_input_rate, true) })).append("\n");
      textBuilder.append(l10n("totalOutputSession", new String[] { "total", "rate" }, new String[] { SizeUtil.formatSize(total[0], true), SizeUtil.formatSize(total_output_rate, true) } )).append("\n");
      textBuilder.append(l10n("payloadOutput", new String[] { "total", "rate", "percent" }, new String[] { SizeUtil.formatSize(totalPayload, true), SizeUtil.formatSize(total_payload_rate, true), Integer.toString(percent) } )).append("\n");
      textBuilder.append(l10n("totalInput", new String[] { "total" }, new String[] { SizeUtil.formatSize(overall_total_in, true) })).append("\n");
      textBuilder.append(l10n("totalOutput", new String[] { "total" }, new String[] { SizeUtil.formatSize(overall_total_out, true) } )).append("\n");
      long totalBytesSentCHKRequests = node.nodeStats.getCHKRequestTotalBytesSent();
      long totalBytesSentSSKRequests = node.nodeStats.getSSKRequestTotalBytesSent();
      long totalBytesSentCHKInserts = node.nodeStats.getCHKInsertTotalBytesSent();
      long totalBytesSentSSKInserts = node.nodeStats.getSSKInsertTotalBytesSent();
      long totalBytesSentOfferedKeys = node.nodeStats.getOfferedKeysTotalBytesSent();
      long totalBytesSendOffers = node.nodeStats.getOffersSentBytesSent();
      long totalBytesSentSwapOutput = node.nodeStats.getSwappingTotalBytesSent();
      long totalBytesSentAuth = node.nodeStats.getTotalAuthBytesSent();
      long totalBytesSentAckOnly = node.nodeStats.getNotificationOnlyPacketsSentBytes();
      long totalBytesSentResends = node.nodeStats.getResendBytesSent();
      long totalBytesSentUOM = node.nodeStats.getUOMBytesSent();
      long totalBytesSentAnnounce = node.nodeStats.getAnnounceBytesSent();
      long totalBytesSentAnnouncePayload = node.nodeStats.getAnnounceBytesPayloadSent();
      long totalBytesSentRoutingStatus = node.nodeStats.getRoutingStatusBytes();
      long totalBytesSentNetworkColoring = node.nodeStats.getNetworkColoringSentBytes();
      long totalBytesSentPing = node.nodeStats.getPingSentBytes();
      long totalBytesSentProbeRequest = node.nodeStats.getProbeRequestSentBytes();
      long totalBytesSentRouted = node.nodeStats.getRoutedMessageSentBytes();
      long totalBytesSentDisconn = node.nodeStats.getDisconnBytesSent();
      long totalBytesSentInitial = node.nodeStats.getInitialMessagesBytesSent();
      long totalBytesSentChangedIP = node.nodeStats.getChangedIPBytesSent();
      long totalBytesSentNodeToNode = node.nodeStats.getNodeToNodeBytesSent();
      long totalBytesSentAllocationNotices = node.nodeStats.getAllocationNoticesBytesSent();
      long totalBytesSentFOAF = node.nodeStats.getFOAFBytesSent();
      long totalBytesSentRemaining = total[0] -
        (totalPayload + totalBytesSentCHKRequests + totalBytesSentSSKRequests +
        totalBytesSentCHKInserts + totalBytesSentSSKInserts +
        totalBytesSentOfferedKeys + totalBytesSendOffers + totalBytesSentSwapOutput +
        totalBytesSentAuth + totalBytesSentAckOnly + totalBytesSentResends +
        totalBytesSentUOM + totalBytesSentAnnounce +
        totalBytesSentRoutingStatus + totalBytesSentNetworkColoring + totalBytesSentPing +
        totalBytesSentProbeRequest + totalBytesSentRouted + totalBytesSentDisconn +
        totalBytesSentInitial + totalBytesSentChangedIP + totalBytesSentNodeToNode + totalBytesSentAllocationNotices + totalBytesSentFOAF);
      textBuilder.append(l10n("requestOutput", new String[] { "chk", "ssk" }, new String[] { SizeUtil.formatSize(totalBytesSentCHKRequests, true), SizeUtil.formatSize(totalBytesSentSSKRequests, true) })).append("\n");
      textBuilder.append(l10n("insertOutput", new String[] { "chk", "ssk" }, new String[] { SizeUtil.formatSize(totalBytesSentCHKInserts, true), SizeUtil.formatSize(totalBytesSentSSKInserts, true) })).append("\n");
      textBuilder.append(l10n("offeredKeyOutput", new String[] { "total", "offered" }, new String[] { SizeUtil.formatSize(totalBytesSentOfferedKeys, true), SizeUtil.formatSize(totalBytesSendOffers, true) })).append("\n");
      textBuilder.append(l10n("swapOutput", "total", SizeUtil.formatSize(totalBytesSentSwapOutput, true))).append("\n");
      textBuilder.append(l10n("authBytes", "total", SizeUtil.formatSize(totalBytesSentAuth, true))).append("\n");
      textBuilder.append(l10n("ackOnlyBytes", "total", SizeUtil.formatSize(totalBytesSentAckOnly, true))).append("\n");
      textBuilder.append(l10n("resendBytes", new String[] { "total", "percent" }, new String[] { SizeUtil.formatSize(totalBytesSentResends, true), Long.toString((100 * totalBytesSentResends) / Math.max(1, total[0])) } )).append("\n");
      textBuilder.append(l10n("uomBytes", "total",  SizeUtil.formatSize(totalBytesSentUOM, true))).append("\n");
      textBuilder.append(l10n("announceBytes", new String[] { "total", "payload" }, new String[] { SizeUtil.formatSize(totalBytesSentAnnounce, true), SizeUtil.formatSize(totalBytesSentAnnouncePayload, true) })).append("\n");
      textBuilder.append(l10n("adminBytes", new String[] { "routingStatus", "disconn", "initial", "changedIP" }, new String[] { SizeUtil.formatSize(totalBytesSentRoutingStatus, true), SizeUtil.formatSize(totalBytesSentDisconn, true), SizeUtil.formatSize(totalBytesSentInitial, true), SizeUtil.formatSize(totalBytesSentChangedIP, true) })).append("\n");
      textBuilder.append(l10n("debuggingBytes", new String[] { "netColoring", "ping", "probe", "routed" }, new String[] { SizeUtil.formatSize(totalBytesSentNetworkColoring, true), SizeUtil.formatSize(totalBytesSentPing, true), SizeUtil.formatSize(totalBytesSentProbeRequest, true), SizeUtil.formatSize(totalBytesSentRouted, true) } )).append("\n");
      textBuilder.append(l10n("nodeToNodeBytes", "total", SizeUtil.formatSize(totalBytesSentNodeToNode, true))).append("\n");
      textBuilder.append(l10n("loadAllocationNoticesBytes", "total", SizeUtil.formatSize(totalBytesSentAllocationNotices, true))).append("\n");
      textBuilder.append(l10n("foafBytes", "total", SizeUtil.formatSize(totalBytesSentFOAF, true))).append("\n");
      textBuilder.append(l10n("unaccountedBytes", new String[] { "total", "percent" },
          new String[] { SizeUtil.formatSize(totalBytesSentRemaining, true), Integer.toString((int)(totalBytesSentRemaining*100 / total[0])) })).append("\n");
      double sentOverheadPerSecond = node.nodeStats.getSentOverheadPerSecond();
      textBuilder.append(l10n("totalOverhead", new String[] { "rate", "percent" },
          new String[] { SizeUtil.formatSize((long)sentOverheadPerSecond), Integer.toString((int)((100 * sentOverheadPerSecond) / total_output_rate)) })).append("\n");
    }
    textBuilder.append("\n");

    // showStartingPlugins
    textBuilder.append("Plugins:\n");
    PluginManager pm = node.pluginManager;
    if (!pm.getPlugins().isEmpty()) {
      textBuilder.append(baseL10n.getString("PluginToadlet.pluginListTitle")).append("\n");
      for(PluginInfoWrapper pi: pm.getPlugins()) {
        long ver = pi.getPluginLongVersion();
        if (ver != -1)
          textBuilder.append(pi.getFilename()).append(" (").append(pi.getPluginClassName()).append(") - " ).append(pi.getPluginVersion()+ " ("+ver+")").append(" ").append(pi.getThreadName()).append("\n");
        else
          textBuilder.append(pi.getFilename()).append(" (").append(pi.getPluginClassName()).append(") - ").append(pi.getPluginVersion()).append(" ").append(pi.getThreadName()).append("\n");
      }
    }
    textBuilder.append("\n");

    // handleGetInner
    textBuilder.append("Queue:\n");
    try {
      RequestStatus[] reqs = fcp.getGlobalRequests();
      if(reqs.length < 1)
        textBuilder.append(baseL10n.getString("QueueToadlet.globalQueueIsEmpty")).append("\n");
      else {
        long totalQueuedDownload = 0;
        long totalQueuedUpload = 0;
        for(RequestStatus req: reqs) {
          if(req instanceof DownloadRequestStatus) {
            totalQueuedDownload++;
          } else if(req instanceof UploadFileRequestStatus) {
            totalQueuedUpload++;
          } else if(req instanceof UploadDirRequestStatus) {
            totalQueuedUpload++;
          }
        }
        textBuilder.append("Downloads Queued: ").append(totalQueuedDownload).append(" (").append(totalQueuedDownload).append(")\n");
        textBuilder.append("Uploads Queued: ").append(totalQueuedUpload).append(" (").append(totalQueuedUpload).append(")\n");
      }
    } catch (PersistenceDisabledException e) {
      textBuilder.append("DatabaseDisabledException\n");
    }
    textBuilder.append("\n");

    // drawThreadPriorityStatsBox
    textBuilder.append("Threads:\n");
    int[] activeThreadsByPriority = stats.getActiveThreadsByPriority();
    int[] waitingThreadsByPriority = stats.getWaitingThreadsByPriority();
    for(int i=0; i<activeThreadsByPriority.length; i++) {
      textBuilder.append(l10n("running")).append(": ").append(String.valueOf(activeThreadsByPriority[i])).append(" (").append(String.valueOf(i+1)).append(")\n");
      textBuilder.append(l10n("waiting")).append(": ").append(String.valueOf(waitingThreadsByPriority[i])).append(" (").append(String.valueOf(i+1)).append(")\n");
    }
    textBuilder.append("\n");
View Full Code Here

TOP

Related Classes of freenet.support.BandwidthStatsContainer

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.