-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
slow get_cpu_info w/o pyinstaller #134
Comments
This sounds like a good thing to try. Other platforms shouldn't have to be penalized because of design flaws in Windows (not having proper forking). I'm open to you making a PR for it. Thanks |
Turns out I was wrong and this:
is not the culprit this function seems the one to be causing the slow down. What confused me originally is the fact that this slow down occurs non-deterministically. BTW, I reproduced it on multiple machines and OSs, including MacOS and Ubuntu. Now, I've been using 5.0.0, but it seems that master is a bit ahead, so I'm not sure if the issue is still there with latest py-cpuinfo, but I wouldn't see why not after glancing at the code I don't know what's the best course of action at this point. I'll try to dig a bit more if I find the time later in these days. |
That is okay. Thanks anyway. Maybe you or someone will figure it out later. BTW. The |
maybe this could help? |
anyway, let me ask a question: I pretty much only need |
Wow. What did you use to make that PDF? |
You can call the internal functions directly. But it isn't recommended, because the internal functions are not API stable and may change in the future. from cpuinfo import *
info = cpuinfo._get_cpu_info_from_registry()
print(info) Other ones are # Try the Windows wmic
_get_cpu_info_from_wmic()
# Try the Windows registry
_get_cpu_info_from_registry()
# Try /proc/cpuinfo
_get_cpu_info_from_proc_cpuinfo()
# Try cpufreq-info
_get_cpu_info_from_cpufreq_info()
# Try LSCPU
_get_cpu_info_from_lscpu()
# Try sysctl
_get_cpu_info_from_sysctl()
# Try kstat
_get_cpu_info_from_kstat()
# Try dmesg
_get_cpu_info_from_dmesg()
# Try /var/run/dmesg.boot
_get_cpu_info_from_cat_var_run_dmesg_boot()
# Try lsprop ibm,pa-features
_get_cpu_info_from_ibm_pa_features()
# Try sysinfo
_get_cpu_info_from_sysinfo() |
Hi! I used Python's CProfile for data collection and gprof2dot to create the pdf. Here's a summary.
yeah, that's why I was a bit hesitant to do it... BTW, let me add an extra piece to the puzzle: not only is the slow-down not deterministic, but also the output -- the returned dictionary containing the platform information -- may differ from run to run. I recently noticed that some entries may be missing. To reproduce, but you can try running |
Hi,
It takes more than a second for
get_cpu_info
to return w/o pyinstaller. See also hereI haven't profiled the code, but if I bypass that
else
calling_get_cpu_info_internal
directly, it runs much quicker (in at most tens of ms).I wonder whether we can improve this, at least on Linux/Darwin, where I seem to understand we could skip that
else
? Would you accept a tiny patch that reads the OS name such that theif
is entered if on Linux/Darwin ?The text was updated successfully, but these errors were encountered: