def host_stress_event(self, event): """ Host Stress events :param event: event name """ for itr in range(self.host_iterations): if "cpu_freq_governor" in event: cpu.set_cpufreq_governor() logging.debug("Current governor: %s", cpu.get_cpufreq_governor()) time.sleep(self.event_sleep_time) elif "cpu_idle" in event: idlestate = cpu.get_cpuidle_state() cpu.set_cpuidle_state() time.sleep(self.event_sleep_time) cpu.set_cpuidle_state(setstate=idlestate) time.sleep(self.event_sleep_time) elif "cpuoffline" in event: processor = self.host_cpu_list[random.randint( 0, cpu.online_cpus_count() - 1)] cpu.offline(processor) time.sleep(self.event_sleep_time) cpu.online(processor) else: raise NotImplementedError time.sleep(self.itr_sleep_time)
def host_stress_event(self, event): """ Host Stress events :param event: event name """ for itr in range(self.host_iterations): if "cpu_freq_governor" in event: cpu.set_cpufreq_governor() logging.debug("Current governor: %s", cpu.get_cpufreq_governor()) time.sleep(self.event_sleep_time) elif "cpu_idle" in event: idlestate = cpu.get_cpuidle_state() cpu.set_cpuidle_state() time.sleep(self.event_sleep_time) cpu.set_cpuidle_state(setstate=idlestate) time.sleep(self.event_sleep_time) elif "cpuoffline" in event: processor = self.host_cpu_list[random.randint(0, cpu.online_cpus_count()-1)] cpu.offline(processor) time.sleep(self.event_sleep_time) cpu.online(processor) else: raise NotImplementedError time.sleep(self.itr_sleep_time)