示例#1
0
 def test_pqos_flatten_mon_data_multiple(self):
     """
         Test for Pqos.flatten_mon_data when multiple monitoring data are received
     """
     flatten_mon_data_multiple = {
         "ipc_cpus0,1,2": 0.987,
         "llc_misses_cpus0,1,2": 10240,
         "llc_avg_cpus0,1,2": 25028,
         "llc_max_cpus0,1,2": 30000,
         "mbm_local_avg_cpus0,1,2": 25028,
         "mbm_local_max_cpus0,1,2": 30000,
         "ipc_cpus3,4,5": 0.987,
         "llc_misses_cpus3,4,5": 10240,
         "llc_avg_cpus3,4,5": 25028,
         "llc_max_cpus3,4,5": 30000,
         "mbm_local_avg_cpus3,4,5": 25028,
         "mbm_local_max_cpus3,4,5": 30000,
     }
     mon_data = copy.deepcopy(
         mock_pqos_wrapper_output["monitor_events"]["function_output"][
             "monitoring_data"
         ]
     )
     first_core_set = copy.deepcopy(mon_data[0])
     second_core_set = copy.deepcopy(mon_data[0])
     second_core_set["cores"] = [3, 4, 5]
     mon_data_multiple = [first_core_set, second_core_set]
     ret = Pqos.flatten_mon_data(mon_data_multiple)
     self.assertDictEqual(ret, flatten_mon_data_multiple)
 def test_pqos_flatten_mon_data(self):
     """
     Test for Pqos.flatten_mon_data when single monitoring data is received
     """
     flatten_mon_data = {
         "ipc": 0.987,
         "llc_misses": 10240,
         "llc_avg": 25028,
         "llc_max": 30000,
         "mbm_local_avg": 25028,
         "mbm_local_max": 30000,
     }
     mon_data = copy.deepcopy(mock_pqos_wrapper_output["monitor_events"]
                              ["function_output"]["monitoring_data"])
     ret = Pqos.flatten_mon_data(mon_data)
     self.assertDictEqual(ret, flatten_mon_data)