Skip to content

Commit

Permalink
patch webpage generator
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerspitz committed Feb 9, 2022
1 parent d9823ca commit 8032fa2
Show file tree
Hide file tree
Showing 5 changed files with 201 additions and 525 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package com.gocypher.cybench;

import java.io.File;
import java.math.BigDecimal;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.ArrayList;
Expand Down Expand Up @@ -53,7 +53,6 @@ public class CompareBenchmarks {
private static final Logger log = LoggerFactory.getLogger(CompareBenchmarks.class);

private static String accessToken = null;
private static boolean useScriptConfigForPage = false;
public static boolean failBuildFlag = false;

public static int totalComparedBenchmarks = 0;
Expand All @@ -65,6 +64,8 @@ public class CompareBenchmarks {
public static List<ComparedBenchmark> failedBenchmarks = new ArrayList<>();
public static List<ComparedBenchmark> skippedBenchmarks = new ArrayList<>();

public static Instant comparisonRunTime;

public static void main(String... args) throws Exception {
logInfo("* Analyzing benchmark performance...");

Expand Down Expand Up @@ -117,9 +118,7 @@ public static void main(String... args) throws Exception {

if (scriptPath != null) {
logInfo("Attempting to evaluate custom defined script at {}\n", scriptPath);
// WebpageGenerator.sendToWebpageGenerator(scriptPath);
ComparatorScriptEngine cse = new ComparatorScriptEngine(passedProps, scriptPath);
useScriptConfigForPage = true;
} else {
if (configPath == null) {
logInfo("No script or config file specified, looking for comparator.yaml in default location");
Expand All @@ -129,7 +128,6 @@ public static void main(String... args) throws Exception {
logInfo("Attempting to load comparator configurations at {}\n", configPath);
Map<String, Object> allConfigs = ConfigHandling.loadYaml(configPath);
Map<String, String> configuredCategories = ConfigHandling.identifyAndValidifySpecificConfigs(allConfigs);
// WebpageGenerator.sendToWebpageGenerator(allConfigs, configuredCategories);

File recentReport = ConfigHandling
.identifyRecentReport((String) allConfigs.get(ConfigHandling.REPORT_PATH));
Expand All @@ -146,9 +144,6 @@ public static void main(String... args) throws Exception {
}
}
}
if (!useScriptConfigForPage) {
// WebpageGenerator.generatePage();
}
}

public static void setAccessToken(String token) {
Expand Down Expand Up @@ -176,6 +171,7 @@ private static void analyzeBenchmarks(File recentReport, Map<String, Object> all
}
Requests.getInstance().close();
logResults();
WebpageGenerator.generatePage();
}

private static CompareState compareSingleBenchmark(ComparedBenchmark benchmarkToCompare) {
Expand Down Expand Up @@ -289,7 +285,8 @@ public static Map<String, Object> compareAllBenchmarks(ComparisonConfig comparis
Map<String, Map<String, List<ComparedBenchmark>>> benchmarksToCompareAgainst) {
Map<String, Object> resultMap = new HashMap<>();
resultMap = Comparisons.runComparison(comparisonConfig, benchmarksToCompare, benchmarksToCompareAgainst);
resultMap.put("timestampUTC", ZonedDateTime.now(ZoneOffset.UTC).toInstant().toString());
comparisonRunTime = ZonedDateTime.now(ZoneOffset.UTC).toInstant();
resultMap.put("timestampUTC", comparisonRunTime.toString());
return resultMap;
}

Expand Down Expand Up @@ -318,6 +315,7 @@ public static void skipBenchmark(ComparedBenchmark benchmarkToCompare) {
}

public static void logResults() throws Exception {
comparisonRunTime = ZonedDateTime.now(ZoneOffset.UTC).toInstant();
System.out.print("\n\n");
logInfo("Comparing {}, version {}", Requests.project, Requests.currentVersion);
logInfo("compared={}, passed={}, (skipped={}), anomalies={}", totalComparedBenchmarks, totalPassedBenchmarks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
package com.gocypher.cybench.utils;

import java.io.*;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -183,6 +185,7 @@ private void runUserScript(ScriptEngine engine, File script) throws Exception {
reader = new FileReader(script);
engine.eval(reader);
CompareBenchmarks.logResults();
WebpageGenerator.generatePage();
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
Loading

0 comments on commit 8032fa2

Please sign in to comment.