1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2024-11-20 23:01:51 +00:00
Commit graph

753 commits

Author SHA1 Message Date
Xorg
73c33ced4a
Add get_error function for internal use
Sometimes, the _libcpuid_errno value needs to be returned
2022-09-25 10:22:22 +02:00
Xorg
10b4e46179
Fix typo in variable name 2022-09-25 10:11:39 +02:00
Xorg
871840f8e5
Fix cpuid_serialize_raw_data_internal when no filename is provided 2022-09-24 18:57:35 +02:00
Xorg
49cb8703ca
Typo (RAW to raw) 2022-09-23 18:44:38 +02:00
Xorg
dc406c4de1
Do not print the same message twice when reading a raw CPUID dump 2022-09-23 18:44:11 +02:00
Xorg
3ed66b7613
Treat others CPU packages as different CPU types
If a RAW dump is containing for instance 256 logical CPUs (2 sockets with 64 cores and SMT), they should not be considered as a 128 cores CPU with SMT.
2022-09-22 21:50:08 +02:00
Xorg
1a0eb95d02
DB: add more AMD Kabini 2022-09-22 20:54:25 +02:00
Xorg
f23a2e3a41
DB: add AMD Steppe Eagle 2022-09-22 20:46:36 +02:00
Xorg
e591e52245
DB: add AMD Beema 2022-09-22 20:46:23 +02:00
Xorg
a3b9b7a798
DB: add AMD Abu Dhabi 2022-09-22 20:27:08 +02:00
Xorg
401a56e4cb
DB: add AMD Interlagos 2022-09-22 20:26:55 +02:00
Xorg
ee97ed213a
DB: rename AMD Bulldozer to Zambezi 2022-09-22 20:17:33 +02:00
Xorg
15d79452f7
DB: fix entry for Godavari x2 2022-09-22 20:10:52 +02:00
Xorg
a98817b804
DB: add AMD Bald Eagle 2022-09-22 20:10:36 +02:00
Xorg
5b8d89a37d
Tests: replace converted RAW dumps from instlatx64 to AIDA64 format
Since 2b8023f733 and 6b742be8cb, it makes sense to update these tests to add:
- RAW CPUID for all CPU cores
- Number of caches instances
2022-09-22 19:36:48 +02:00
Xorg
6b742be8cb Add cache instances field in cpu_id_t and system_id_t 2022-09-22 17:49:38 +02:00
Xorg
0c9ef3249c Decode deterministic cache info for AMD CPUs too
Since Zen-based CPUs, cpu_id_t::l3_cache is the size of the total L3 cache for the whole chip, while cpu_id_t::l1_cache and cpu_id_t::l2_cache are size for each instances.
This change provide L3 cache size per instance.
2022-09-22 17:49:38 +02:00
Umio Yasuno
2ec692b579 Fix null pointer dereference in cpuid_deserialize_raw_data_internal 2022-09-20 18:34:46 +02:00
Xorg
b1732e4785
Tests: minor fixes
Since ff5aafb5f4, xeon-scalable-4114.test and qemu.test are failling because RAW came from a VM.
Since 2b8023f733, godavari-x4.test is failling due to the merge after 9710e7c0ba
2022-09-20 06:58:32 +02:00
Xorg
1575ce49fd
Tests: add return code in run_tests.py
The goal is to fail CI jobs if tests fail
2022-09-20 06:53:16 +02:00
Xorg
ff5aafb5f4 Detect Virtual Machine
Fix #90
2022-09-18 10:26:02 +02:00
Xorg
ab395f8756
Do not inline util functions
It creates warning with GCC.
2022-09-15 22:15:48 +02:00
Xorg
2b8023f733
Support for hybrid CPU (#166)
* Set CMAKE_C_FLAGS_DEBUG to display warnings during build

CI workflows are reporting warnings. Adding more C flags here help to avoid that.

* Add new types

* Add set_cpu_affinity function

* Add cpu_identify_all function

* Add cpu_request_core_type function

* Add cpuid_get_all_raw_data, cpuid_serialize_all_raw_data and cpuid_deserialize_all_raw_data functions

* Detect hybrid architecture for Intel CPUs

* Update cpuid_tool to detect all CPU logical cores

* Rename tests subdirectories for Intel Core

* Update all tests

Since e4309a6c4bc3ad875711a1599cba01a205b3103e, new fields are reported by cpuid_tool

* Add Intel Alder Lake

Fix #157

* Remove convert_instlatx64.c

This tool is not useful anymore because the cpuid_deserialize_raw_data_internal() function can natively parse them since 5667e1401c

* Fix affinity_mask computation

* Define _GNU_SOURCE in configure.ac

Forgotten in 4f80964db5

* Use dynamic raw array in cpu_raw_data_array_t

* Add cpu_affinity_mask_t type

* Improve set_cpu_affinity function

- Print a warning if logical CPU number is not supported on operating system
- Return a boolean value in case of success instead of an integer

* Improve cpu_identify_all and cpu_request_core_type functions

* Use dynamic array for cpu_types in system_id_t

This commit also adds cleanups, fixes and consistency

* Tests: update Ryzen 5 Matisse with all CPU cores

* Add affinity_mask_str_r function and address other comments

- Fixed cpuid_grow_raw_data_array and cpu_raw_data_array_t.logical_cpu_t with the correct type
- Added a note about hard limit of cpu_raw_data_array_t
- Fixed a typo in cpuid_deserialize_raw_data_internal

* Fix build on Windows
2022-09-15 18:37:08 +02:00
Xorg
9710e7c0ba
DB: add AMD Athlon Godavari
Fix X0rg/CPU-X#232
2022-09-07 18:37:14 +02:00
Azat Khuzhin
fe2587c2ed
Fix build under clang-15 (#167)
Build error on freebsd [1]:

    Sep 06 18:40:42 [1106/5912] Building C object contrib/libcpuid-cmake/CMakeFiles/_cpuid.dir/__/libcpuid/libcpuid/rdmsr.c.o
    Sep 06 18:40:42 FAILED: contrib/libcpuid-cmake/CMakeFiles/_cpuid.dir/__/libcpuid/libcpuid/rdmsr.c.o
    Sep 06 18:40:42 /usr/bin/ccache /usr/bin/clang-15 --target=x86_64-pc-freebsd11 --sysroot=/build/cmake/freebsd/../../contrib/sysroot/freebsd-x86_64 -DHAS_RESERVED_IDENTIFIER -DSTD_EXCEPTION_HAS_STACK_TRACE=1 -DVERSION=\"v0.4.1\" -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -isystem ../contrib/libcpuid -isystem ../contrib/libcxx/include -isystem ../contrib/libcxxabi/include -isystem ../contrib/libunwind/include -fdiagnostics-color=always -Xclang -fuse-ctor-homing  -gdwarf-aranges -pipe -mssse3 -msse4.1 -msse4.2 -mpclmul -mpopcnt -fasynchronous-unwind-tables -ffile-prefix-map=/build=. -falign-functions=32 -mbranches-within-32B-boundaries  -fdiagnostics-absolute-paths -fexperimental-new-pass-manager -w -O2 -g -DNDEBUG -O3 -g -gdwarf-4    -D OS_FREEBSD -std=gnu11 -MD -MT contrib/libcpuid-cmake/CMakeFiles/_cpuid.dir/__/libcpuid/libcpuid/rdmsr.c.o -MF contrib/libcpuid-cmake/CMakeFiles/_cpuid.dir/__/libcpuid/libcpuid/rdmsr.c.o.d -o contrib/libcpuid-cmake/CMakeFiles/_cpuid.dir/__/libcpuid/libcpuid/rdmsr.c.o   -c ../contrib/libcpuid/libcpuid/rdmsr.c
    Sep 06 18:40:42 /build/contrib/libcpuid/libcpuid/rdmsr.c:164:2: error: call to undeclared library function 'snprintf' with type 'int (char *, unsigned long, const char *, ...)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    Sep 06 18:40:42         snprintf(msr, MSR_PATH_LEN, "/dev/cpuctl%u", core_num);
    Sep 06 18:40:42         ^
    Sep 06 18:40:42 /build/contrib/libcpuid/libcpuid/rdmsr.c:164:2: note: include the header <stdio.h> or explicitly provide a declaration for 'snprintf'
    Sep 06 18:40:42 1 error generated.

  [1]: https://s3.amazonaws.com/clickhouse-builds/41046/0e9265ad951d40cdce3716fb8a679360b2e0c156/binary_freebsd/build_log.log
2022-09-07 18:28:53 +03:00
Xorg
11e57e78a2
Remove Debian package (#165) 2022-09-03 21:48:12 +03:00
Xorg
660126c55d
Tests: add AMD A10 Pro-7350B (Kaveri) from InstLatx64 2022-08-28 11:42:25 +02:00
Xorg
ca0327d621
DB: add Warhol 2022-08-28 11:41:28 +02:00
Xorg
cbaa02a966
DB: add Rembrandt 2022-08-28 11:22:03 +02:00
Xorg
13654e0fd0
Simplifies binary package names
The CPUID tool will install the library as dependency
2022-08-28 10:40:42 +02:00
yanderemine54
4884cddbde Add Arch Linux to the list of systems with the package in the official repositories. 2022-05-30 19:00:28 +02:00
Xorg
ecd45bb276
Tests: add more Zen2 tests from InstLatx64 2022-02-06 11:52:55 +01:00
Xorg
5ce462c32c
DB: add Lucienne
https://en.wikichip.org/wiki/amd/cores/lucienne
Fix X0rg/CPU-X#209
2022-02-06 11:29:46 +01:00
emixa-d
bca7a19279
Report memory allocation failures without segfaulting. (#160) 2022-01-23 02:38:40 +02:00
Zhu Zihao
2e61160983
Don't link with msrdriver.c on non-Windows platform. (#159)
This simplify the procedure of sanitizing unneeded blob in source.
2022-01-14 10:35:10 +02:00
Veselin Georgiev
7a580fd2b2 CMake: reduce min cmake requirement 3.14 -> 3.13
There's no benefit from 3.14 we need to use, and 3.13 is supported
on older Linuxes.
2021-07-17 09:20:35 +03:00
Veselin Georgiev
6c23fcaacd Fix failing CI builds introduced by cb5fdd1
Add -DLIBCPUID_TESTS:BOOL=ON
2021-07-16 02:04:08 +03:00
Alyssa Ross
1acaf9980b
Use popcount64 from libc when available (#152)
* Use popcount64 from libc when available

Without this, we get a compiler error on NetBSD because the one in
libc has a slightly different prototype.

libcpuid_util.c:78:12: error: conflicting types for 'popcount64'
   78 | static int popcount64(uint64_t mask)
      |            ^~~~~~~~~~
In file included from /nix/store/155rj8nqh3xd80vpa8hl35p3hk7pacys-include-netbsd-8.0/include/string.h:98,
                 from libcpuid_util.c:30:
/nix/store/155rj8nqh3xd80vpa8hl35p3hk7pacys-include-netbsd-8.0/include/strings.h:61:14: note: previous declaration of 'popcount64' was here
   61 | unsigned int popcount64(__uint64_t) __constfunc;
      |              ^~~~~~~~~~

* Return unsigned int from popcount64

Matches NetBSD libc, where popcount64 originates.
2021-07-16 01:55:36 +03:00
SpaceIm
ae7b063c8a
allow to build either static or shared (#156)
also fix shared if msvc

Co-authored-by: Veselin Georgiev <anrieff@gmail.com>
2021-07-16 01:49:00 +03:00
SpaceIm
25e6e38c85
cmake: allow libcpuid to be added as a CMake subproject (#155) 2021-07-16 01:48:00 +03:00
SpaceIm
6aaa3ad92d
fix installation of BUNDLE if iOS (#154) 2021-07-16 01:47:17 +03:00
SpaceIm
cb5fdd1d86
cmake: add an option to build tests (#153) 2021-07-16 01:46:09 +03:00
Veselin Georgiev
27b002857a Fix #150: CPU Family/Model is used as Ext.Family/Model
This is a documentation-only issue; explain more verbosely what the
`ext_family` and `ext_model` fields in `struct cpu_id_t` are.
2021-07-16 01:39:53 +03:00
Xorg
0f1ad69145
DB: add Tiger Lake
https://en.wikipedia.org/wiki/Tiger_Lake
Related to X0rg/CPU-X#198
2021-05-26 06:57:04 +02:00
Xorg
ccd0ec8426
Doxygen: remove deprecated option
warning: Tag 'COLS_IN_ALPHA_INDEX' at line 1072 of file '/tmp/makepkg/libcpuid/src/build/libcpuid/Doxyfile' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
2021-03-21 11:51:06 +01:00
Xorg
179fbcb713
Release version 0.5.1 (#151) 2021-03-21 12:41:56 +02:00
Xorg
1843292dba
Tests: fix truncation warnings in convert_instlatx64 2021-03-20 18:14:06 +01:00
Xorg
eb1c306d95
Fix warning with a comment
/Users/runner/work/libcpuid/libcpuid/libcpuid/recog_intel.c:363:123: warning: '/*' within block comment [-Wcomment]
2021-03-20 18:02:18 +01:00
Xorg
167d059a6b
DB: add Rocket Lake
https://en.wikichip.org/wiki/intel/microarchitectures/rocket_lake
InstLatx64/InstLatx64@1bbddafe7b
2021-03-20 17:24:58 +01:00
Xorg
c8238acd0a
DB: add Milan
https://en.wikichip.org/wiki/amd/cores/milan
InstLatx64/InstLatx64@2dc186e948
2021-03-20 17:10:07 +01:00