changeset 1423:2e3213e9e8d4

7901967: -prof safepoints mishandles parsing when additional UL is enabled
author shade
date Tue, 02 May 2017 20:19:43 +0200
parents daa249176624
children cdac7ecd1392
files jmh-core/src/main/java/org/openjdk/jmh/profile/SafepointsProfiler.java jmh-core/src/test/java/org/openjdk/jmh/profile/SafepointsProfilerTest.java
diffstat 2 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/profile/SafepointsProfiler.java	Tue May 02 20:11:37 2017 +0200
+++ b/jmh-core/src/main/java/org/openjdk/jmh/profile/SafepointsProfiler.java	Tue May 02 20:19:43 2017 +0200
@@ -207,7 +207,7 @@
             Pattern.compile("([0-9\\.,]*): (.*) stopped: ([0-9\\.,]*) seconds, (.*) took: ([0-9\\.,]*) seconds");
 
     private static final Pattern JDK_9_LINE =
-            Pattern.compile("\\[([0-9\\.,]*)s\\]\\[info\\]\\[safepoint\\] (.*) stopped: ([0-9\\.,]*) seconds, (.*) took: ([0-9\\.,]*) seconds");
+            Pattern.compile("\\[([0-9\\.,]*)s\\]\\[info\\]\\[safepoint( *)\\] (.*) stopped: ([0-9\\.,]*) seconds, (.*) took: ([0-9\\.,]*) seconds");
 
     /**
      * Parse the line into the triplet. This is tested with unit tests, make sure to
@@ -244,8 +244,8 @@
                 return new ParsedData(
                         9,
                         parseNs(m.group(1)),
-                        parseNs(m.group(3)),
-                        parseNs(m.group(5))
+                        parseNs(m.group(4)),
+                        parseNs(m.group(6))
                 );
             }
         }
--- a/jmh-core/src/test/java/org/openjdk/jmh/profile/SafepointsProfilerTest.java	Tue May 02 20:11:37 2017 +0200
+++ b/jmh-core/src/test/java/org/openjdk/jmh/profile/SafepointsProfilerTest.java	Tue May 02 20:19:43 2017 +0200
@@ -89,4 +89,14 @@
         Assert.assertEquals(        51_600L, data.ttspTime);
     }
 
+    @Test
+    public void parseJDK9b140_Whitespace() {
+        SafepointsProfiler.ParsedData data = SafepointsProfiler.parse(
+                "[71,633s][info][safepoint    ] Total time for which application threads were stopped: 0,0359611 seconds, Stopping threads took: 0.0000516 seconds");
+        Assert.assertNotNull(data);
+        Assert.assertEquals(71_633_000_000L, data.timestamp);
+        Assert.assertEquals(    35_961_100L, data.stopTime);
+        Assert.assertEquals(        51_600L, data.ttspTime);
+    }
+
 }