2019-02-19 17:58:13 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef __PERF_CPUTOPO_H
|
|
|
|
#define __PERF_CPUTOPO_H
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
struct cpu_topology {
|
2021-11-11 08:21:03 +08:00
|
|
|
/* The number of unique package_cpus_lists below. */
|
|
|
|
u32 package_cpus_lists;
|
2021-11-11 08:21:04 +08:00
|
|
|
/* The number of unique die_cpu_lists below. */
|
|
|
|
u32 die_cpus_lists;
|
2021-11-11 08:21:05 +08:00
|
|
|
/* The number of unique core_cpu_lists below. */
|
|
|
|
u32 core_cpus_lists;
|
2021-11-11 08:21:03 +08:00
|
|
|
/*
|
|
|
|
* An array of strings where each string is unique and read from
|
|
|
|
* /sys/devices/system/cpu/cpuX/topology/package_cpus_list. From the ABI
|
|
|
|
* each of these is a human-readable list of CPUs sharing the same
|
|
|
|
* physical_package_id. The format is like 0-3, 8-11, 14,17.
|
|
|
|
*/
|
|
|
|
const char **package_cpus_list;
|
2021-11-11 08:21:04 +08:00
|
|
|
/*
|
|
|
|
* An array of string where each string is unique and from
|
|
|
|
* /sys/devices/system/cpu/cpuX/topology/die_cpus_list. From the ABI
|
|
|
|
* each of these is a human-readable list of CPUs within the same die.
|
|
|
|
* The format is like 0-3, 8-11, 14,17.
|
|
|
|
*/
|
|
|
|
const char **die_cpus_list;
|
2021-11-11 08:21:05 +08:00
|
|
|
/*
|
|
|
|
* An array of string where each string is unique and from
|
|
|
|
* /sys/devices/system/cpu/cpuX/topology/core_cpus_list. From the ABI
|
|
|
|
* each of these is a human-readable list of CPUs within the same
|
|
|
|
* core. The format is like 0-3, 8-11, 14,17.
|
|
|
|
*/
|
|
|
|
const char **core_cpus_list;
|
2019-02-19 17:58:13 +08:00
|
|
|
};
|
|
|
|
|
2019-02-19 17:58:14 +08:00
|
|
|
struct numa_topology_node {
|
|
|
|
char *cpus;
|
|
|
|
u32 node;
|
|
|
|
u64 mem_total;
|
|
|
|
u64 mem_free;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct numa_topology {
|
|
|
|
u32 nr;
|
2020-05-16 01:29:26 +08:00
|
|
|
struct numa_topology_node nodes[];
|
2019-02-19 17:58:14 +08:00
|
|
|
};
|
|
|
|
|
2021-05-14 20:29:47 +08:00
|
|
|
struct hybrid_topology_node {
|
|
|
|
char *pmu_name;
|
|
|
|
char *cpus;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct hybrid_topology {
|
|
|
|
u32 nr;
|
|
|
|
struct hybrid_topology_node nodes[];
|
|
|
|
};
|
|
|
|
|
2023-02-19 17:28:04 +08:00
|
|
|
/*
|
|
|
|
* The topology for online CPUs, lazily created.
|
|
|
|
*/
|
|
|
|
const struct cpu_topology *online_topology(void);
|
|
|
|
|
2019-02-19 17:58:13 +08:00
|
|
|
struct cpu_topology *cpu_topology__new(void);
|
|
|
|
void cpu_topology__delete(struct cpu_topology *tp);
|
2022-09-01 01:49:22 +08:00
|
|
|
/* Determine from the core list whether SMT was enabled. */
|
|
|
|
bool cpu_topology__smt_on(const struct cpu_topology *topology);
|
2022-09-01 01:49:23 +08:00
|
|
|
/* Are the sets of SMT siblings all enabled or all disabled in user_requested_cpus. */
|
|
|
|
bool cpu_topology__core_wide(const struct cpu_topology *topology,
|
|
|
|
const char *user_requested_cpu_list);
|
2019-02-19 17:58:13 +08:00
|
|
|
|
2019-02-19 17:58:14 +08:00
|
|
|
struct numa_topology *numa_topology__new(void);
|
|
|
|
void numa_topology__delete(struct numa_topology *tp);
|
|
|
|
|
2021-05-14 20:29:47 +08:00
|
|
|
struct hybrid_topology *hybrid_topology__new(void);
|
|
|
|
void hybrid_topology__delete(struct hybrid_topology *tp);
|
|
|
|
|
2019-02-19 17:58:13 +08:00
|
|
|
#endif /* __PERF_CPUTOPO_H */
|