You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by al...@apache.org on 2023/01/11 08:16:15 UTC

[camel-quarkus] branch main updated: perf-regression: write the report to disk #4263

This is an automated email from the ASF dual-hosted git repository.

aldettinger pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new e179835970 perf-regression: write the report to disk #4263
e179835970 is described below

commit e179835970efed284a1ce2bff10e543ee7f60d97
Author: aldettinger <al...@gmail.com>
AuthorDate: Tue Jan 10 17:20:45 2023 +0100

    perf-regression: write the report to disk #4263
---
 .gitignore                                             |  3 +++
 .../performance/regression/PerfRegressionCommand.java  | 18 +++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index daf7212195..4ed6ebafbb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,3 +41,6 @@ nb-configuration.xml
 
 # Quarkus
 quarkus.log*
+
+# Camel Quarkus Performance Regression Reports
+perf-regression-report@*.txt
diff --git a/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/PerfRegressionCommand.java b/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/PerfRegressionCommand.java
index a07100766e..983ef77185 100644
--- a/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/PerfRegressionCommand.java
+++ b/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/PerfRegressionCommand.java
@@ -16,12 +16,17 @@
  */
 package org.apache.camel.quarkus.performance.regression;
 
+import java.io.File;
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.text.DateFormat;
 import java.text.NumberFormat;
 import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.Locale;
 
 import org.apache.commons.io.FileUtils;
@@ -69,7 +74,18 @@ public class PerfRegressionCommand implements Runnable {
                 runPerfRegressionForCqVersion(cqVersionsUnderTestFolder.resolve(cqVersion), cqVersion, report);
             }
 
-            System.out.println(report.printAll());
+            String reportString = report.printAll();
+            System.out.println(reportString);
+
+            try {
+                DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH'h'mm'm'ss's'");
+                String date = dateFormat.format(new Date());
+                File reportFile = Paths.get("perf-regression-report@" + date + ".txt").toFile();
+                FileUtils.writeStringToFile(reportFile, reportString, StandardCharsets.UTF_8);
+            } catch (IOException ioex) {
+                throw new RuntimeException(
+                        "An issue has been caught while trying to write the performance regression report to a file.", ioex);
+            }
         } catch (IOException | XmlPullParserException e) {
             throw new RuntimeException("An issue has been caught while trying to setup performance regression tests.", e);
         }