changeset 355:8d1e26a55e09

BenchmarkRecord: escape "," to dodge unlucky match.
author shade
date Mon, 20 Jan 2014 20:49:30 +0400
parents 7010d38ef764
children a98b9913eca2
files jmh-core/src/main/java/org/openjdk/jmh/runner/BenchmarkRecord.java
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/BenchmarkRecord.java	Mon Jan 20 20:04:34 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/BenchmarkRecord.java	Mon Jan 20 20:49:30 2014 +0400
@@ -33,6 +33,8 @@
 
 public class BenchmarkRecord implements Comparable<BenchmarkRecord>, Serializable {
 
+    private static final String BR_SEPARATOR = "===,===";
+
     private final String userName;
     private final String generatedName;
     private final Mode mode;
@@ -69,7 +71,7 @@
     }
 
     public BenchmarkRecord(String line) {
-        String[] args = line.split(",");
+        String[] args = line.split(BR_SEPARATOR);
 
         if (args.length != 14) {
             throw new IllegalStateException("Mismatched format for the line: " + line);
@@ -98,11 +100,11 @@
     }
 
     public String toLine() {
-        return userName + "," + generatedName + "," + mode + "," + convert(threadGroups) + "," + threads + "," +
-                warmupIterations + "," + warmupTime + "," + measurementIterations + "," + measurementTime + "," +
-                forks + "," + warmupForks + "," +
-                jvmArgs.toString(Optional.STRING_COLLECTION_MARSHALLER) + "," +
-                jvmArgsPrepend.toString(Optional.STRING_COLLECTION_MARSHALLER) + "," +
+        return userName + BR_SEPARATOR + generatedName + BR_SEPARATOR + mode + BR_SEPARATOR + convert(threadGroups) + BR_SEPARATOR +
+                threads + BR_SEPARATOR + warmupIterations + BR_SEPARATOR + warmupTime + BR_SEPARATOR + measurementIterations + BR_SEPARATOR +
+                measurementTime + BR_SEPARATOR + forks + BR_SEPARATOR + warmupForks + BR_SEPARATOR +
+                jvmArgs.toString(Optional.STRING_COLLECTION_MARSHALLER) + BR_SEPARATOR +
+                jvmArgsPrepend.toString(Optional.STRING_COLLECTION_MARSHALLER) + BR_SEPARATOR +
                 jvmArgsAppend.toString(Optional.STRING_COLLECTION_MARSHALLER);
     }