int size = pms.size();
Set<Entry<String, PerformanceMetricsSummaryItem>> set = pms.entrySet();
ArrayList<PerformanceMetricsSummaryItem> items = new ArrayList<PerformanceMetricsSummaryItem>();
int maxl = 0;
for ( Entry<String, PerformanceMetricsSummaryItem> e : set ) {
PerformanceMetricsSummaryItem pmi = e.getValue();
String k = pmi.getUniqueName();
maxl = Math.max(maxl, k.length());
items.add(pmi);
}
Comparator<PerformanceMetricsSummaryItem> sorter = null;
switch (summarySort) {
case ItemsProcessed: sorter = new SummaryItemsProcessedSorter(); break;
case MaxTime: sorter = new SummaryMaxTimeSorter(); break;
case MinTime: sorter = new SummaryMinTimeSorter(); break;
case Name: sorter = new SummaryNameSorter(); break;
case TotalTime: sorter = new SummaryTimeSorter(); break;
}
Collections.sort(items, sorter);
String fmt;
if ( csv ) {
fmt = "%d\t%d\t%d\t%d\t%s";
System.out.println(""+size + "," + cascount);
} else {
System.out.println("Size: " + size + " CASCount: " + cascount);
fmt = "%16s %16s %16s %16s %-" + maxl + "s";
System.out.println(String.format(fmt, "Total Time", "Max Time", "Min Time", "Items Processed", "Name"));
System.out.println(String.format(fmt, "----------", "--------", "--------", "---------------", dup("-", maxl)));
fmt = "%16d %16d %16d %16d %-" + maxl + "s";
}
for ( int i = 0; i < items.size(); i++ ) {
PerformanceMetricsSummaryItem pmi = items.get(i);
System.out.println(String.format(fmt, pmi.getAnalysisTime(), pmi.getAnalysisTimeMax(), pmi.getAnalysisTimeMin(), pmi.getNumProcessed(), pmi.getUniqueName()));
}
}