def get_cpu_data_silent(package_name, pic_name='cpu'): i = 0 while i < config.collect_data_count: LogUtil.log_i('Inspect cpu') current_page, cpu_data = AndroidUtil.get_cpu_data(package_name) # 当前采集到的数据 if cpu_data >= 50.00: AdbUtil.screenshot(pic_name) else: pass PerformanceControl.cpu_datas.append([current_page, cpu_data]) time.sleep(config.collect_data_interval) # 设定多久采集一次数据 i += 1 LogUtil.log_i('Inspect cpu finish')
def run(self): exec_count = 0 while True: LogUtil.log_i('Inspect cpu') if exec_count > config.collect_data_count: break current_page, cpu_datas = AndroidUtil.get_cpu_data(self.package_name)#当前采集到的数据 if cpu_datas >= 50.00: # 对错误进行处理 AdbUtil.screenshot(self.pic_name) else: pass GetCpuDataThread.cpu_datas.append([current_page, cpu_datas]) # 设定多久采集一次数据 time.sleep(config.collect_data_interval) exec_count += 1 LogUtil.log_i('Inspect cpu finish')
def run(self): i = 0 pkgName = config.test_package_name while i < config.collect_data_count: LogUtil.log_i('Inspect cpu') cpudata = AndroidUtil.get_cpu_data(pkgName) #当前采集到的数据 if cpudata >= 50.00: cpuerror = cpudata self.CPUerror.append(cpuerror) AdbUtil.screenshot() else: pass self.CPUdata.append(cpudata) time.sleep(config.collect_data_interval) #设定多久采集一次数据 i += 1 print "CPUerror:", self.CPUerror, "CPUdata:", self.CPUdata GetCpuDataThread.task_finish = True LogUtil.log_i('Inspect cpu finish')
def get_silent_cpu_data(pic_name='silent_cpu'): exec_count = 0 while True: if exec_count > config.collect_data_count: __pre_silent_cpu_data() __publish_silent_cpu_data() break # if config.run_finish or config.run_silent_state == config.SlientState.FINISH: # break LogUtil.log_i('silent Inspect cpu') current_page, cpu_data = AndroidUtil.get_cpu_data( package_name) # 当前采集到的数据 if cpu_data >= 50.00: AdbUtil.screenshot(pic_name) else: pass cpu_datas_silent.append([current_page, cpu_data]) time.sleep(config.collect_data_interval) # 设定多久采集一次数据 exec_count += 1 LogUtil.log_i('silent Inspect cpu finish')