|
28 | 28 | */ |
29 | 29 | public class VanillaCpuLayoutTest { |
30 | 30 |
|
31 | | - public static final String EXPECTED = "0: CpuInfo{socketId=0, coreId=0, threadId=0}\n" + |
32 | | - "1: CpuInfo{socketId=0, coreId=1, threadId=0}\n" + |
33 | | - "2: CpuInfo{socketId=0, coreId=2, threadId=0}\n" + |
34 | | - "3: CpuInfo{socketId=0, coreId=3, threadId=0}\n" + |
35 | | - "4: CpuInfo{socketId=0, coreId=0, threadId=1}\n" + |
36 | | - "5: CpuInfo{socketId=0, coreId=1, threadId=1}\n" + |
37 | | - "6: CpuInfo{socketId=0, coreId=2, threadId=1}\n" + |
38 | | - "7: CpuInfo{socketId=0, coreId=3, threadId=1}\n"; |
39 | | - |
40 | 31 | @Test |
41 | | - public void testFromCpuInfo() throws IOException { |
42 | | - final InputStream i7 = getClass().getClassLoader().getResourceAsStream("cpuinfo.i7"); |
| 32 | + public void testFromCpuInfoI7() throws IOException { |
| 33 | + final InputStream i7 = getClass().getClassLoader().getResourceAsStream("i7.cpuinfo"); |
43 | 34 | VanillaCpuLayout vcl = VanillaCpuLayout.fromCpuInfo(i7); |
44 | | - assertEquals(EXPECTED, vcl.toString()); |
| 35 | + assertEquals("0: CpuInfo{socketId=0, coreId=0, threadId=0}\n" + |
| 36 | + "1: CpuInfo{socketId=0, coreId=1, threadId=0}\n" + |
| 37 | + "2: CpuInfo{socketId=0, coreId=2, threadId=0}\n" + |
| 38 | + "3: CpuInfo{socketId=0, coreId=3, threadId=0}\n" + |
| 39 | + "4: CpuInfo{socketId=0, coreId=0, threadId=1}\n" + |
| 40 | + "5: CpuInfo{socketId=0, coreId=1, threadId=1}\n" + |
| 41 | + "6: CpuInfo{socketId=0, coreId=2, threadId=1}\n" + |
| 42 | + "7: CpuInfo{socketId=0, coreId=3, threadId=1}\n", vcl.toString()); |
| 43 | + } |
| 44 | + |
| 45 | + |
| 46 | + @Test |
| 47 | + public void testFromCpuInfoOthers() throws IOException { |
| 48 | + { |
| 49 | + final InputStream is = getClass().getClassLoader().getResourceAsStream("amd64.dual.core.cpuinfo"); |
| 50 | + VanillaCpuLayout vcl = VanillaCpuLayout.fromCpuInfo(is); |
| 51 | + assertEquals("0: CpuInfo{socketId=0, coreId=0, threadId=0}\n" + |
| 52 | + "1: CpuInfo{socketId=0, coreId=1, threadId=0}\n", vcl.toString()); |
| 53 | + } |
| 54 | + { |
| 55 | + final InputStream is = getClass().getClassLoader().getResourceAsStream("core.duo.cpuinfo"); |
| 56 | + VanillaCpuLayout vcl = VanillaCpuLayout.fromCpuInfo(is); |
| 57 | + assertEquals("0: CpuInfo{socketId=0, coreId=0, threadId=0}\n" + |
| 58 | + "1: CpuInfo{socketId=0, coreId=1, threadId=0}\n", vcl.toString()); |
| 59 | + } |
| 60 | + { |
| 61 | + final InputStream is = getClass().getClassLoader().getResourceAsStream("amd64.quad.core.cpuinfo"); |
| 62 | + VanillaCpuLayout vcl = VanillaCpuLayout.fromCpuInfo(is); |
| 63 | + assertEquals("0: CpuInfo{socketId=0, coreId=0, threadId=0}\n" + |
| 64 | + "1: CpuInfo{socketId=0, coreId=1, threadId=0}\n" + |
| 65 | + "2: CpuInfo{socketId=0, coreId=2, threadId=0}\n" + |
| 66 | + "3: CpuInfo{socketId=0, coreId=3, threadId=0}\n", vcl.toString()); |
| 67 | + } |
| 68 | + { |
| 69 | + final InputStream is = getClass().getClassLoader().getResourceAsStream("dual.xeon.cpuinfo"); |
| 70 | + VanillaCpuLayout vcl = VanillaCpuLayout.fromCpuInfo(is); |
| 71 | + assertEquals("0: CpuInfo{socketId=0, coreId=0, threadId=0}\n" + |
| 72 | + "1: CpuInfo{socketId=0, coreId=0, threadId=1}\n" + |
| 73 | + "2: CpuInfo{socketId=3, coreId=3, threadId=0}\n" + |
| 74 | + "3: CpuInfo{socketId=3, coreId=3, threadId=1}\n", vcl.toString()); |
| 75 | + } |
| 76 | + { |
| 77 | + final InputStream is = getClass().getClassLoader().getResourceAsStream("i3.cpuinfo"); |
| 78 | + VanillaCpuLayout vcl = VanillaCpuLayout.fromCpuInfo(is); |
| 79 | + assertEquals("0: CpuInfo{socketId=0, coreId=0, threadId=0}\n" + |
| 80 | + "1: CpuInfo{socketId=0, coreId=2, threadId=0}\n" + |
| 81 | + "2: CpuInfo{socketId=0, coreId=0, threadId=1}\n" + |
| 82 | + "3: CpuInfo{socketId=0, coreId=2, threadId=1}\n", vcl.toString()); |
| 83 | + } |
| 84 | + { |
| 85 | + final InputStream is = getClass().getClassLoader().getResourceAsStream("q6600.noht.cpuinfo"); |
| 86 | + VanillaCpuLayout vcl = VanillaCpuLayout.fromCpuInfo(is); |
| 87 | + assertEquals("0: CpuInfo{socketId=0, coreId=0, threadId=0}\n" + |
| 88 | + "1: CpuInfo{socketId=0, coreId=2, threadId=0}\n" + |
| 89 | + "2: CpuInfo{socketId=0, coreId=1, threadId=0}\n" + |
| 90 | + "3: CpuInfo{socketId=0, coreId=3, threadId=0}\n", vcl.toString()); |
| 91 | + } |
| 92 | + { |
| 93 | + final InputStream is = getClass().getClassLoader().getResourceAsStream("dual.E5405.cpuinfo"); |
| 94 | + VanillaCpuLayout vcl = VanillaCpuLayout.fromCpuInfo(is); |
| 95 | + assertEquals("0: CpuInfo{socketId=0, coreId=0, threadId=0}\n" + |
| 96 | + "1: CpuInfo{socketId=0, coreId=1, threadId=0}\n" + |
| 97 | + "2: CpuInfo{socketId=0, coreId=2, threadId=0}\n" + |
| 98 | + "3: CpuInfo{socketId=0, coreId=3, threadId=0}\n" + |
| 99 | + "4: CpuInfo{socketId=1, coreId=4, threadId=0}\n" + |
| 100 | + "5: CpuInfo{socketId=1, coreId=5, threadId=0}\n" + |
| 101 | + "6: CpuInfo{socketId=1, coreId=6, threadId=0}\n" + |
| 102 | + "7: CpuInfo{socketId=1, coreId=7, threadId=0}\n", vcl.toString()); |
| 103 | + } |
45 | 104 | } |
46 | 105 |
|
47 | 106 | @Test |
48 | 107 | public void testFromProperties() throws IOException { |
49 | 108 | final InputStream i7 = getClass().getClassLoader().getResourceAsStream("i7.properties"); |
50 | 109 | VanillaCpuLayout vcl = VanillaCpuLayout.fromProperties(i7); |
51 | | - assertEquals(EXPECTED, vcl.toString()); |
| 110 | + assertEquals("0: CpuInfo{socketId=0, coreId=0, threadId=0}\n" + |
| 111 | + "1: CpuInfo{socketId=0, coreId=1, threadId=0}\n" + |
| 112 | + "2: CpuInfo{socketId=0, coreId=2, threadId=0}\n" + |
| 113 | + "3: CpuInfo{socketId=0, coreId=3, threadId=0}\n" + |
| 114 | + "4: CpuInfo{socketId=0, coreId=0, threadId=1}\n" + |
| 115 | + "5: CpuInfo{socketId=0, coreId=1, threadId=1}\n" + |
| 116 | + "6: CpuInfo{socketId=0, coreId=2, threadId=1}\n" + |
| 117 | + "7: CpuInfo{socketId=0, coreId=3, threadId=1}\n", vcl.toString()); |
52 | 118 | } |
53 | 119 | } |
0 commit comments