Skip to content
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

Rename #123

Merged
merged 11 commits into from Apr 6, 2019

Renamed hz_actual_raw field to hz_actual.

  • Loading branch information...
workhorsy committed Apr 6, 2019
commit 5a39f9b22027031acd0a3051e66bf8de6104ff4a
@@ -59,7 +59,7 @@ Output
| hz_advertised_friendly | "2.9300 GHz" |
| hz_actual_friendly | "1.7330 GHz" |
| hz_advertised | (2930000000, 0)|
| hz_actual_raw | (1733000000, 0) |
| hz_actual | (1733000000, 0) |
| arch | "X86_64" |
| bits | 64 |
| count | 4 |
@@ -267,7 +267,7 @@ def _utf_to_str(input):
def _copy_new_fields(info, new_info):
keys = [
'vendor_id_raw', 'hardware_raw', 'brand_raw', 'hz_advertised_friendly', 'hz_actual_friendly',
'hz_advertised', 'hz_actual_raw', 'arch', 'bits', 'count',
'hz_advertised', 'hz_actual', 'arch', 'bits', 'count',
'arch_string_raw', 'uname_string_raw',
'l2_cache_size', 'l2_cache_line_size', 'l2_cache_associativity',
'stepping', 'model', 'family',
@@ -599,7 +599,7 @@ def _parse_dmesg_output(output):

if hz_advertised and hz_advertised != '0.0':
info['hz_advertised'] = _hz_short_to_raw(hz_advertised, scale)
info['hz_actual_raw'] = _hz_short_to_raw(hz_actual, scale)
info['hz_actual'] = _hz_short_to_raw(hz_actual, scale)

return {k: v for k, v in info.items() if v}
except:
@@ -1317,7 +1317,7 @@ def _actual_get_cpu_info_from_cpuid(queue):
'hz_advertised_friendly' : _hz_short_to_friendly(hz_advertised, scale),
'hz_actual_friendly' : _hz_short_to_friendly(hz_actual, 0),
'hz_advertised' : _hz_short_to_raw(hz_advertised, scale),
'hz_actual_raw' : _hz_short_to_raw(hz_actual, 0),
'hz_actual' : _hz_short_to_raw(hz_actual, 0),

'l2_cache_size' : _to_friendly_bytes(cache_info['size_kb']),
'l2_cache_line_size' : cache_info['line_size_b'],
@@ -1443,7 +1443,7 @@ def _get_cpu_info_from_proc_cpuinfo():
info['hz_advertised'] = _hz_short_to_raw(hz_advertised, scale)
if _hz_short_to_raw(hz_actual, scale) > (0, 0):
info['hz_actual_friendly'] = _hz_short_to_friendly(hz_actual, 6)
info['hz_actual_raw'] = _hz_short_to_raw(hz_actual, 6)
info['hz_actual'] = _hz_short_to_raw(hz_actual, 6)

info = {k: v for k, v in info.items() if v}
return info
@@ -1482,7 +1482,7 @@ def _get_cpu_info_from_cpufreq_info():
'hz_advertised_friendly' : _hz_short_to_friendly(hz_brand, scale),
'hz_actual_friendly' : _hz_short_to_friendly(hz_brand, scale),
'hz_advertised' : _hz_short_to_raw(hz_brand, scale),
'hz_actual_raw' : _hz_short_to_raw(hz_brand, scale),
'hz_actual' : _hz_short_to_raw(hz_brand, scale),
}

info = {k: v for k, v in info.items() if v}
@@ -1513,7 +1513,7 @@ def _get_cpu_info_from_lscpu():
info['hz_advertised_friendly'] = _hz_short_to_friendly(new_hz, scale)
info['hz_actual_friendly'] = _hz_short_to_friendly(new_hz, scale)
info['hz_advertised'] = _hz_short_to_raw(new_hz, scale)
info['hz_actual_raw'] = _hz_short_to_raw(new_hz, scale)
info['hz_actual'] = _hz_short_to_raw(new_hz, scale)

vendor_id = _get_field(False, output, None, None, 'Vendor ID')
if vendor_id:
@@ -1762,7 +1762,7 @@ def _get_cpu_info_from_sysctl():
'hz_advertised_friendly' : _hz_short_to_friendly(hz_advertised, scale),
'hz_actual_friendly' : _hz_short_to_friendly(hz_actual, 0),
'hz_advertised' : _hz_short_to_raw(hz_advertised, scale),
'hz_actual_raw' : _hz_short_to_raw(hz_actual, 0),
'hz_actual' : _hz_short_to_raw(hz_actual, 0),

'l2_cache_size' : _to_friendly_bytes(cache_size),

@@ -1829,7 +1829,7 @@ def _get_cpu_info_from_sysinfo_v1():
'hz_advertised_friendly' : _hz_short_to_friendly(hz_advertised, scale),
'hz_actual_friendly' : _hz_short_to_friendly(hz_actual, scale),
'hz_advertised' : _hz_short_to_raw(hz_advertised, scale),
'hz_actual_raw' : _hz_short_to_raw(hz_actual, scale),
'hz_actual' : _hz_short_to_raw(hz_actual, scale),

'l2_cache_size' : _to_friendly_bytes(cache_size),

@@ -1904,7 +1904,7 @@ def get_subsection_flags(output):
'hz_advertised_friendly' : _hz_short_to_friendly(hz_advertised, scale),
'hz_actual_friendly' : _hz_short_to_friendly(hz_actual, scale),
'hz_advertised' : _hz_short_to_raw(hz_advertised, scale),
'hz_actual_raw' : _hz_short_to_raw(hz_actual, scale),
'hz_actual' : _hz_short_to_raw(hz_actual, scale),

'l2_cache_size' : _to_friendly_bytes(cache_size),

@@ -1983,7 +1983,7 @@ def _get_cpu_info_from_wmic():
'hz_advertised_friendly' : _hz_short_to_friendly(hz_advertised, scale_advertised),
'hz_actual_friendly' : _hz_short_to_friendly(hz_actual, scale_actual),
'hz_advertised' : _hz_short_to_raw(hz_advertised, scale_advertised),
'hz_actual_raw' : _hz_short_to_raw(hz_actual, scale_actual),
'hz_actual' : _hz_short_to_raw(hz_actual, scale_actual),

'l2_cache_size' : l2_cache_size,
'l3_cache_size' : l3_cache_size,
@@ -2089,7 +2089,7 @@ def is_set(bit):
'hz_advertised_friendly' : _hz_short_to_friendly(hz_advertised, scale),
'hz_actual_friendly' : _hz_short_to_friendly(hz_actual, 6),
'hz_advertised' : _hz_short_to_raw(hz_advertised, scale),
'hz_actual_raw' : _hz_short_to_raw(hz_actual, 6),
'hz_actual' : _hz_short_to_raw(hz_actual, 6),

'flags' : flags
}
@@ -2146,7 +2146,7 @@ def _get_cpu_info_from_kstat():
'hz_advertised_friendly' : _hz_short_to_friendly(hz_advertised, scale),
'hz_actual_friendly' : _hz_short_to_friendly(hz_actual, 0),
'hz_advertised' : _hz_short_to_raw(hz_advertised, scale),
'hz_actual_raw' : _hz_short_to_raw(hz_actual, 0),
'hz_actual' : _hz_short_to_raw(hz_actual, 0),

'stepping' : stepping,
'model' : model,
@@ -2331,7 +2331,7 @@ def main():
print('Hz Advertised Friendly: {0}'.format(info.get('hz_advertised_friendly', '')))
print('Hz Actual Friendly: {0}'.format(info.get('hz_actual_friendly', '')))
print('Hz Advertised: {0}'.format(info.get('hz_advertised', '')))
print('Hz Actual Raw: {0}'.format(info.get('hz_actual_raw', '')))
print('Hz Actual: {0}'.format(info.get('hz_actual', '')))
print('Arch: {0}'.format(info.get('arch', '')))
print('Bits: {0}'.format(info.get('bits', '')))
print('Count: {0}'.format(info.get('count', '')))
@@ -92,7 +92,7 @@ def test_get_cpu_info_from_dmesg(self):
self.assertEqual('2.8000 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.8000 GHz', info['hz_actual_friendly'])
self.assertEqual((2800000000, 0), info['hz_advertised'])
self.assertEqual((2800000000, 0), info['hz_actual_raw'])
self.assertEqual((2800000000, 0), info['hz_actual'])

self.assertEqual(7, info['stepping'])
self.assertEqual(42, info['model'])
@@ -115,7 +115,7 @@ def test_get_cpu_info_from_cat_var_run_dmesg_boot(self):
self.assertEqual('2.8000 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.8000 GHz', info['hz_actual_friendly'])
self.assertEqual((2800000000, 0), info['hz_advertised'])
self.assertEqual((2800000000, 0), info['hz_actual_raw'])
self.assertEqual((2800000000, 0), info['hz_actual'])

self.assertEqual(7, info['stepping'])
self.assertEqual(42, info['model'])
@@ -138,7 +138,7 @@ def test_all(self):
self.assertEqual('2.8000 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.8000 GHz', info['hz_actual_friendly'])
self.assertEqual((2800000000, 0), info['hz_advertised'])
self.assertEqual((2800000000, 0), info['hz_actual_raw'])
self.assertEqual((2800000000, 0), info['hz_actual'])
self.assertEqual('X86_64', info['arch'])
self.assertEqual(64, info['bits'])
self.assertEqual(1, info['count'])
@@ -84,7 +84,7 @@ def test_get_cpu_info_from_sysinfo(self):
self.assertEqual('2.9300 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.9300 GHz', info['hz_actual_friendly'])
self.assertEqual((2930000000, 0), info['hz_advertised'])
self.assertEqual((2930000000, 0), info['hz_actual_raw'])
self.assertEqual((2930000000, 0), info['hz_actual'])

self.assertEqual(5, info['stepping'])
self.assertEqual(30, info['model'])
@@ -104,7 +104,7 @@ def test_all(self):
self.assertEqual('2.9300 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.9300 GHz', info['hz_actual_friendly'])
self.assertEqual((2930000000, 0), info['hz_advertised'])
self.assertEqual((2930000000, 0), info['hz_actual_raw'])
self.assertEqual((2930000000, 0), info['hz_actual'])
self.assertEqual('X86_32', info['arch'])
self.assertEqual(32, info['bits'])
self.assertEqual(4, info['count'])
@@ -84,7 +84,7 @@ def test_get_cpu_info_from_sysinfo(self):
self.assertEqual('2.9330 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.9330 GHz', info['hz_actual_friendly'])
self.assertEqual((2933000000, 0), info['hz_advertised'])
self.assertEqual((2933000000, 0), info['hz_actual_raw'])
self.assertEqual((2933000000, 0), info['hz_actual'])

self.assertEqual(5, info['stepping'])
self.assertEqual(30, info['model'])
@@ -105,7 +105,7 @@ def test_all(self):
self.assertEqual('2.9330 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.9330 GHz', info['hz_actual_friendly'])
self.assertEqual((2933000000, 0), info['hz_advertised'])
self.assertEqual((2933000000, 0), info['hz_actual_raw'])
self.assertEqual((2933000000, 0), info['hz_actual'])
self.assertEqual('X86_32', info['arch'])
self.assertEqual(32, info['bits'])
self.assertEqual(4, info['count'])
@@ -82,7 +82,7 @@ def test_get_cpu_info_from_sysinfo(self):
self.assertEqual('3.6930 GHz', info['hz_advertised_friendly'])
self.assertEqual('3.6930 GHz', info['hz_actual_friendly'])
self.assertEqual((3693000000, 0), info['hz_advertised'])
self.assertEqual((3693000000, 0), info['hz_actual_raw'])
self.assertEqual((3693000000, 0), info['hz_actual'])

self.assertEqual(2, info['stepping'])
self.assertEqual(8, info['model'])
@@ -105,7 +105,7 @@ def test_all(self):
self.assertEqual('3.6930 GHz', info['hz_advertised_friendly'])
self.assertEqual('3.6930 GHz', info['hz_actual_friendly'])
self.assertEqual((3693000000, 0), info['hz_advertised'])
self.assertEqual((3693000000, 0), info['hz_actual_raw'])
self.assertEqual((3693000000, 0), info['hz_actual'])
self.assertEqual('X86_32', info['arch'])
self.assertEqual(32, info['bits'])
self.assertEqual(2, info['count'])
@@ -159,7 +159,7 @@ def test_all(self):
self.assertEqual('FIXME', info['hz_advertised_friendly'])
self.assertEqual('FIXME', info['hz_actual_friendly'])
self.assertEqual((1000000000, 0), info['hz_advertised'])
self.assertEqual((1000000000, 0), info['hz_actual_raw'])
self.assertEqual((1000000000, 0), info['hz_actual'])
self.assertEqual('ARM_8', info['arch'])
self.assertEqual(64, info['bits'])
self.assertEqual(6, info['count'])
@@ -96,7 +96,7 @@ def test_get_cpu_info_from_cpufreq_info(self):
self.assertEqual('1.0000 GHz', info['hz_advertised_friendly'])
self.assertEqual('1.0000 GHz', info['hz_actual_friendly'])
self.assertEqual((1000000000, 0), info['hz_advertised'])
self.assertEqual((1000000000, 0), info['hz_actual_raw'])
self.assertEqual((1000000000, 0), info['hz_actual'])

def test_get_cpu_info_from_proc_cpuinfo(self):
info = cpuinfo._get_cpu_info_from_proc_cpuinfo()
@@ -118,7 +118,7 @@ def test_all(self):
self.assertEqual('1.0000 GHz', info['hz_advertised_friendly'])
self.assertEqual('1.0000 GHz', info['hz_actual_friendly'])
self.assertEqual((1000000000, 0), info['hz_advertised'])
self.assertEqual((1000000000, 0), info['hz_actual_raw'])
self.assertEqual((1000000000, 0), info['hz_actual'])
self.assertEqual('ARM_7', info['arch'])
self.assertEqual(32, info['bits'])
self.assertEqual(1, info['count'])
@@ -472,7 +472,7 @@ def test_get_cpu_info_from_lscpu(self):
self.assertEqual('2.7937 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.7937 GHz', info['hz_actual_friendly'])
self.assertEqual((2793652000, 0), info['hz_advertised'])
self.assertEqual((2793652000, 0), info['hz_actual_raw'])
self.assertEqual((2793652000, 0), info['hz_actual'])

self.assertEqual(7, info['stepping'])
self.assertEqual(42, info['model'])
@@ -491,7 +491,7 @@ def test_get_cpu_info_from_dmesg(self):
self.assertEqual('2.8000 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.8000 GHz', info['hz_actual_friendly'])
self.assertEqual((2800000000, 0), info['hz_advertised'])
self.assertEqual((2800000000, 0), info['hz_actual_raw'])
self.assertEqual((2800000000, 0), info['hz_actual'])

self.assertEqual(7, info['stepping'])
self.assertEqual(42, info['model'])
@@ -505,7 +505,7 @@ def test_get_cpu_info_from_proc_cpuinfo(self):
self.assertEqual('2.8000 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.7937 GHz', info['hz_actual_friendly'])
self.assertEqual((2800000000, 0), info['hz_advertised'])
self.assertEqual((2793652000, 0), info['hz_actual_raw'])
self.assertEqual((2793652000, 0), info['hz_actual'])

self.assertEqual('3072 KB', info['l3_cache_size'])

@@ -531,7 +531,7 @@ def test_all(self):
self.assertEqual('2.8000 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.7937 GHz', info['hz_actual_friendly'])
self.assertEqual((2800000000, 0), info['hz_advertised'])
self.assertEqual((2793652000, 0), info['hz_actual_raw'])
self.assertEqual((2793652000, 0), info['hz_actual'])
self.assertEqual('X86_64', info['arch'])
self.assertEqual(64, info['bits'])
self.assertEqual(2, info['count'])
@@ -454,7 +454,7 @@ def test_get_cpu_info_from_proc_cpuinfo(self):
self.assertEqual('1.0000 GHz', info['hz_advertised_friendly'])
self.assertEqual('1.0000 GHz', info['hz_actual_friendly'])
self.assertEqual((1000000000, 0), info['hz_advertised'])
self.assertEqual((1000000000, 0), info['hz_actual_raw'])
self.assertEqual((1000000000, 0), info['hz_actual'])

def test_all(self):
info = cpuinfo._get_cpu_info_internal()
@@ -463,7 +463,7 @@ def test_all(self):
self.assertEqual('1.0000 GHz', info['hz_advertised_friendly'])
self.assertEqual('1.0000 GHz', info['hz_actual_friendly'])
self.assertEqual((1000000000, 0), info['hz_advertised'])
self.assertEqual((1000000000, 0), info['hz_actual_raw'])
self.assertEqual((1000000000, 0), info['hz_actual'])
self.assertEqual('PPC_64', info['arch'])
self.assertEqual(64, info['bits'])
self.assertEqual(2, info['count'])
@@ -86,7 +86,7 @@ def test_get_cpu_info_from_proc_cpuinfo(self):
self.assertEqual('2.9300 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.9283 GHz', info['hz_actual_friendly'])
self.assertEqual((2930000000, 0), info['hz_advertised'])
self.assertEqual((2928283000, 0), info['hz_actual_raw'])
self.assertEqual((2928283000, 0), info['hz_actual'])

self.assertEqual('6144 KB', info['l3_cache_size'])

@@ -110,7 +110,7 @@ def test_all(self):
self.assertEqual('2.9300 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.9283 GHz', info['hz_actual_friendly'])
self.assertEqual((2930000000, 0), info['hz_advertised'])
self.assertEqual((2928283000, 0), info['hz_actual_raw'])
self.assertEqual((2928283000, 0), info['hz_actual'])
self.assertEqual('X86_64', info['arch'])
self.assertEqual(64, info['bits'])
self.assertEqual(1, info['count'])
@@ -389,7 +389,7 @@ def test_get_cpu_info_from_proc_cpuinfo(self):
self.assertEqual('3.4250 GHz', info['hz_advertised_friendly'])
self.assertEqual('3.4250 GHz', info['hz_actual_friendly'])
self.assertEqual((3425000000, 0), info['hz_advertised'])
self.assertEqual((3425000000, 0), info['hz_actual_raw'])
self.assertEqual((3425000000, 0), info['hz_actual'])

def test_all(self):
info = cpuinfo._get_cpu_info_internal()
@@ -398,7 +398,7 @@ def test_all(self):
self.assertEqual('3.4250 GHz', info['hz_advertised_friendly'])
self.assertEqual('3.4250 GHz', info['hz_actual_friendly'])
self.assertEqual((3425000000, 0), info['hz_advertised'])
self.assertEqual((3425000000, 0), info['hz_actual_raw'])
self.assertEqual((3425000000, 0), info['hz_actual'])
self.assertEqual('PPC_64', info['arch'])
self.assertEqual(64, info['bits'])
self.assertEqual(2, info['count'])
@@ -472,7 +472,7 @@ def test_get_cpu_info_from_lscpu(self):
self.assertEqual('2.7937 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.7937 GHz', info['hz_actual_friendly'])
self.assertEqual((2793652000, 0), info['hz_advertised'])
self.assertEqual((2793652000, 0), info['hz_actual_raw'])
self.assertEqual((2793652000, 0), info['hz_actual'])

self.assertEqual(7, info['stepping'])
self.assertEqual(42, info['model'])
@@ -491,7 +491,7 @@ def test_get_cpu_info_from_dmesg(self):
self.assertEqual('2.8000 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.8000 GHz', info['hz_actual_friendly'])
self.assertEqual((2800000000, 0), info['hz_advertised'])
self.assertEqual((2800000000, 0), info['hz_actual_raw'])
self.assertEqual((2800000000, 0), info['hz_actual'])

self.assertEqual(7, info['stepping'])
self.assertEqual(42, info['model'])
@@ -506,7 +506,7 @@ def test_get_cpu_info_from_proc_cpuinfo(self):
self.assertEqual('2.8000 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.7937 GHz', info['hz_actual_friendly'])
self.assertEqual((2800000000, 0), info['hz_advertised'])
self.assertEqual((2793652000, 0), info['hz_actual_raw'])
self.assertEqual((2793652000, 0), info['hz_actual'])

self.assertEqual('3072 KB', info['l3_cache_size'])

@@ -532,7 +532,7 @@ def test_all(self):
self.assertEqual('2.8000 GHz', info['hz_advertised_friendly'])
self.assertEqual('2.7937 GHz', info['hz_actual_friendly'])
self.assertEqual((2800000000, 0), info['hz_advertised'])
self.assertEqual((2793652000, 0), info['hz_actual_raw'])
self.assertEqual((2793652000, 0), info['hz_actual'])
self.assertEqual('X86_64', info['arch'])
self.assertEqual(64, info['bits'])
self.assertEqual(2, info['count'])
@@ -124,7 +124,7 @@ def test_get_cpu_info_from_lscpu(self):
self.assertEqual('3.6931 GHz', info['hz_advertised_friendly'])
self.assertEqual('3.6931 GHz', info['hz_actual_friendly'])
self.assertEqual((3693060000, 0), info['hz_advertised'])
self.assertEqual((3693060000, 0), info['hz_actual_raw'])
self.assertEqual((3693060000, 0), info['hz_actual'])

self.assertEqual(2, info['stepping'])
self.assertEqual(8, info['model'])
@@ -158,7 +158,7 @@ def test_get_cpu_info_from_proc_cpuinfo(self):
self.assertEqual('3.6931 GHz', info['hz_advertised_friendly'])
self.assertEqual('3.6931 GHz', info['hz_actual_friendly'])
self.assertEqual((3693060000, 0), info['hz_advertised'])
self.assertEqual((3693060000, 0), info['hz_actual_raw'])
self.assertEqual((3693060000, 0), info['hz_actual'])

# FIXME: This is l2 cache size not l3 cache size
self.assertEqual('512 KB', info['l3_cache_size'])
@@ -189,7 +189,7 @@ def test_all(self):
self.assertEqual('3.6931 GHz', info['hz_advertised_friendly'])
self.assertEqual('3.6931 GHz', info['hz_actual_friendly'])
self.assertEqual((3693060000, 0), info['hz_advertised'])
self.assertEqual((3693060000, 0), info['hz_actual_raw'])
self.assertEqual((3693060000, 0), info['hz_actual'])
self.assertEqual('X86_64', info['arch'])
self.assertEqual(64, info['bits'])
self.assertEqual(8, info['count'])
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.