Skip to content

Conversation

@jacobtomlinson
Copy link

Potential workaround for #155 by allowing you to specify which sources to use when collecting data.

# Example of removing the slow CPUID source in Python
from cpuinfo import get_cpu_info, SOURCES

SOURCES.remove("CPUID")
info = get_cpu_info(sources=SOURCES)

or

$ # Example using just a few sources via the CLI flag 
$ python -m cpuinfo --sources LSCPU,PROC_CPUINFO,DMESG
Python Version: 3.9.15.final.0 (64 bit)
Cpuinfo Version: 9.0.0
Vendor ID Raw: GenuineIntel
...

Benchmarks

$ # With CPUID
$ time python -m cpuinfo --sources WMIC,REGISTRY,PROC_CPUINFO,CPUFREQ_INFO,LSCPU,SYSCTL,KSTAT,DMESG,DMESG_BOOT,LSPROP,SYSINFO,UNAME,CPUID > /dev/null
python -m cpuinfo --sources  > /dev/null  1.07s user 0.12s system 101% cpu 1.173 total

$ # Without CPUID
$ time python -m cpuinfo --sources WMIC,REGISTRY,PROC_CPUINFO,CPUFREQ_INFO,LSCPU,SYSCTL,KSTAT,DMESG,DMESG_BOOT,LSPROP,SYSINFO,UNAME > /dev/null      
python -m cpuinfo --sources  > /dev/null  0.10s user 0.02s system 80% cpu 0.149 total

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant