< prev index next >

test/gc/g1/TestStringDeduplicationTools.java

Print this page




 304         }
 305 
 306         public static OutputAnalyzer run() throws Exception {
 307             return runTest("-XX:+PrintGC",
 308                            "-XX:+PrintGCDetails",
 309                            "-XX:+UseStringDeduplication",
 310                            "-XX:+PrintStringDeduplicationStatistics",
 311                            "-XX:StringDeduplicationAgeThreshold=" + DefaultAgeThreshold,
 312                            InternedTest.class.getName(),
 313                            "" + DefaultAgeThreshold);
 314         }
 315     }
 316 
 317     /*
 318      * Tests
 319      */
 320 
 321     private static final int LargeNumberOfStrings = 10000;
 322     private static final int SmallNumberOfStrings = 10;
 323 
 324     private static final int MaxAgeThreshold      = 15;
 325     private static final int DefaultAgeThreshold  = 3;
 326     private static final int MinAgeThreshold      = 1;
 327 
 328     private static final int TooLowAgeThreshold   = MinAgeThreshold - 1;
 329     private static final int TooHighAgeThreshold  = MaxAgeThreshold + 1;
 330 
 331     public static void testYoungGC() throws Exception {
 332         // Do young GC to age strings to provoke deduplication
 333         OutputAnalyzer output = DeduplicationTest.run(LargeNumberOfStrings,
 334                                                       DefaultAgeThreshold,
 335                                                       YoungGC,
 336                                                       "-XX:+PrintGC",
 337                                                       "-XX:+PrintStringDeduplicationStatistics");
 338         output.shouldNotContain("Full GC");
 339         output.shouldContain("GC pause (G1 Evacuation Pause) (young)");
 340         output.shouldContain("GC concurrent-string-deduplication");
 341         output.shouldContain("Deduplicated:");
 342         output.shouldHaveExitValue(0);
 343     }
 344 




 304         }
 305 
 306         public static OutputAnalyzer run() throws Exception {
 307             return runTest("-XX:+PrintGC",
 308                            "-XX:+PrintGCDetails",
 309                            "-XX:+UseStringDeduplication",
 310                            "-XX:+PrintStringDeduplicationStatistics",
 311                            "-XX:StringDeduplicationAgeThreshold=" + DefaultAgeThreshold,
 312                            InternedTest.class.getName(),
 313                            "" + DefaultAgeThreshold);
 314         }
 315     }
 316 
 317     /*
 318      * Tests
 319      */
 320 
 321     private static final int LargeNumberOfStrings = 10000;
 322     private static final int SmallNumberOfStrings = 10;
 323 
 324     private static final int MaxAgeThreshold      = 31;
 325     private static final int DefaultAgeThreshold  = 3;
 326     private static final int MinAgeThreshold      = 1;
 327 
 328     private static final int TooLowAgeThreshold   = MinAgeThreshold - 1;
 329     private static final int TooHighAgeThreshold  = MaxAgeThreshold + 1;
 330 
 331     public static void testYoungGC() throws Exception {
 332         // Do young GC to age strings to provoke deduplication
 333         OutputAnalyzer output = DeduplicationTest.run(LargeNumberOfStrings,
 334                                                       DefaultAgeThreshold,
 335                                                       YoungGC,
 336                                                       "-XX:+PrintGC",
 337                                                       "-XX:+PrintStringDeduplicationStatistics");
 338         output.shouldNotContain("Full GC");
 339         output.shouldContain("GC pause (G1 Evacuation Pause) (young)");
 340         output.shouldContain("GC concurrent-string-deduplication");
 341         output.shouldContain("Deduplicated:");
 342         output.shouldHaveExitValue(0);
 343     }
 344 


< prev index next >