]>
git.ipfire.org Git - thirdparty/util-linux.git/blob - sys-utils/lscpu.h
11 #include "pathnames.h"
14 /* virtualization types */
22 /* hypervisor vendors */
29 HYPER_IBM
, /* sys-z powervm */
32 HYPER_INNOTEK
, /* VBOX */
34 HYPER_PARALLELS
, /* OpenVZ/VIrtuozzo */
44 MODE_32BIT
= (1 << 1),
48 /* cache(s) description */
54 cpu_set_t
**sharedmaps
;
57 /* dispatching modes */
63 /* cpu polarization */
72 struct polarization_modes
{
78 /* global description */
80 const char *prefix
; /* path to /sys and /proc snapshot or NULL */
82 struct path_cxt
*syscpu
; /* _PATH_SYS_CPU path handler */
83 struct path_cxt
*procfs
; /* /proc path handler */
87 char *machinetype
; /* s390 */
91 char *revision
; /* alternative for model (ppc) */
92 char *cpu
; /* alternative for modelname (ppc, sparc) */
93 char *virtflag
; /* virtualization flag (vmx, svm) */
94 char *hypervisor
; /* hypervisor software */
95 int hyper
; /* hypervisor vendor ID */
96 int virtype
; /* VIRT_PARA|FULL|NONE ? */
98 char *dynamic_mhz
; /* dynamic mega hertz (s390) */
99 char *static_mhz
; /* static mega hertz (s390) */
100 char **maxmhz
; /* maximum mega hertz */
101 char **minmhz
; /* minimum mega hertz */
105 char *mtid
; /* maximum thread id (s390) */
106 char *addrsz
; /* address sizes */
107 int dispatching
; /* none, horizontal or vertical */
108 int mode
; /* rm, lm or/and tm */
110 int ncpuspos
; /* maximal possible CPUs */
111 int ncpus
; /* number of present CPUs */
112 cpu_set_t
*present
; /* mask with present CPUs */
113 cpu_set_t
*online
; /* mask with online CPUs */
115 int nthreads
; /* number of online threads */
118 struct cpu_cache
*caches
;
120 int necaches
; /* extra caches (s390) */
121 struct cpu_cache
*ecaches
;
124 * All maps are sequentially indexed (0..ncpuspos), the array index
125 * does not have match with cpuX number as presented by kernel. You
126 * have to use real_cpu_num() to get the real cpuX number.
128 * For example, the possible system CPUs are: 1,3,5, it means that
129 * ncpuspos=3, so all arrays are in range 0..3.
131 int *idx2cpunum
; /* mapping index to CPU num */
133 int nnodes
; /* number of NUMA modes */
134 int *idx2nodenum
; /* Support for discontinuous nodes */
135 cpu_set_t
**nodemaps
; /* array with NUMA nodes */
137 /* drawers -- based on drawer_siblings (internal kernel map of cpuX's
138 * hardware threads within the same drawer */
139 int ndrawers
; /* number of all online drawers */
140 cpu_set_t
**drawermaps
; /* unique drawer_siblings */
141 int *drawerids
; /* physical drawer ids */
143 /* books -- based on book_siblings (internal kernel map of cpuX's
144 * hardware threads within the same book */
145 int nbooks
; /* number of all online books */
146 cpu_set_t
**bookmaps
; /* unique book_siblings */
147 int *bookids
; /* physical book ids */
149 /* sockets -- based on core_siblings (internal kernel map of cpuX's
150 * hardware threads within the same physical_package_id (socket)) */
151 int nsockets
; /* number of all online sockets */
152 cpu_set_t
**socketmaps
; /* unique core_siblings */
153 int *socketids
; /* physical socket ids */
155 /* cores -- based on thread_siblings (internal kernel map of cpuX's
156 * hardware threads within the same core as cpuX) */
157 int ncores
; /* number of all online cores */
158 cpu_set_t
**coremaps
; /* unique thread_siblings */
159 int *coreids
; /* physical core ids */
161 int *polarization
; /* cpu polarization */
162 int *addresses
; /* physical cpu addresses */
163 int *configured
; /* cpu configured */
164 int physsockets
; /* Physical sockets (modules) */
165 int physchips
; /* Physical chips */
166 int physcoresperchip
; /* Physical cores per chip */
170 OUTPUT_SUMMARY
= 0, /* default */
171 OUTPUT_PARSABLE
, /* -p */
172 OUTPUT_READABLE
, /* -e */
176 SYSTEM_LIVE
= 0, /* analyzing a live system */
177 SYSTEM_SNAPSHOT
, /* analyzing a snapshot of a different system */
180 struct lscpu_modifier
{
181 int mode
; /* OUTPUT_* */
182 int system
; /* SYSTEM_* */
183 unsigned int hex
:1, /* print CPU masks rather than CPU lists */
184 compat
:1, /* use backwardly compatible format */
185 online
:1, /* print online CPUs */
186 offline
:1, /* print offline CPUs */
187 json
:1, /* JSON output format */
188 physical
:1; /* use physical numbers */
191 extern int read_hypervisor_dmi(void);
192 extern void arm_cpu_decode(struct lscpu_desc
*desc
);