Skip to content

Commit 1112b8e

Browse files
committed
chore(cargo): update raw-cpuid
1 parent 8ea6b05 commit 1112b8e

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ repository = "https://github.com/lovesegfault/cache-size"
1515
maintenance = { status = "actively-developed" }
1616

1717
[target.'cfg(target_arch = "x86")'.dependencies]
18-
raw-cpuid = "10.3.0"
18+
raw-cpuid = "11"
1919
[target.'cfg(target_arch = "x86_64")'.dependencies]
20-
raw-cpuid = "10.3.0"
20+
raw-cpuid = "11"

src/x86.rs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
use raw_cpuid::{self, CpuId};
1+
use raw_cpuid::{self, CpuId, CpuIdReaderNative};
22

33
pub use raw_cpuid::CacheType;
44

55
/// Uses the CPUID family info to detect Zen architecture CPUs.
66
///
77
/// Data pulled from https://en.wikichip.org/wiki/amd/cpuid.
88
#[inline]
9-
fn amd_is_zen(cpuid: &CpuId) -> Option<bool> {
9+
fn amd_is_zen(cpuid: &CpuId<CpuIdReaderNative>) -> Option<bool> {
1010
let info = cpuid.get_feature_info()?;
1111
match (info.base_family_id(), info.extended_family_id()) {
1212
(0xF, 0x8..=0xA) => Some(true),
@@ -16,7 +16,11 @@ fn amd_is_zen(cpuid: &CpuId) -> Option<bool> {
1616

1717
/// Uses cache parameters to get cache size at a given level with the provided cache type.
1818
#[inline]
19-
fn generic_cache_size(cpuid: CpuId, level: u8, cache_type: CacheType) -> Option<usize> {
19+
fn generic_cache_size(
20+
cpuid: CpuId<CpuIdReaderNative>,
21+
level: u8,
22+
cache_type: CacheType,
23+
) -> Option<usize> {
2024
cpuid
2125
.get_cache_parameters()?
2226
.filter(|c| c.level() == level && c.cache_type() == cache_type)
@@ -27,7 +31,11 @@ fn generic_cache_size(cpuid: CpuId, level: u8, cache_type: CacheType) -> Option<
2731
/// This is computed using tlb info. The values come back in kilobytes, so they are multiplied by
2832
/// 1024 to give the size in bytes to match the behaviour of other architectures.
2933
#[inline]
30-
fn amd_cache_size(cpuid: CpuId, level: u8, cache_type: CacheType) -> Option<usize> {
34+
fn amd_cache_size(
35+
cpuid: CpuId<CpuIdReaderNative>,
36+
level: u8,
37+
cache_type: CacheType,
38+
) -> Option<usize> {
3139
match (level, cache_type) {
3240
(1, CacheType::Instruction) => cpuid
3341
.get_l1_cache_and_tlb_info()
@@ -70,7 +78,11 @@ pub fn cache_size(level: u8, cache_type: CacheType) -> Option<usize> {
7078

7179
/// Uses cache parameters to get cache line size at a given level with the provided cache type.
7280
#[inline]
73-
fn generic_cache_line_size(cpuid: CpuId, level: u8, cache_type: CacheType) -> Option<usize> {
81+
fn generic_cache_line_size(
82+
cpuid: CpuId<CpuIdReaderNative>,
83+
level: u8,
84+
cache_type: CacheType,
85+
) -> Option<usize> {
7486
cpuid
7587
.get_cache_parameters()?
7688
.filter(|cparams| cparams.level() == level && cparams.cache_type() == cache_type)
@@ -81,7 +93,11 @@ fn generic_cache_line_size(cpuid: CpuId, level: u8, cache_type: CacheType) -> Op
8193
/// This is computed using tlb info. Instruction and data cache line sizes
8294
/// are available separately for the L1 cache, but only unified is available for L2 and L3 caches.
8395
#[inline]
84-
fn amd_cache_line_size(cpuid: CpuId, level: u8, cache_type: CacheType) -> Option<usize> {
96+
fn amd_cache_line_size(
97+
cpuid: CpuId<CpuIdReaderNative>,
98+
level: u8,
99+
cache_type: CacheType,
100+
) -> Option<usize> {
85101
match (level, cache_type) {
86102
(1, CacheType::Instruction) => cpuid
87103
.get_l1_cache_and_tlb_info()

0 commit comments

Comments
 (0)