changeset 1256:a5592bff900c

7901464: perfnorm garbled output with perf_events 4.1
author shade
date Tue, 14 Jul 2015 00:28:56 +0300
parents 17c1ab8b1528
children 168a63020492
files jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfNormProfiler.java
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfNormProfiler.java	Mon Jul 13 23:53:10 2015 +0300
+++ b/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfNormProfiler.java	Tue Jul 14 00:28:56 2015 +0300
@@ -211,16 +211,14 @@
                 if (line.startsWith("#")) continue;
 
                 if (isIncrementable) {
-                    int idx1 = line.indexOf(",");
-                    int idx2 = line.lastIndexOf(",");
+                    String[] split = line.split(",");
 
                     // Malformed line, ignore
-                    if (idx1 == -1) continue nextline;
-                    if (idx2 == -1) continue nextline;
+                    if (split.length < 4) continue nextline;
 
-                    String time  = line.substring(0, idx1).trim();
-                    String count = line.substring(idx1, idx2 + 1).trim();
-                    String event = line.substring(idx2 + 1).trim();
+                    String time  = split[0].trim();
+                    String count = split[1].trim();
+                    String event = split[3].trim();
 
                     try {
                         double timeSec = NumberFormat.getInstance().parse(time).doubleValue();