Skip to content

Commit

Permalink
Merge pull request #124 from workhorsy/readme_cleanup
Browse files Browse the repository at this point in the history
Readme cleanup
  • Loading branch information
workhorsy committed Apr 8, 2019
2 parents f8a11f3 + 3df4727 commit aa52b23
Showing 1 changed file with 89 additions and 58 deletions.
147 changes: 89 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,15 @@ extra programs or libraries, beyond what your OS provides. It does not require
any compilation(C/C++, assembly, et cetera) to use. It works with Python 2
and 3.

OS Support
-----
| OS | Tested and should work | Untested |
| :------------ | :----------------------------------------------------- | :-------------- |
| Android | | Everything |
| BSD | FreeBSD, PC-BSD, TrueOS | OpenBSD, NetBSD |
| Cygwin | Windows | |
| Haiku | Haiku Nightly | BeOS |
| Linux | Arch, Centos, Debian, Fedora, Gentoo, OpenSuse, Ubuntu | |
| OS X | 10.8 - 10.14 | |
| Solaris | Oracle Solaris, OpenIndiana | |
| Windows | XP, Vista, 7, 8, 10 | RT |


CPU Support
Example
-----
* X86 32bit and 64bit
* Some ARM and PPC CPUs
~~~python
from cpuinfo import get_cpu_info

for key, value in get_cpu_info().items():
print("{0}: {1}".format(key, value))
~~~


API
Expand All @@ -47,51 +38,48 @@ get_cpu_info_json()
~~~


Output
Fields
-----
| key | Example value | Return Format |
| :---------------------------- | :------------------------ | :-------------------- |
| "python_version" | "2.7.12.final.0 (64 bit)" | string |
| "cpuinfo_version" | (4, 0, 0) | (int, int, int) |
| "hz_advertised_friendly" | "2.9300 GHz" | string |
| "hz_actual_friendly" | "1.7330 GHz" | string |
| "hz_advertised" | (2930000000, 0) | (int, int) |
| "hz_actual" | (1733000000, 0) | (int, int) |
| "arch" | "X86_64" | "X86_32", "X86_64", "ARM_8", "ARM_7", "PPC_32", "PPC_64", "SPARC_32", "SPARC_64" |
| "bits" | 64 | int |
| "count" | 4 | int |
| "l1_data_cache_size" | "32 KB" | string |
| "l1_instruction_cache_size" | "32 KB" | string |
| "l2_cache_size" | "256 KB" | string |
| "l2_cache_line_size" | 6 | int |
| "l2_cache_associativity" | 0x100 | int |
| "l3_cache_size" | "3072 KB" | string |
| "stepping" | 5 | int |
| "model" | 30 | int |
| "family" | 6 | int |
| "processor_type" | 0 | int |
| "extended_model" | 0 | int |
| "extended_family" | 0 | int |
| "flags" | ['acpi', 'aperfmperf', 'apic', 'arch_perfmon', 'bts', 'clflush', 'cmov', 'constant_tsc', 'cx16', 'cx8', 'de', 'ds_cpl', 'dtes64', 'dtherm', 'dts', 'ept', 'est', 'flexpriority', 'fpu', 'fxsr', 'ht', 'ida', 'lahf_lm', 'lm', 'mca', 'mce', 'mmx', 'monitor', 'msr', 'mtrr', 'nonstop_tsc', 'nopl', 'nx', 'pae', 'pat', 'pbe', 'pdcm', 'pebs', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdtscp', 'rep_good', 'sep', 'smx', 'ss', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'syscall', 'tm', 'tm2', 'tpr_shadow', 'tsc', 'vme', 'vmx', 'vnmi', 'vpid', 'xtopology', 'xtpr'] | [string] |


Raw Fields
-----
| key | Example value |
| :---------------------------- | :-------------- |
| python_version | "2.7.12.final.0 (64 bit)" |
| cpuinfo_version | (4, 0, 0) |
| vendor_id_raw | "GenuineIntel" |
| hardware_raw | "BCM2708" |
| brand_raw | "Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz" |
| hz_advertised_friendly | "2.9300 GHz" |
| hz_actual_friendly | "1.7330 GHz" |
| hz_advertised | (2930000000, 0)|
| hz_actual | (1733000000, 0) |
| arch | "X86_64" |
| bits | 64 |
| count | 4 |
| arch_string_raw | "x86_64" |
| l1_data_cache_size | "32 KB" |
| l1_instruction_cache_size | "32 KB" |
| l2_cache_size | "256 KB" |
| l2_cache_line_size | 6 |
| l2_cache_associativity | 0x100 |
| l3_cache_size | "3072 KB" |
| stepping | 5 |
| model | 30 |
| family | 6 |
| processor_type | 0 |
| extended_model | 0 |
| extended_family | 0 |
| flags | ['acpi', 'aperfmperf', 'apic', 'arch_perfmon', 'bts', 'clflush', 'cmov', 'constant_tsc', 'cx16', 'cx8', 'de', 'ds_cpl', 'dtes64', 'dtherm', 'dts', 'ept', 'est', 'flexpriority', 'fpu', 'fxsr', 'ht', 'ida', 'lahf_lm', 'lm', 'mca', 'mce', 'mmx', 'monitor', 'msr', 'mtrr', 'nonstop_tsc', 'nopl', 'nx', 'pae', 'pat', 'pbe', 'pdcm', 'pebs', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdtscp', 'rep_good', 'sep', 'smx', 'ss', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'syscall', 'tm', 'tm2', 'tpr_shadow', 'tsc', 'vme', 'vmx', 'vnmi', 'vpid', 'xtopology', 'xtpr'] |

These fields are pulled directly from the CPU and are unverified. They may
contain expected results. Other times they may contain wildly unexpected
results or garbage. So it would be a bad idea to rely on them.

| key | Example value | Return Format |
| :---------------------------- | :------------------------ | :-------------------- |
| "vendor_id_raw" | "GenuineIntel" | string |
| "hardware_raw" | "BCM2708" | string |
| "brand_raw" | "Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz" | string |
| "arch_string_raw" | "x86_64" | string |

These approaches are used for getting info:
-----
1. Windows Registry (Windows)
2. /proc/cpuinfo (Linux)
3. sysctl (OS X)
4. dmesg (Unix/Linux)
5. /var/run/dmesg.boot (BSD/Unix)
6. isainfo and kstat (Solaris)
7. cpufreq-info (BeagleBone)
8. lscpu (Unix/Linux)
9. sysinfo (Haiku)
10. device-tree ibm features flags (Linux PPC)
11. Querying the CPUID register (Intel X86 CPUs)


Run as a script
Expand Down Expand Up @@ -136,6 +124,49 @@ $ python -m pip install -U py-cpuinfo
~~~


Command Line Arguments
----
~~~
--help: show this help message and exit
--json: Return the info in JSON format
~~~


OS Support
-----
| OS | Tested and should work | Untested |
| :------------ | :----------------------------------------------------- | :-------------- |
| Android | | Everything |
| BSD | FreeBSD, PC-BSD, TrueOS | OpenBSD, NetBSD |
| Cygwin | Windows | |
| Haiku | Haiku Nightly | BeOS |
| Linux | Arch, Centos, Debian, Fedora, Gentoo, OpenSuse, Ubuntu | |
| OS X | 10.8 - 10.14 | |
| Solaris | Oracle Solaris, OpenIndiana | |
| Windows | XP, Vista, 7, 8, 10 | RT |


CPU Support
-----
* X86 32bit and 64bit
* Some ARM and PPC CPUs


These approaches are used for getting info:
-----
1. Windows Registry (Windows)
2. /proc/cpuinfo (Linux)
3. sysctl (OS X)
4. dmesg (Unix/Linux)
5. /var/run/dmesg.boot (BSD/Unix)
6. isainfo and kstat (Solaris)
7. cpufreq-info (BeagleBone)
8. lscpu (Unix/Linux)
9. sysinfo (Haiku)
10. device-tree ibm features flags (Linux PPC)
11. Querying the CPUID register (Intel X86 CPUs)


Bugs and Corrections
-----

Expand Down

0 comments on commit aa52b23

Please sign in to comment.