cpuinfo: CPU Information in Racket
(require (planet neil/cpuinfo:1:0)) |
1 Introduction
> (define my-cpuinfo (get-cpuinfo))
> (cpuinfo->english my-cpuinfo)
> (cpuinfo->english my-cpuinfo)
> (cpuinfo-kvm-support my-cpuinfo)
> my-cpuinfo
(((processor . "0") |
(vendor-id . "GenuineIntel") |
(cpu-family . "6") |
(model . "14") |
(model-name . "Intel(R) Core(TM) Duo CPU T2500 @ 2.00GHz") |
(stepping . "12") |
(cpu-mhz . "1333.000") |
(cache-size . "2048 KB") |
(physical-id . "0") |
(siblings . "2") |
(core-id . "0") |
(cpu-cores . "2") |
(apicid . "0") |
(initial-apicid . "0") |
(fdiv-bug . "no") |
(hlt-bug . "no") |
(f00f-bug . "no") |
(coma-bug . "no") |
(fpu . "yes") |
(fpu-exception . "yes") |
(cpuid-level . "10") |
(wp . "yes") |
(flags |
. "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon bts aperfmperf pni monitor vmx est tm2 xtpr pdcm") |
(bogomips . "3990.15") |
(clflush-size . "64") |
(cache-alignment . "64") |
(address-sizes . "32 bits physical, 32 bits virtual") |
(power-management . "")) |
((processor . "1") |
(vendor-id . "GenuineIntel") |
(cpu-family . "6") |
(model . "14") |
(model-name . "Intel(R) Core(TM) Duo CPU T2500 @ 2.00GHz") |
(stepping . "12") |
(cpu-mhz . "2000.000") |
(cache-size . "2048 KB") |
(physical-id . "0") |
(siblings . "2") |
(core-id . "1") |
(cpu-cores . "2") |
(apicid . "1") |
(initial-apicid . "1") |
(fdiv-bug . "no") |
(hlt-bug . "no") |
(f00f-bug . "no") |
(coma-bug . "no") |
(fpu . "yes") |
(fpu-exception . "yes") |
(cpuid-level . "10") |
(wp . "yes") |
(flags |
. "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon bts aperfmperf pni monitor vmx est tm2 xtpr pdcm") |
(bogomips . "3990.07") |
(clflush-size . "64") |
(cache-alignment . "64") |
(address-sizes . "32 bits physical, 32 bits virtual") |
(power-management . ""))) |
2 Interface
3 Known Issues
Need testing with a broader range of "/proc/cpuinfo", for different kinds of processors.
Could use info about operating systems that do not provide "/proc/cpuinfo", but provide some other practical means to get CPU information.
The code for counting physical processors, cores, and hyperthreading is not exposed. This is intentional, since the interface is more likely to change, but it could be exposed anyway.
Would be nice if we could get the Intel sSpec number, but we’d have to keep and update a large table, and (from perusing Intel specs pages) it looks like sometimes we couldn’t narrow it down to a single number and we’d have to yield a list of possible ones instead of the exact one. Might still be useful. Or we might at least provide an Intel CPUID feature. See Intel ARK and Steven W. McDougall’s page on identifying Intel CPUs
4 History
- PLaneT 1:0 —
2012-11-15 Initial release.
5 Legal
Copyright 2012 Neil Van Dyke. This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See http://www.gnu.org/licenses/ for details. For other licenses and consulting, please contact the author.