Пример #1
0
 private void writeGnuplotHeaderSingle(
     Writer w, String dirName, String fileName, String operation, AbstractMeter meter, String ds)
     throws IOException {
   writeGnuplotHeaderCommon(w, dirName, fileName, meter.getUnit());
   w.writeln("set title \"Benchmarking " + meter.getName() + " on " + ds + " " + operation + "\"");
   w.writeln(
       "plot '"
           + dirName
           + fileName
           + rawExtension
           + "' using 1:2 notitle with lp linetype 1, \"\" using 1:2:3:4 title '"
           + ds
           + "' with errorbars linetype 1");
 }
Пример #2
0
  private void writeResultForGnuplot(
      AbstractMeter meter, String ds, String operation, int size, Collection<Double> values)
      throws IOException {
    String dirName = outputDir + "/" + meter.getName() + "/";

    // Write data for *single* plot
    String fileName = ds + "_" + operation;
    String extension = plotExtension;
    Writer w = fileWriters.get(dirName + fileName + extension);
    if (w == null) {
      w = new Writer(dirName, fileName + extension);
      writeGnuplotHeaderSingle(w, dirName, fileName, operation, meter, ds);
      fileWriters.put(dirName + fileName + extension, w);
    }

    extension = rawExtension;
    w = fileWriters.get(dirName + fileName + extension);
    if (w == null) {
      w = new Writer(dirName, fileName + extension);
      fileWriters.put(dirName + fileName + extension, w);
    }

    double min = Collections.min(values);
    double max = Collections.max(values);
    double mean = DoubleMath.mean(values);

    w.writeln(" " + size + " " + mean + " " + min + " " + max);

    // Check for the aggregation file
    extension = plotExtension;
    String innerLastWrittenOp = lastWrittenOp.get(dirName + operation + extension);

    if (innerLastWrittenOp == null || !innerLastWrittenOp.equals(operation)) {
      w = fileWriters.get(dirName + aggregationFile);
      if (w == null) {
        w = new Writer(dirName, aggregationFile, true);
        fileWriters.put(dirName + aggregationFile, w);
      }
      w.writeln(operation + ";" + meter.getUnit() + ";" + fileName + rawExtension);
    }
    lastWrittenOp.put(dirName + operation + extension, operation);
  }