use of com.github.benmanes.caffeine.cache.simulator.policy.PolicyStats in project caffeine by ben-manes.
the class CsvReporter method assemble.
@Override
protected String assemble(List<PolicyStats> results) {
StringWriter output = new StringWriter();
CsvWriter writer = new CsvWriter(output, new CsvWriterSettings());
writer.writeHeaders(headers());
for (PolicyStats policyStats : results) {
Object[] data = new Object[] { policyStats.name(), String.format("%.2f", 100 * policyStats.hitRate()), policyStats.hitCount(), policyStats.missCount(), policyStats.requestCount(), policyStats.evictionCount(), String.format("%.2f", 100 * policyStats.admissionRate()), (policyStats.operationCount() == 0) ? null : policyStats.operationCount(), policyStats.stopwatch().elapsed(TimeUnit.MILLISECONDS) };
writer.writeRow(data);
}
writer.close();
return output.toString();
}
use of com.github.benmanes.caffeine.cache.simulator.policy.PolicyStats in project caffeine by ben-manes.
the class TableReporter method assemble.
/** Assembles an aggregated report. */
@Override
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
protected String assemble(List<PolicyStats> results) {
String[][] data = new String[results.size()][headers().length];
for (int i = 0; i < results.size(); i++) {
PolicyStats policyStats = results.get(i);
data[i] = new String[] { policyStats.name(), String.format("%.2f %%", 100 * policyStats.hitRate()), String.format("%,d", policyStats.hitCount()), String.format("%,d", policyStats.missCount()), String.format("%,d", policyStats.requestCount()), String.format("%,d", policyStats.evictionCount()), String.format("%.2f %%", 100 * policyStats.admissionRate()), steps(policyStats), policyStats.stopwatch().toString() };
}
return FlipTable.of(headers(), data);
}
Aggregations