Package freenet.node.stats

Examples of freenet.node.stats.StoreAccessStats


    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");
      }
View Full Code Here


    return 0;
  }

  @Override
  public StoreAccessStats getSessionAccessStats() {
    return new StoreAccessStats() {

      @Override
      public long hits() {
        return 0;
      }
View Full Code Here

    }
  }
 
  @Override
  public StoreAccessStats getSessionAccessStats() {
    return new StoreAccessStats() {

      @Override
      public long hits() {
        return hits;
      }
View Full Code Here

    maxLifetime = val;
  }
 
  @Override
  public StoreAccessStats getSessionAccessStats() {
    return new StoreAccessStats() {

      @Override
      public long hits() {
        return hits;
      }
View Full Code Here

    textBuilder.append("Store Size:\n");
    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;
      try {
        totalAccess = stats.getTotalAccessStats();
      } catch (StatsNotAvailableException e) {
        totalAccess = null;
      }
      textBuilder.append(l10n(instance.store.name())).append(": (").append(l10n(instance.key.name())).append(")\n");
      textBuilder.append("  ").append(l10n("keys")).append(": ").append(thousandPoint.format(stats.keys())).append("\n");
      textBuilder.append("  ").append(l10n("capacity")).append(": ").append(thousandPoint.format(stats.capacity())).append("\n");
      textBuilder.append("  ").append(l10n("datasize")).append(": ").append(SizeUtil.formatSize(stats.dataSize())).append("\n");
      textBuilder.append("  ").append(l10n("utilization")).append(": ").append(fix3p1pct.format(stats.utilization())).append("\n");
      textBuilder.append("  ").append(l10n("readRequests")).append(": ").append(thousandPoint.format(sessionAccess.readRequests()) +
          (totalAccess == null ? "" : (" ("+thousandPoint.format(totalAccess.readRequests())+")"))).append("\n");
      textBuilder.append("  ").append(l10n("successfulReads")).append(": ").append(thousandPoint.format(sessionAccess.successfulReads()) +
          (totalAccess == null ? "" : (" ("+thousandPoint.format(totalAccess.successfulReads())+")"))).append("\n");
      try {
        textBuilder.append(fix1p4.format(sessionAccess.successRate())).append("%");
        if(totalAccess != null) {
          try {
            textBuilder.append(" (").append(fix1p4.format(totalAccess.successRate())).append("%)");
          } catch (StatsNotAvailableException e) {
            // Ignore
          }
        }
        textBuilder.append("\n");
View Full Code Here

    return super.toString()+":"+name;
  }
 
  @Override
  public StoreAccessStats getSessionAccessStats() {
    return new StoreAccessStats() {

      @Override
      public long hits() {
        return hits.get() - initialHits;
      }
View Full Code Here

    };
  }

  @Override
  public StoreAccessStats getTotalAccessStats() {
    return new StoreAccessStats() {

      @Override
      public long hits() {
        return hits.get();
      }
View Full Code Here

TOP

Related Classes of freenet.node.stats.StoreAccessStats

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.