/**
  * @param type Benchmark
  * @param name String
  * @param time long
  * @param count long
  */
 public static synchronized void mark(Benchmark type, String name, long time, long count) {
   String typeName = type.name;
   if (typeName != null && name != null) {
     throw new IllegalArgumentException("Name cannot be given for type: " + type);
   } else if (typeName == null && name == null) {
     throw new IllegalArgumentException("Name is required for type: " + type);
   } else if (typeName == null) {
     typeName = name;
   }
   BenchmarkResult benchmarkResult = BenchmarksByName.get(typeName);
   if (benchmarkResult == null) {
     benchmarkResult = new BenchmarkResult(type, typeName);
     BenchmarksByName.put(typeName, benchmarkResult);
   }
   benchmarkResult.update(time, count);
 }
  private static Map<GraphSet, Map<Algorithm, BenchmarkResult>> constructGraphAlgorithmResults(
      BenchmarkSuiteResult benchmarkSuiteResult) {
    // Construct a map of maps to hold the results
    Map<GraphSet, Map<Algorithm, BenchmarkResult>> graphAlgorithmResults = new HashMap<>();
    for (GraphSet graph : benchmarkSuiteResult.getBenchmarkSuite().getGraphSets()) {
      graphAlgorithmResults.put(graph, new HashMap<Algorithm, BenchmarkResult>());
    }

    // Insert the results from the benchmark suite
    for (BenchmarkResult benchmarkResult : benchmarkSuiteResult.getBenchmarkResults()) {
      graphAlgorithmResults
          .get(benchmarkResult.getBenchmark().getGraph().getGraphSet())
          .put(benchmarkResult.getBenchmark().getAlgorithm(), benchmarkResult);
    }

    // Make the map unmodifiable
    for (GraphSet graph : benchmarkSuiteResult.getBenchmarkSuite().getGraphSets()) {
      graphAlgorithmResults.put(
          graph, Collections.unmodifiableMap(graphAlgorithmResults.get(graph)));
    }
    return Collections.unmodifiableMap(graphAlgorithmResults);
  }
 @Override
 public void aborted(BenchmarkResult result) {
   System.out.println();
   System.out.println("Benchmark aborted: " + result.getTitle());
   System.out.println("Number of errors: " + result.getNumErrors());
 }