/**
   * Prints the verbose GC log to System.out to list the memory usage of all memory pools as well as
   * the GC statistics.
   */
  @Deprecated
  public String[] getVerboseGc() {
    String gcs = "";

    StringBuilder sb = new StringBuilder();
    sb.append("Uptime: " + StringFormatter.formatMillis(rmbean.getUptime()));

    for (GarbageCollectorMXBean gc : gcmbeans) {
      sb.append(" [" + gc.getName() + ": ");
      sb.append("Count=" + gc.getCollectionCount());
      sb.append(" GCTime=" + StringFormatter.formatMillis(gc.getCollectionTime()));
      sb.append("]");
      gcs +=
          StringFormatter.formatMillisShort(gc.getCollectionTime())
              + ":("
              + gc.getCollectionCount()
              + ");";
    }
    sb.append("\n");
    for (MemoryPoolMXBean p : pools) {
      sb.append("  [" + p.getName() + ":");
      MemoryUsage u = p.getUsage();
      sb.append(" Used=" + StringFormatter.formatBytes(u.getUsed()));
      sb.append(" Committed=" + StringFormatter.formatBytes(u.getCommitted()));
      sb.append("]\n");
    }

    return new String[] {sb.toString(), gcs};
  }
  public String getMemoryState() {
    try {
      StringBuilder sb = new StringBuilder();
      sb.append("Uptime: " + StringFormatter.formatMillis(rmbean.getUptime()));

      sb.append("\n");
      for (MemoryPoolMXBean p : pools) {
        sb.append("  [" + p.getName() + ":");
        MemoryUsage u = p.getUsage();
        sb.append(" Used=" + StringFormatter.formatBytes(u.getUsed()));
        sb.append(" Committed=" + StringFormatter.formatBytes(u.getCommitted()));
        sb.append("]\n");
      }

      return sb.toString();
    } catch (Throwable e) {
      return e.getMessage();
    }
  }