def process(name): data = Workload.aggregate(Workload.locate(name), 'dynamic_power') component_count, step_count = data.shape time = constant.TIME_STEP * np.arange(0, step_count) pp.figure(figsize=(14, 2 * component_count), facecolor='w', edgecolor='k') for i in range(component_count): pp.subplot(component_count, 1, i + 1) pp.plot(time, data[i, :]) pp.xlim([time[0], time[-1]]) pp.ylabel('Power (W)') if i == 0: pp.title(name) pp.xlabel('Time (s)')
def main(names, component_id=1): count = len(names) pp.figure(figsize=(14, 2 * count), facecolor='w', edgecolor='k') for i in range(count): data = Workload.aggregate(Workload.locate(names[i]), 'dynamic_power') step_count = data.shape[1] time = constant.TIME_STEP * np.arange(step_count) pp.subplot(count, 1, i + 1) pp.plot(time, data[component_id, :]) pp.xlim([time[0], time[-1]]) pp.xlabel('Time (s)') pp.ylabel('Power (W)') pp.show()