hotspot/test/gc/g1/plab/TestPLABResize.java
changeset 37061 f4f1c40edfd9
parent 37047 ba4d0448cc09
child 37163 28bd1ceebeb9
equal deleted inserted replaced
37055:3ea6a0d5a78c 37061:f4f1c40edfd9
   120                             .get("actual");
   120                             .get("actual");
   121                 })
   121                 })
   122                 .collect(Collectors.toCollection(ArrayList::new));
   122                 .collect(Collectors.toCollection(ArrayList::new));
   123 
   123 
   124         // Check that desired plab size was changed during iterations.
   124         // Check that desired plab size was changed during iterations.
   125         // It should decrease during first half of iterations
   125         // The test case does 3 rounds of allocations.  The second round of N allocations and GC's
   126         // and increase after.
   126         // has a decreasing size of allocations so that iterations N to 2*N -1 will be of decreasing size.
   127         List<Long> decreasedPlabs = plabSizes.subList(testCase.getIterations(), testCase.getIterations() * 2);
   127         // The third round with iterations 2*N to 3*N -1 has increasing sizes of allocation.
   128         List<Long> increasedPlabs = plabSizes.subList(testCase.getIterations() * 2, testCase.getIterations() * 3);
   128         long startDesiredPLABSize = plabSizes.get(testCase.getIterations());
   129 
   129         long endDesiredPLABSize = plabSizes.get(testCase.getIterations() * 2 - 1);
   130         Long prev = decreasedPlabs.get(0);
   130 
   131         for (int index = 1; index < decreasedPlabs.size(); ++index) {
   131         if (startDesiredPLABSize < endDesiredPLABSize) {
   132             Long current = decreasedPlabs.get(index);
   132             System.out.println(output);
   133             if (prev < current) {
   133             throw new RuntimeException("Test failed! Expect that initial PLAB size should be greater than checked. Initial size: " + startDesiredPLABSize + " Checked size:" + endDesiredPLABSize);
   134                 System.out.println(output);
   134         }
   135                 throw new RuntimeException("Test failed! Expect that previous PLAB size should be greater than current. Prev.size: " + prev + " Current size:" + current);
   135 
   136             }
   136         startDesiredPLABSize = plabSizes.get(testCase.getIterations() * 2);
   137             prev = current;
   137         endDesiredPLABSize = plabSizes.get(testCase.getIterations() * 3 - 1);
   138         }
   138 
   139 
   139         if (startDesiredPLABSize > endDesiredPLABSize) {
   140         prev = increasedPlabs.get(0);
   140             System.out.println(output);
   141         for (int index = 1; index < increasedPlabs.size(); ++index) {
   141             throw new RuntimeException("Test failed! Expect that initial PLAB size should be less than checked. Initial size: " + startDesiredPLABSize + " Checked size:" + endDesiredPLABSize);
   142             Long current = increasedPlabs.get(index);
       
   143             if (prev > current) {
       
   144                 System.out.println(output);
       
   145                 throw new RuntimeException("Test failed! Expect that previous PLAB size should be less than current. Prev.size: " + prev + " Current size:" + current);
       
   146             }
       
   147             prev = current;
       
   148         }
   142         }
   149 
   143 
   150         System.out.println("Test passed!");
   144         System.out.println("Test passed!");
   151     }
   145     }
   152 
   146 
   193          */
   187          */
   194         public List<String> toOptions() {
   188         public List<String> toOptions() {
   195             return Arrays.asList("-XX:ParallelGCThreads=" + parGCThreads,
   189             return Arrays.asList("-XX:ParallelGCThreads=" + parGCThreads,
   196                     "-XX:ParallelGCBufferWastePct=" + wastePct,
   190                     "-XX:ParallelGCBufferWastePct=" + wastePct,
   197                     "-XX:+ResizePLAB",
   191                     "-XX:+ResizePLAB",
   198                     "-Dthreads=" + parGCThreads,
       
   199                     "-Dchunk.size=" + chunkSize,
   192                     "-Dchunk.size=" + chunkSize,
   200                     "-Diterations=" + iterations,
   193                     "-Diterations=" + iterations,
   201                     "-XX:NewSize=16m",
   194                     "-XX:NewSize=16m",
   202                     "-XX:MaxNewSize=16m"
   195                     "-XX:MaxNewSize=16m"
   203             );
   196             );