def get_cpu_frequency_msg():
cpu_frequency_data_output = []
cpu_frequency_data = {}
cpu_frequency_msg = []
cpu_frequency_data_output = subprocess.check_output("sudo cpupower monitor -m Mperf | grep -Ev 'Mperf|CPU' | awk -F\| '{print $3\" \"$6}'", shell=True).splitlines()
for items in cpu_frequency_data_output:
cpu_frequency_data["name"], cpu_frequency_data["value"] = "cpu"+items.split()[0], int(items.split()[1])
print cpu_frequency_data
cpu_frequency_msg.append(cpu_frequency_data)
print cpu_frequency_msg
return cpu_frequency_msg
sudo cpupower monitor -m Mperf | grep -Ev 'Mperf|CPU' | awk -F\| '{print $3" "$6}'
0 2493
32 2494
1 2496
33 2493
...
{'name': 'cpu0', 'value': 2493}
[{'name': 'cpu0', 'value': 2493}]
{'name': 'cpu32', 'value': 2493}
[{'name': 'cpu32', 'value': 2493}, {'name': 'cpu32', 'value': 2493}]
{'name': 'cpu1', 'value': 2493}
[{'name': 'cpu1', 'value': 2493}, {'name': 'cpu1', 'value': 2493}, {'name': 'cpu1', 'value': 2493}]
{'name': 'cpu33', 'value': 2494}
[{'name': 'cpu33', 'value': 2494}, {'name': 'cpu33', 'value': 2494}, {'name': 'cpu33', 'value': 2494}, {'name': 'cpu33', 'value': 2494}]
...
cpu_frequency_msg.append(dict(cpu_frequency_data))
vcpu_5second_perf_data.append(minute_perf_data[vm][time][vcpu][cpu_index])
def get_cpu_frequency_msg():
cpu_frequency_data_output = []
cpu_frequency_data = {}
cpu_frequency_msg = []
cpu_frequency_data_output = subprocess.check_output("sudo cpupower monitor -m Mperf | grep -Ev 'Mperf|CPU' | awk -F\| '{print $3\" \"$6}'", shell=True).splitlines()
for items in cpu_frequency_data_output:
cpu_frequency_data["name"], cpu_frequency_data["value"] = "cpu"+items.split()[0], int(items.split()[1])
cpu_frequency_msg.append(dict(cpu_frequency_data))
return cpu_frequency_msg