@@ -55,27 +55,28 @@ public class CodeCacheTest {
5555 *
5656 * Expected output without code cache segmentation:
5757 *
58- * CodeCache: size=245760Kb used=4680Kb max_used=4680Kb free=241079Kb
59- * bounds [0x00007f5bd9000000, 0x00007f5bd94a0000, 0x00007f5be8000000 ]
60- * total_blobs=575 nmethods=69 adapters=423
61- * compilation : enabled
58+ * CodeCache: size=245760Kb used=1366Kb max_used=1935Kb free=244393Kb
59+ * bounds [0x00007ff4d89f2000, 0x00007ff4d8c62000, 0x00007ff4e79f2000 ]
60+ * total_blobs=474, nmethods=87, adapters=293, full_count=0
61+ * Compilation : enabled, stopped_count=0, restarted_count=0
6262 *
6363 * Expected output with code cache segmentation (number of segments may change):
6464 *
65- * CodeHeap 'non-nmethods': size=5696Kb used=2236Kb max_used=2238Kb free=3459Kb
66- * bounds [0x00007fa0f0ffe000, 0x00007fa0f126e000, 0x00007fa0f158e000]
67- * CodeHeap 'profiled nmethods': size=120036Kb used=8Kb max_used=8Kb free=120027Kb
68- * bounds [0x00007fa0f158e000, 0x00007fa0f17fe000, 0x00007fa0f8ac7000]
69- * CodeHeap 'non-profiled nmethods': size=120036Kb used=2Kb max_used=2Kb free=120034Kb
70- * bounds [0x00007fa0f8ac7000, 0x00007fa0f8d37000, 0x00007fa100000000]
71- * total_blobs=486 nmethods=8 adapters=399
72- * compilation: enabled
65+ * CodeHeap 'non-profiled nmethods': size=118592Kb used=29Kb max_used=29Kb free=118562Kb
66+ * bounds [0x00007f09f8622000, 0x00007f09f8892000, 0x00007f09ff9f2000]
67+ * CodeHeap 'profiled nmethods': size=118588Kb used=80Kb max_used=80Kb free=118507Kb
68+ * bounds [0x00007f09f09f2000, 0x00007f09f0c62000, 0x00007f09f7dc1000]
69+ * CodeHeap 'non-nmethods': size=8580Kb used=1257Kb max_used=1833Kb free=7323Kb
70+ * bounds [0x00007f09f7dc1000, 0x00007f09f8031000, 0x00007f09f8622000]
71+ * CodeCache: size=245760Kb, used=1366Kb, max_used=1942Kb, free=244392Kb
72+ * total_blobs=474, nmethods=87, adapters=293, full_count=0
73+ * Compilation: enabled, stopped_count=0, restarted_count=0
7374 */
7475
7576 static Pattern line1 = Pattern .compile ("(CodeCache|CodeHeap.*): size=(\\ p{Digit}*)Kb used=(\\ p{Digit}*)Kb max_used=(\\ p{Digit}*)Kb free=(\\ p{Digit}*)Kb" );
7677 static Pattern line2 = Pattern .compile (" bounds \\ [0x(\\ p{XDigit}*), 0x(\\ p{XDigit}*), 0x(\\ p{XDigit}*)\\ ]" );
77- static Pattern line3 = Pattern .compile (" total_blobs=(\\ p{Digit}*) nmethods=(\\ p{Digit}*) adapters=(\\ p{Digit}*)" );
78- static Pattern line4 = Pattern .compile (" compilation : (.*)" );
78+ static Pattern line3 = Pattern .compile (" total_blobs=(\\ p{Digit}*), nmethods=(\\ p{Digit}*), adapters=( \\ p{Digit}*), full_count =(\\ p{Digit}*)" );
79+ static Pattern line4 = Pattern .compile ("Compilation : (.*?), stopped_count=( \\ p{Digit}*), restarted_count=( \\ p{Digit} *)" );
7980
8081 private static boolean getFlagBool (String flag , String where ) {
8182 Matcher m = Pattern .compile (flag + "\\ s+:?= (true|false)" ).matcher (where );
@@ -157,6 +158,10 @@ public void run(CommandExecutor executor) {
157158 Assert .fail ("Fewer segments matched (" + matchedCount + ") than expected (" + segmentsCount + ")" );
158159 }
159160
161+ if (segmentsCount != 1 ) {
162+ // Skip this line CodeCache: size=245760Kb, used=5698Kb, max_used=5735Kb, free=240059Kb
163+ line = lines .next ();
164+ }
160165 // Validate third line
161166 m = line3 .matcher (line );
162167 if (m .matches ()) {
@@ -182,7 +187,19 @@ public void run(CommandExecutor executor) {
182187 // Validate fourth line
183188 line = lines .next ();
184189 m = line4 .matcher (line );
185- if (!m .matches ()) {
190+ if (m .matches ()) {
191+ if (!m .group (1 ).contains ("enabled" ) && !m .group (1 ).contains ("disabled" )) {
192+ Assert .fail ("Failed parsing dcmd codecache output" );
193+ }
194+ int stopped = Integer .parseInt (m .group (2 ));
195+ if (stopped < 0 ) {
196+ Assert .fail ("Failed parsing dcmd codecache output" );
197+ }
198+ int restarted = Integer .parseInt (m .group (3 ));
199+ if (restarted < 0 ) {
200+ Assert .fail ("Failed parsing dcmd codecache output" );
201+ }
202+ } else {
186203 Assert .fail ("Regexp 4 failed to match line: " + line );
187204 }
188205 }
0 commit comments