@@ -544,7 +544,13 @@ fn mul_div_po2_u64(value: u64, numer: u64, denom: u32) -> u64 {
544
544
#[ allow( dead_code) ]
545
545
#[ cfg( all( target_arch = "x86_64" , target_feature = "sse2" ) ) ]
546
546
fn has_tsc_support ( ) -> bool {
547
- read_cpuid_invariant_tsc ( ) && read_cpuid_rdtscp_support ( )
547
+ let cpuid = CpuId :: new ( ) ;
548
+ let has_invariant_tsc = cpuid. get_advanced_power_mgmt_info ( )
549
+ . map_or ( false , |apm| apm. has_invariant_tsc ( ) ) ;
550
+ let has_rdtscp = cpuid. get_extended_processor_and_feature_identifiers ( )
551
+ . map_or ( false , |epf| epf. has_rdtscp ( ) ) ;
552
+
553
+ has_invariant_tsc && has_rdtscp
548
554
}
549
555
550
556
#[ allow( dead_code) ]
@@ -553,22 +559,6 @@ fn has_tsc_support() -> bool {
553
559
false
554
560
}
555
561
556
- #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
557
- fn read_cpuid_invariant_tsc ( ) -> bool {
558
- let cpuid = CpuId :: new ( ) ;
559
- cpuid
560
- . get_advanced_power_mgmt_info ( )
561
- . map_or ( false , |efi| efi. has_invariant_tsc ( ) )
562
- }
563
-
564
- #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
565
- fn read_cpuid_rdtscp_support ( ) -> bool {
566
- let cpuid = CpuId :: new ( ) ;
567
- cpuid
568
- . get_extended_processor_and_feature_identifiers ( )
569
- . map_or ( false , |efi| efi. has_rdtscp ( ) )
570
- }
571
-
572
562
#[ cfg( test) ]
573
563
pub mod tests {
574
564
use super :: { Clock , Counter , Monotonic } ;
0 commit comments