Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@
*/
public class Benchmark implements Comparator<String> {

private static final Benchmark benchmarkInstance = new Benchmark();
String name;
private static final Benchmark benchmarkInstance = new Benchmark("");
private Map<String,BenchmarkMultiTimer> timerStore = new LinkedHashMap<>();
private Timer updateTimer = null;
private final ArrayList<String> specials = new ArrayList<>();

public Benchmark() {}
public Benchmark(String name) {
this.name = name;
}

public Benchmark(String[] specials) {
public Benchmark(String name, String[] specials) {
this.name = name;
this.specials.addAll(Arrays.asList(specials));
}

Expand Down Expand Up @@ -90,12 +94,12 @@ public String toString(){
int len = timers.iterator().next().toString().length();
char[] asterix = new char[len+8];
Arrays.fill(asterix,'*');
String margins = new String(asterix);
String margins = new String(asterix) + "\n";
s.append(margins);
s.append("\n");
s.append("* Benchmark Results \n");
s.append("* ");
s.append(name);
s.append(" Benchmarks\n");
s.append(margins);
s.append("\n");
for (BenchmarkTimer b : timers) {
s.append("* ");
s.append(b);
Expand All @@ -107,7 +111,6 @@ public String toString(){
timers.stream().mapToDouble(x -> x.getSeconds()).sum(),
timers.stream().mapToDouble(x -> x.getMillisecondsPerCall()).sum()));
s.append(margins);
s.append("\n");
}
return s.toString();
}
Expand Down
Loading