< prev index next >

test/hotspot/jtreg/gc/g1/numa/TestG1NUMATouchRegions.java

Print this page
rev 56822 : imported patch 8220310.mut.1
rev 56823 : imported patch 8220310.mut.2
rev 56824 : imported patch 8220310.mut.3
rev 56825 : imported patch 8220310.mut.4
rev 56835 : imported patch 8220312.stat.3


  94     }
  95 
  96     static long heapPageSize(OutputAnalyzer output) {
  97         String HeapPageSizePattern = "Heap:  .*page_size=([^ ]+)";
  98         String str = output.firstMatch(HeapPageSizePattern, 1);
  99 
 100         if (str == null) {
 101             output.reportDiagnosticSummary();
 102             throw new RuntimeException("Match from '" + HeapPageSizePattern + "' got 'null'");
 103         }
 104 
 105         return parseSizeString(str);
 106     }
 107 
 108     // 1. -UseLargePages: default page, page size < G1HeapRegionSize
 109     //    +UseLargePages: large page size <= G1HeapRegionSize
 110     //
 111     //    Each 'int' represents a numa id of single HeapRegion (bottom page).
 112     //    e.g. 1MB heap region, 2MB page size and 2 NUMA nodes system
 113     //         Check the first set(2 regions)
 114     //         0| ...omitted..| 00
 115     //         1| ...omitted..| 01
 116     static void checkCase1Pattern(OutputAnalyzer output, int index, long g1HeapRegionSize, long actualPageSize, int[] memoryNodeIds) throws Exception {
 117         StringBuilder sb = new StringBuilder();
 118 
 119         // Append index which means heap region index.
 120         sb.append(String.format("%6d", index));
 121         sb.append("| .* | ");
 122 
 123         // Append page node id.
 124         sb.append(String.format("%02d", memoryNodeIds[index]));
 125 
 126         output.shouldMatch(sb.toString());
 127     }
 128 
 129     // 3. +UseLargePages: large page size > G1HeapRegionSize
 130     //
 131     //    As a OS page is consist of multiple heap regions, log also should be
 132     //    printed multiple times for same numa id.
 133     //    e.g. 1MB heap region, 2MB page size and 2 NUMA nodes system
 134     //         Check the first set(4 regions)
 135     //         0| ...omitted..| 00
 136     //         1| ...omitted..| 00
 137     //         2| ...omitted..| 01
 138     //         3| ...omitted..| 01
 139     static void checkCase2Pattern(OutputAnalyzer output, int index, long g1HeapRegionSize, long actualPageSize, int[] memoryNodeIds) throws Exception {
 140         StringBuilder sb = new StringBuilder();
 141 
 142         // Append page range.
 143         int lines_to_print = (int)(actualPageSize / g1HeapRegionSize);
 144         for (int i = 0; i < lines_to_print; i++) {
 145             // Append index which means heap region index.
 146             sb.append(String.format("%6d", index * lines_to_print + i));
 147             sb.append("| .* | ");
 148 
 149             // Append page node id.
 150             sb.append(String.format("%02d", memoryNodeIds[index]));
 151 
 152             output.shouldMatch(sb.toString());
 153             sb.setLength(0);
 154         }
 155     }
 156 
 157     static void checkNUMALog(OutputAnalyzer output, int regionSizeInMB) throws Exception {
 158         WhiteBox wb = WhiteBox.getWhiteBox();
 159         long g1HeapRegionSize = regionSizeInMB * 1024 * 1024;
 160         long actualPageSize = heapPageSize(output);
 161         long defaultPageSize = (long)wb.getVMPageSize();
 162         int memoryNodeCount = wb.g1ActiveMemoryNodeCount();
 163         int[] memoryNodeIds = wb.g1MemoryNodeIds();
 164 
 165         System.out.println("node count=" + memoryNodeCount + ", actualPageSize=" + actualPageSize);
 166         // Check for the first set of active numa nodes.
 167         for (int index = 0; index < memoryNodeCount; index++) {
 168             if (actualPageSize <= defaultPageSize) {
 169                 checkCase1Pattern(output, index, g1HeapRegionSize, actualPageSize, memoryNodeIds);
 170             } else {




  94     }
  95 
  96     static long heapPageSize(OutputAnalyzer output) {
  97         String HeapPageSizePattern = "Heap:  .*page_size=([^ ]+)";
  98         String str = output.firstMatch(HeapPageSizePattern, 1);
  99 
 100         if (str == null) {
 101             output.reportDiagnosticSummary();
 102             throw new RuntimeException("Match from '" + HeapPageSizePattern + "' got 'null'");
 103         }
 104 
 105         return parseSizeString(str);
 106     }
 107 
 108     // 1. -UseLargePages: default page, page size < G1HeapRegionSize
 109     //    +UseLargePages: large page size <= G1HeapRegionSize
 110     //
 111     //    Each 'int' represents a numa id of single HeapRegion (bottom page).
 112     //    e.g. 1MB heap region, 2MB page size and 2 NUMA nodes system
 113     //         Check the first set(2 regions)
 114     //         0| ...omitted..| 0
 115     //         1| ...omitted..| 1
 116     static void checkCase1Pattern(OutputAnalyzer output, int index, long g1HeapRegionSize, long actualPageSize, int[] memoryNodeIds) throws Exception {
 117         StringBuilder sb = new StringBuilder();
 118 
 119         // Append index which means heap region index.
 120         sb.append(String.format("%6d", index));
 121         sb.append("| .* | ");
 122 
 123         // Append page node id.
 124         sb.append(memoryNodeIds[index]);
 125 
 126         output.shouldMatch(sb.toString());
 127     }
 128 
 129     // 3. +UseLargePages: large page size > G1HeapRegionSize
 130     //
 131     //    As a OS page is consist of multiple heap regions, log also should be
 132     //    printed multiple times for same numa id.
 133     //    e.g. 1MB heap region, 2MB page size and 2 NUMA nodes system
 134     //         Check the first set(4 regions)
 135     //         0| ...omitted..| 0
 136     //         1| ...omitted..| 0
 137     //         2| ...omitted..| 1
 138     //         3| ...omitted..| 1
 139     static void checkCase2Pattern(OutputAnalyzer output, int index, long g1HeapRegionSize, long actualPageSize, int[] memoryNodeIds) throws Exception {
 140         StringBuilder sb = new StringBuilder();
 141 
 142         // Append page range.
 143         int lines_to_print = (int)(actualPageSize / g1HeapRegionSize);
 144         for (int i = 0; i < lines_to_print; i++) {
 145             // Append index which means heap region index.
 146             sb.append(String.format("%6d", index * lines_to_print + i));
 147             sb.append("| .* | ");
 148 
 149             // Append page node id.
 150             sb.append(memoryNodeIds[index]);
 151 
 152             output.shouldMatch(sb.toString());
 153             sb.setLength(0);
 154         }
 155     }
 156 
 157     static void checkNUMALog(OutputAnalyzer output, int regionSizeInMB) throws Exception {
 158         WhiteBox wb = WhiteBox.getWhiteBox();
 159         long g1HeapRegionSize = regionSizeInMB * 1024 * 1024;
 160         long actualPageSize = heapPageSize(output);
 161         long defaultPageSize = (long)wb.getVMPageSize();
 162         int memoryNodeCount = wb.g1ActiveMemoryNodeCount();
 163         int[] memoryNodeIds = wb.g1MemoryNodeIds();
 164 
 165         System.out.println("node count=" + memoryNodeCount + ", actualPageSize=" + actualPageSize);
 166         // Check for the first set of active numa nodes.
 167         for (int index = 0; index < memoryNodeCount; index++) {
 168             if (actualPageSize <= defaultPageSize) {
 169                 checkCase1Pattern(output, index, g1HeapRegionSize, actualPageSize, memoryNodeIds);
 170             } else {


< prev index next >