Lines Matching +full:1 +full:- +full:cpu
1 // SPDX-License-Identifier: GPL-2.0
14 #define TEMPL "/tmp/perf-test-XXXXXX"
26 return -1;
44 session->evlist = evlist__new_default();
45 TEST_ASSERT_VAL("can't get evlist", session->evlist);
47 perf_header__set_feat(&session->header, HEADER_CPU_TOPOLOGY);
48 perf_header__set_feat(&session->header, HEADER_NRCPUS);
49 perf_header__set_feat(&session->header, HEADER_ARCH);
51 session->header.data_size += DATA_SIZE;
54 !perf_session__write_header(session, session->evlist, data.file.fd, true));
56 evlist__delete(session->evlist);
71 struct perf_cpu cpu;
80 * cpu is a NULL pointer.
82 * CPU 0 is on core_id 0 and physical_package_id 6
83 * CPU 1 is on core_id 1 and physical_package_id 3
86 * dependent and might have higher numbers than the CPU id.
98 if (!session->header.env.cpu
99 && strncmp(session->header.env.arch, "s390", 4)
100 && strncmp(session->header.env.arch, "aarch64", 7))
106 * physical_package_id will be set to -1. Hence skip this
107 * test if physical_package_id returns -1 for cpu from perf_cpu_map.
109 if (!strncmp(session->header.env.arch, "ppc64le", 7)) {
110 if (cpu__get_socket_id(perf_cpu_map__cpu(map, 0)) == -1)
114 TEST_ASSERT_VAL("Session header CPU map not set", session->header.env.cpu);
116 for (i = 0; i < session->header.env.nr_cpus_avail; i++) {
117 cpu.cpu = i;
118 if (!perf_cpu_map__has(map, cpu))
120 pr_debug("CPU %d, core %d, socket %d\n", i,
121 session->header.env.cpu[i].core_id,
122 session->header.env.cpu[i].socket_id);
125 // Test that CPU ID contains socket, die, core and CPU
126 perf_cpu_map__for_each_cpu(cpu, i, map) {
127 id = aggr_cpu_id__cpu(cpu, NULL);
128 TEST_ASSERT_VAL("Cpu map - CPU ID doesn't match",
129 cpu.cpu == id.cpu.cpu);
131 TEST_ASSERT_VAL("Cpu map - Core ID doesn't match",
132 session->header.env.cpu[cpu.cpu].core_id == id.core);
133 TEST_ASSERT_VAL("Cpu map - Socket ID doesn't match",
134 session->header.env.cpu[cpu.cpu].socket_id ==
137 TEST_ASSERT_VAL("Cpu map - Die ID doesn't match",
138 session->header.env.cpu[cpu.cpu].die_id == id.die);
139 TEST_ASSERT_VAL("Cpu map - Node ID is set", id.node == -1);
140 TEST_ASSERT_VAL("Cpu map - Thread IDX is set", id.thread_idx == -1);
144 perf_cpu_map__for_each_cpu(cpu, i, map) {
145 id = aggr_cpu_id__core(cpu, NULL);
146 TEST_ASSERT_VAL("Core map - Core ID doesn't match",
147 session->header.env.cpu[cpu.cpu].core_id == id.core);
149 TEST_ASSERT_VAL("Core map - Socket ID doesn't match",
150 session->header.env.cpu[cpu.cpu].socket_id ==
153 TEST_ASSERT_VAL("Core map - Die ID doesn't match",
154 session->header.env.cpu[cpu.cpu].die_id == id.die);
155 TEST_ASSERT_VAL("Core map - Node ID is set", id.node == -1);
156 TEST_ASSERT_VAL("Core map - Thread IDX is set", id.thread_idx == -1);
160 perf_cpu_map__for_each_cpu(cpu, i, map) {
161 id = aggr_cpu_id__die(cpu, NULL);
162 TEST_ASSERT_VAL("Die map - Socket ID doesn't match",
163 session->header.env.cpu[cpu.cpu].socket_id ==
166 TEST_ASSERT_VAL("Die map - Die ID doesn't match",
167 session->header.env.cpu[cpu.cpu].die_id == id.die);
169 TEST_ASSERT_VAL("Die map - Node ID is set", id.node == -1);
170 TEST_ASSERT_VAL("Die map - Core is set", id.core == -1);
171 TEST_ASSERT_VAL("Die map - CPU is set", id.cpu.cpu == -1);
172 TEST_ASSERT_VAL("Die map - Thread IDX is set", id.thread_idx == -1);
176 perf_cpu_map__for_each_cpu(cpu, i, map) {
177 id = aggr_cpu_id__socket(cpu, NULL);
178 TEST_ASSERT_VAL("Socket map - Socket ID doesn't match",
179 session->header.env.cpu[cpu.cpu].socket_id ==
182 TEST_ASSERT_VAL("Socket map - Node ID is set", id.node == -1);
183 TEST_ASSERT_VAL("Socket map - Die ID is set", id.die == -1);
184 TEST_ASSERT_VAL("Socket map - Core is set", id.core == -1);
185 TEST_ASSERT_VAL("Socket map - CPU is set", id.cpu.cpu == -1);
186 TEST_ASSERT_VAL("Socket map - Thread IDX is set", id.thread_idx == -1);
190 perf_cpu_map__for_each_cpu(cpu, i, map) {
191 id = aggr_cpu_id__node(cpu, NULL);
192 TEST_ASSERT_VAL("Node map - Node ID doesn't match",
193 cpu__get_node(cpu) == id.node);
194 TEST_ASSERT_VAL("Node map - Socket is set", id.socket == -1);
195 TEST_ASSERT_VAL("Node map - Die ID is set", id.die == -1);
196 TEST_ASSERT_VAL("Node map - Core is set", id.core == -1);
197 TEST_ASSERT_VAL("Node map - CPU is set", id.cpu.cpu == -1);
198 TEST_ASSERT_VAL("Node map - Thread IDX is set", id.thread_idx == -1);