Returns the CPU info by using the best sources of information for your OS. Returns {} if nothing is found.
()
| 1832 | info[key] = new_info[key] |
| 1833 | |
| 1834 | def get_cpu_info(): |
| 1835 | ''' |
| 1836 | Returns the CPU info by using the best sources of information for your OS. |
| 1837 | Returns {} if nothing is found. |
| 1838 | ''' |
| 1839 | |
| 1840 | # Get the CPU arch and bits |
| 1841 | arch, bits = parse_arch(DataSource.raw_arch_string) |
| 1842 | |
| 1843 | info = { |
| 1844 | 'cpuinfo_version' : CPUINFO_VERSION, |
| 1845 | 'arch' : arch, |
| 1846 | 'bits' : bits, |
| 1847 | 'count' : DataSource.cpu_count, |
| 1848 | 'raw_arch_string' : DataSource.raw_arch_string, |
| 1849 | } |
| 1850 | |
| 1851 | # Try the Windows registry |
| 1852 | CopyNewFields(info, _get_cpu_info_from_registry()) |
| 1853 | |
| 1854 | # Try /proc/cpuinfo |
| 1855 | CopyNewFields(info, _get_cpu_info_from_proc_cpuinfo()) |
| 1856 | |
| 1857 | # Try cpufreq-info |
| 1858 | CopyNewFields(info, _get_cpu_info_from_cpufreq_info()) |
| 1859 | |
| 1860 | # Try LSCPU |
| 1861 | CopyNewFields(info, _get_cpu_info_from_lscpu()) |
| 1862 | |
| 1863 | # Try sysctl |
| 1864 | CopyNewFields(info, _get_cpu_info_from_sysctl()) |
| 1865 | |
| 1866 | # Try kstat |
| 1867 | CopyNewFields(info, _get_cpu_info_from_kstat()) |
| 1868 | |
| 1869 | # Try dmesg |
| 1870 | CopyNewFields(info, _get_cpu_info_from_dmesg()) |
| 1871 | |
| 1872 | # Try /var/run/dmesg.boot |
| 1873 | CopyNewFields(info, _get_cpu_info_from_cat_var_run_dmesg_boot()) |
| 1874 | |
| 1875 | # Try lsprop ibm,pa-features |
| 1876 | CopyNewFields(info, _get_cpu_info_from_ibm_pa_features()) |
| 1877 | |
| 1878 | # Try sysinfo |
| 1879 | CopyNewFields(info, _get_cpu_info_from_sysinfo()) |
| 1880 | |
| 1881 | # Try querying the CPU cpuid register |
| 1882 | CopyNewFields(info, _get_cpu_info_from_cpuid()) |
| 1883 | |
| 1884 | return info |
| 1885 | |
| 1886 | # Make sure we are running on a supported system |
| 1887 | def _check_arch(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…