GHz values added
This commit is contained in:
parent
d723ae47e3
commit
f8c803e1cb
@ -16,9 +16,14 @@ class CpuFreq(IntervalModule):
|
||||
def run(self):
|
||||
with open(self.file) as f:
|
||||
mhz_values = [float(line.split(':')[1]) for line in f if line.startswith('cpu MHz')]
|
||||
ghz_values = [value / 1000.0 for value in mhz_values]
|
||||
|
||||
cdict = {"core{}".format(key): str(value) for key, value in enumerate(mhz_values)}
|
||||
cdict['avg'] = str(sum(mhz_values) / len(mhz_values))
|
||||
mhz = {"core{}".format(key): "{0:4.3f}".format(value) for key, value in enumerate(mhz_values)}
|
||||
ghz = {"core{}g".format(key): "{0:1.2f}".format(value) for key, value in enumerate(ghz_values)}
|
||||
cdict = mhz.copy()
|
||||
cdict.update(ghz)
|
||||
cdict['avg'] = "{0:4.3f}".format(sum(mhz_values) / len(mhz_values))
|
||||
cdict['avgg'] = "{0:1.2f}".format(sum(ghz_values) / len(ghz_values), 2)
|
||||
|
||||
self.output = {
|
||||
"full_text": self.format.format(**cdict),
|
||||
|
@ -12,11 +12,16 @@ def cpu_freq_test(tfpath, tformat, expected):
|
||||
|
||||
def test_basic():
|
||||
cases = [
|
||||
('cpufreq01', '1240.382', '1236.828', '1203.007', '1264.859', '1236.269'),
|
||||
('cpufreq01', '1240.382', '1236.828', '1203.007', '1264.859', '1236.269', '1.24', '1.24', '1.20', '1.26', '1.24'),
|
||||
]
|
||||
for path, core0, core1, core2, core3, avg in cases:
|
||||
for path, core0, core1, core2, core3, avg, core0g, core1g, core2g, core3g, avgg in cases:
|
||||
cpu_freq_test(path, "{avg}", avg)
|
||||
cpu_freq_test(path, "{core0}", core0)
|
||||
cpu_freq_test(path, "{core1}", core1)
|
||||
cpu_freq_test(path, "{core2}", core2)
|
||||
cpu_freq_test(path, "{core3}", core3)
|
||||
cpu_freq_test(path, "{core0g}", core0g)
|
||||
cpu_freq_test(path, "{core1g}", core1g)
|
||||
cpu_freq_test(path, "{core2g}", core2g)
|
||||
cpu_freq_test(path, "{core3g}", core3g)
|
||||
cpu_freq_test(path, "{avgg}", avgg)
|
||||
|
Loading…
Reference in New Issue
Block a user