Skip to content

Commit

Permalink
Added benchmark overview report field 'benchmarkSessionId'.
Browse files Browse the repository at this point in the history
  • Loading branch information
kausandr committed Feb 3, 2022
1 parent 7affc3d commit cbe3ca7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ public void run() {

LOG.info("---> benchmarkSetting: {}", benchmarkSetting);

for (String s : report.getBenchmarks().keySet()) {
List<BenchmarkReport> custom = new ArrayList<>(report.getBenchmarks().get(s));
custom.forEach(benchmarkReport -> {
for (Map.Entry<String, List<BenchmarkReport>> benchmarksEntry : report.getBenchmarks().entrySet()) {
List<BenchmarkReport> benchmarks = benchmarksEntry.getValue();
benchmarks.forEach(benchmarkReport -> {
String name = benchmarkReport.getName();
benchmarkReport.setClassFingerprint(classFingerprints.get(name));
benchmarkReport.setGeneratedFingerprint(generatedFingerprints.get(name));
Expand Down Expand Up @@ -275,6 +275,16 @@ public void run() {
report.setProjectVersion(getMetadataFromBuildFile("version")); // default
benchmarkReport.setProjectVersion(getMetadataFromBuildFile("version"));
}

if (StringUtils.isEmpty(report.getBenchmarkSessionId())) {
Map<String, String> bMetadata = benchmarkReport.getMetadata();
if (bMetadata != null) {
String sessionId = bMetadata.get("benchSession");
if (StringUtils.isNotEmpty(sessionId)) {
report.setBenchmarkSessionId(sessionId);
}
}
}
} catch (Exception e) {
LOG.error("Error while attempting to setProject from runner: ", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class BenchmarkOverviewReport implements Serializable {
private long timestampUTC;
private String project;
private String projectVersion;
private String benchmarkSessionId;
private String reportURL;
private String deviceReportsURL;
private BigDecimal totalScore;
Expand Down Expand Up @@ -144,6 +145,14 @@ public void setProjectVersion(String projectVersion) {
this.projectVersion = projectVersion;
}

public String getBenchmarkSessionId() {
return benchmarkSessionId;
}

public void setBenchmarkSessionId(String benchmarkSessionId) {
this.benchmarkSessionId = benchmarkSessionId;
}

public Map<String, List<BenchmarkReport>> getBenchmarks() {
return benchmarks;
}
Expand Down Expand Up @@ -204,8 +213,9 @@ public void setDeviceReportsURL(String deviceReports) {
public String toString() {
return "BenchmarkOverviewReport{" + "timestamp=" + timestamp + ", timestampUTC=" + timestampUTC
+ ", totalScore=" + totalScore + ", project=" + project + ", projectVersion=" + projectVersion
+ ", categoriesOverview=" + categoriesOverview + ", environmentSettings=" + environmentSettings
+ ", benchmarks=" + benchmarks + ", reportURL=" + reportURL + '}';
+ ", sessionId=" + benchmarkSessionId + ", categoriesOverview=" + categoriesOverview
+ ", environmentSettings=" + environmentSettings + ", benchmarks=" + benchmarks + ", reportURL="
+ reportURL + '}';
}

}

0 comments on commit cbe3ca7

Please sign in to comment.