Skip to content
Permalink
Browse files
GEODE-6086: Looking for the output files in the correct location
GEODE-6086: Looking for the output files in the correct location

Yardstick creates a subdirectory, so find the files in that directory
  • Loading branch information
upthewaterspout committed Nov 26, 2018
1 parent 8699d66 commit 27ce7198f9fd200e5c6fc12fb6e1af90462d7cb1
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
@@ -15,12 +15,16 @@
package org.apache.geode.perftest.analysis;

import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;

import org.apache.geode.perftest.yardstick.YardstickTask;

/**
* Analyzer that takes in benchmarks, probes, and result directories and produces
* a comparison of the results to a provided writer.
@@ -30,9 +34,11 @@
* Result1
* /BenchmarkA
* /client1
* /Probe1.csv
* /20181121-111354-yardstick-output
* /Probe1.csv
* /client2
* /Probe2.csv
* /20181121-111354-yardstick-output
* /Probe1.csv
* /BenchmarkB
* ...
* </pre>
@@ -65,13 +71,13 @@ public void analyzeTestRun(File testResultDir, File baselineResultDir, Writer ou
for (ProbeResultParser probe : probes) {
stream.println(probe.getResultDescription());
for (String node : benchmark.nodesToParse) {
probe.parseResults(new File(new File(testResultDir, benchmark.benchmarkSubdirectory), node));
probe.parseResults(getBenchmarkOutputDir(testResultDir, benchmark, node));
}
double testResult = probe.getProbeResult();
stream.println("Result: " + String.valueOf(testResult));
probe.reset();
for (String node : benchmark.nodesToParse) {
probe.parseResults(new File(new File(baselineResultDir, benchmark.benchmarkSubdirectory), node));
probe.parseResults(getBenchmarkOutputDir(baselineResultDir, benchmark, node));
}
double baselineResult = probe.getProbeResult();
stream.println("Baseline: " + String.valueOf(baselineResult));
@@ -83,6 +89,21 @@ public void analyzeTestRun(File testResultDir, File baselineResultDir, Writer ou
stream.flush();
}

private File getBenchmarkOutputDir(File testResultDir, SensorData benchmark,
String node) {
File benchmarkDir = new File(testResultDir, benchmark.benchmarkSubdirectory);
File nodeDir = new File(benchmarkDir, node);

File[] files = nodeDir.listFiles((dir, name) -> name.contains(YardstickTask.YARDSTICK_OUTPUT));

if(files == null || files.length != 1) {
throw new IllegalStateException("Expected at least one subdirectory in " + nodeDir
+ " with the name *" +YardstickTask.YARDSTICK_OUTPUT);
}

return files[0];
}

// TODO: depending on how run output is stored, this data may be excessive or insufficient
// The present assumption is each benchmark contains an arbitrarily named result directory
// containing subdirectories for each node. Those subdirectories then contain the probe output
@@ -41,6 +41,7 @@
* is executed, it will use yardstick to run an measure the driver.
*/
public class YardstickTask implements Task {
public static final String YARDSTICK_OUTPUT = "-yardstick-output";
private final BenchmarkDriver benchmark;
private WorkloadConfig workloadConfig;

@@ -77,6 +78,11 @@ public int threads() {
public String outputFolder() {
return context.getOutputDir().getAbsolutePath();
}

@Override
public String defaultDescription() {
return YARDSTICK_OUTPUT;
}
};
cfg.output(System.out);

@@ -43,15 +43,15 @@ public class BenchmarkRunAnalyzerTest {
@Test
public void verifyResultHarvester() throws IOException {
final File testFolder = temporaryFolder.newFolder("testFolder");
final File testBenchmarkA1 = temporaryFolder.newFolder("testFolder","BenchmarkA","client1");
final File testBenchmarkA2 = temporaryFolder.newFolder("testFolder","BenchmarkA","client2");
final File testBenchmarkB1 = temporaryFolder.newFolder("testFolder","BenchmarkB","client1");
final File testBenchmarkB2 = temporaryFolder.newFolder("testFolder","BenchmarkB","client2");
final File testBenchmarkA1 = temporaryFolder.newFolder("testFolder","BenchmarkA","client1", "20181121-111516-yardstick-output");
final File testBenchmarkA2 = temporaryFolder.newFolder("testFolder","BenchmarkA","client2", "20181121-111516-yardstick-output");
final File testBenchmarkB1 = temporaryFolder.newFolder("testFolder","BenchmarkB","client1", "20181121-111516-yardstick-output");
final File testBenchmarkB2 = temporaryFolder.newFolder("testFolder","BenchmarkB","client2", "20181121-111516-yardstick-output");
final File baseFolder = temporaryFolder.newFolder("baseFolder");
final File baseBenchmarkA1 = temporaryFolder.newFolder("baseFolder","BenchmarkA","client1");
final File baseBenchmarkA2 = temporaryFolder.newFolder("baseFolder","BenchmarkA","client2");
final File baseBenchmarkB1 = temporaryFolder.newFolder("baseFolder","BenchmarkB","client1");
final File baseBenchmarkB2 = temporaryFolder.newFolder("baseFolder","BenchmarkB","client2");
final File baseBenchmarkA1 = temporaryFolder.newFolder("baseFolder","BenchmarkA","client1", "20181121-111516-yardstick-output");
final File baseBenchmarkA2 = temporaryFolder.newFolder("baseFolder","BenchmarkA","client2", "20181121-111516-yardstick-output");
final File baseBenchmarkB1 = temporaryFolder.newFolder("baseFolder","BenchmarkB","client1", "20181121-111516-yardstick-output");
final File baseBenchmarkB2 = temporaryFolder.newFolder("baseFolder","BenchmarkB","client2", "20181121-111516-yardstick-output");

populateThroughputCSV(testBenchmarkA1, new double[] {10, 15, 20, 25, 30}); // Avg 20
populatePercentileCSV(testBenchmarkA1, new double[] {0, 0, 99, 1}); // 200

0 comments on commit 27ce719

Please sign in to comment.