@Override
  public Collection<? extends Result> afterIteration(final BenchmarkParams benchmarkParams,
      final IterationParams iterationParams,
      final IterationResult result) {
    final ArrayList<ScalarResult> results = new ArrayList<>(pools.size());

    int i = 0;
    for (final BufferPoolMXBean pool : pools) {
      final long count = pool.getCount();
      if (count != 0) {
        final String name = pool.getName();
        results.add(new ScalarResult(name + ".count", count - previousCount[i], "B", AVG));
        results.add(
            new ScalarResult(name + ".memoryUsed", pool.getMemoryUsed() - previousMemoryUsed[i],
                "B", AVG));
        results.add(new ScalarResult(name + ".totalCapacity",
            pool.getTotalCapacity() - previousTotalCapacity[i], "B", AVG));
      }
      ++i;
    }

    return results;
  }
JMH profiler for JVM buffer pools using statistics available from {@link BufferPoolMXBean}.
geode-jmh/src/main/java/org/apache/geode/benchmark/jmh/profilers/BufferPoolProfiler.java