hlibcpuid-0.2.0: Bindings to https://github.com/anrieff/libcpuid

Copyright(c) Daniel Taskoff 2020
LicenseMIT
Maintainerdaniel.taskoff@gmail.com
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

System.LibCPUID.CPUID

Contents

Description

A wrapper around cpu_id_t from https://github.com/anrieff/libcpuid.

Usage:

cpuid >>= \case
 Left err -> error err
 Right CPUID {..} -> do
   mapM_ putStrLn
     [ "Available CPU information"
     , "------------------------------------------"
     , "vendor string: " ++ vendorString
     , "brand string: " ++ brandString
     , "has a time-stamp counter (TSC): " ++  if hasTSC then "yes" else "no"
     , "# physical cores per processor: " ++ show physicalCores
     , "# logical cores per processor: " ++ show logicalCores
     , "# processors: " ++ show (div totalLogicalCores logicalCores)
     ]
Synopsis

CPUID

data CPUID Source #

CPU information and features.

Constructors

CPUID 

Fields

Instances
Storable CPUID Source # 
Instance details

Defined in System.LibCPUID.CPUID

Methods

sizeOf :: CPUID -> Int #

alignment :: CPUID -> Int #

peekElemOff :: Ptr CPUID -> Int -> IO CPUID #

pokeElemOff :: Ptr CPUID -> Int -> CPUID -> IO () #

peekByteOff :: Ptr b -> Int -> IO CPUID #

pokeByteOff :: Ptr b -> Int -> CPUID -> IO () #

peek :: Ptr CPUID -> IO CPUID #

poke :: Ptr CPUID -> CPUID -> IO () #

cpuid :: IO (Either String CPUID) Source #

Get CPU information and features, or an error message, if the CPU can't be identified by libcpuid.

isCPUIDPresent :: IO Bool Source #

Check if the CPUID instruction is supported.