Karel Zak
e3f213184a
lscpu: add sections
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
01bea871dd
lscpu: add rest of summary
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
778254d9a2
lscpu: keep static/dynamic MHz in cputype struct
...
The Dynamic and Static MHz are /proc/cpuinfo s390 per-CPU fields, but
we display it as a single value according the first parsed CPU. For
this purpose we store the values from the first CPU in lscpu_cputype.
For -p and -e outputs we will print per CPU values.
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
93a1bb1009
lscpu: add another part of summary output
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
6d5699e6b5
lscpu: add functions to get CPU freq
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
406b088cb4
lscpu: fix NUMAs reading code
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
2f5e2730fe
lscpu: add per type summary function
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
db919abc13
lscpu: use size_t for counters
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
d8813bb378
lscpu: print generic part of the summary
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
eaf32c65be
lscpu: add setsize to lscpu context
...
Don't recalculate again and again setsize from maxcpus.
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
05abf5944e
lscpu: add function to count caches size
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
6fbb53286d
lscpu: use cache ID, keep caches independent on CPU type
...
The cache is identified by Type, Level and ID, the ID is unique cache
instance identifier (of the type).
This changes forces lscpu allocate more lscpu_cache instances (than
old version), but now we're ready for arbitrary scenario where
different CPU types share caches and the same cache type uses
different size in different instances, etc.
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
4b9cbc38a4
lscpu: use new code to read CPUs info
...
and remove test program from lscpu-cputype.c.
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
b73d38b1d1
lscpu: convert getopt block to new API
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
30b912d335
lscpu: add LSCPU_OUTPUT_ enum
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
27c349f9d1
lscpu: move to main function to init context
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
43715b4ea8
lscpu: move debug initialization to main
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
095be2c20e
lscpu: merge new API to lscpu.h
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
7454b598e4
lscpu: use constants from new API
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
f9ac021032
lscpu: remove obsolete code
...
This is the first step in conversion from old lscpu to the new code.
The patch removes obsolete code from lscpu.c and lscpu.h. The old
output code in lscpu.c is temporary disabled by #ifdef due to
incompatibility between old and new internal APIs -- this will be
changed later by small steps to make all all the changes review-able.
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
3d590f8ea1
lscpu: (virt) add macros for VMWARE
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
eadaf6d758
lscpu: (topology) read caches from /sys
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
e36e01f980
lscpu: sort extra caches
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
ff7449d2ea
lscpu: improve debug message
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
ffb7fcfbba
lscpu: remove unused function
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
25c2a72cd6
lscpu; (cpuinfo) parse caches
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
9d08a19d54
lscpu: (topology) add read_mhz()
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
8c587fad9f
lscpu: (topology) add read_configure()
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
6d1a2705f7
lscpu: (topology) add read_address()
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
2075eb60b5
lscpu: hide all to lscpu_read_topology()
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
9aa82cd7e6
lscpu: (virt) simplify hypervisor parsing
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
5d68f974b4
lib/strutils: add normalize_whitespace()
...
This function removes extra whitespace.
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
ee0fabda30
lscpu: (cpuinfo) rewrite parser
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
f495abb799
lscpu: (cpuinfo) fill empty cputype
...
Don't introduce a new CPU-type if the current is empty.
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
f5d1353246
lscpu: new cpuinfo parser
...
* extendable by new patterns
* simple semantic
* the same code for all pattern types
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
021d0b3d1d
lscpu: keep hypervisor name in allocated memory
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
801b125f8f
lscpu: temporary commit
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
6baa4df7ec
lscpu: improve topology calculation, use /proc/sysinfo
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
fd5999d9ac
lscpu: support s390 cpuinfo processor-pre-line format
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
fd35a1dae6
lsblk: add lscpu_read_topology_polarization()
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
f669523ba0
lscpu: move topology stuff to separate file
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
0266f5cbab
lscpu: improve topology debug message
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
fa6a21bf63
lscpu: calculate threads number from type specific values
...
Don't use global CPU masks (like "online" or "present") to
calculate type specific number of threads due systems with
mixed CPU types.
It's also necessary to check all thread_siblings maps to get the
highest number, because some threads (CPUs) may be disables, for
example old lscpu calculates number of threads from the cpu0 and
if you disable cpu0's sibling (cpu4):
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 2 <---
Core(s) per socket: 4
Socket(s): 1
# chcpu --disable 4
CPU 4 disabled
CPU(s): 8
On-line CPU(s) list: 0-3,5-7
Off-line CPU(s) list: 4
Thread(s) per core: 1 <--- !
Core(s) per socket: 4
Socket(s): 1
because 'thread_siblings' contains only one thread for cpu0:
# cat /sys/devices/system/cpu/cpu{0,1,2,3,4,5,6,7}/topology/thread_siblings_list
0
1,5
2,6
3,7
cat: /sys/devices/system/cpu/cpu4/topology/thread_siblings_list: No such file or directory
1,5
2,6
3,7
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
b8a319460d
lscpu: deallocate maps
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
314aa95fd5
lscpu: add lscpu_read_topolgy_ids()
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
9d5f3b4873
lscpu: add lscpu_read_topology()
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
9c5b106b01
lscpu: add lscpu_cpus_loopup_by_type(), improve readability
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
504de58512
lscpu: convert ARM decoding to new API
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
a94bb4357e
lscpu: cleaup arch freeing
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak
909d35758e
lscpu: add lscpu_read_virtualization()
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00