Lines Matching +full:path +full:- +full:map
1 // SPDX-License-Identifier: GPL-2.0
13 #define TEMPL "/tmp/perf-test-XXXXXX"
16 static int get_temp(char *path) in get_temp() argument
20 strcpy(path, TEMPL); in get_temp()
22 fd = mkstemp(path); in get_temp()
25 return -1; in get_temp()
32 static int session_write_header(char *path) in session_write_header() argument
36 .path = path, in session_write_header()
43 session->evlist = perf_evlist__new_default(); in session_write_header()
44 TEST_ASSERT_VAL("can't get evlist", session->evlist); in session_write_header()
46 perf_header__set_feat(&session->header, HEADER_CPU_TOPOLOGY); in session_write_header()
47 perf_header__set_feat(&session->header, HEADER_NRCPUS); in session_write_header()
48 perf_header__set_feat(&session->header, HEADER_ARCH); in session_write_header()
50 session->header.data_size += DATA_SIZE; in session_write_header()
53 !perf_session__write_header(session, session->evlist, data.file.fd, true)); in session_write_header()
55 evlist__delete(session->evlist); in session_write_header()
61 static int check_cpu_topology(char *path, struct perf_cpu_map *map) in check_cpu_topology() argument
65 .path = path, in check_cpu_topology()
91 if (!session->header.env.cpu) in check_cpu_topology()
94 for (i = 0; i < session->header.env.nr_cpus_avail; i++) { in check_cpu_topology()
95 if (!cpu_map__has(map, i)) in check_cpu_topology()
98 session->header.env.cpu[i].core_id, in check_cpu_topology()
99 session->header.env.cpu[i].socket_id); in check_cpu_topology()
102 for (i = 0; i < map->nr; i++) { in check_cpu_topology()
104 (session->header.env.cpu[map->map[i]].core_id == (cpu_map__get_core(map, i, NULL) & 0xffff))); in check_cpu_topology()
107 (session->header.env.cpu[map->map[i]].socket_id == cpu_map__get_socket(map, i, NULL))); in check_cpu_topology()
117 char path[PATH_MAX]; in test__session_topology() local
118 struct perf_cpu_map *map; in test__session_topology() local
121 TEST_ASSERT_VAL("can't get templ file", !get_temp(path)); in test__session_topology()
123 pr_debug("templ file: %s\n", path); in test__session_topology()
125 if (session_write_header(path)) in test__session_topology()
128 map = perf_cpu_map__new(NULL); in test__session_topology()
129 if (map == NULL) { in test__session_topology()
134 ret = check_cpu_topology(path, map); in test__session_topology()
135 perf_cpu_map__put(map); in test__session_topology()
138 unlink(path); in test__session_topology()