def auto_collect_data_process(): try: # 获取测试应用的包名和版本号,存到数据库中 version_code = AdbUtil.get_verson(package_name) common_data_list.append([package_name, version_code, '']) __save_package_version() # 创建进程池来执行进程 # result = None pool = multiprocessing.Pool(processes=6) # result = pool.apply_async(run_monkey, (config.test_package_name(), RUN_MONKEY_COUNT,)) result = None for i in range(len(METHOD_ARRAY)): result = pool.apply_async(get_data, (METHOD_ARRAY[i], )) pool.close() pool.join() if result.successful(): LogUtil.log_i('excute success') LogUtil.log_i('All process worked!!') except Exception as e: LogUtil.log_e('collect data failure ' + e.message)
def publish_battery_data(): if len(battery_excel_data) < 1: return version_code = AdbUtil.get_verson(package_name) BatteryData().save_db_data(battery_excel_data, package_name, version_code)
from util.AndroidUtil import AndroidUtil from util.LogUtil import LogUtil from performance.models import * __author__ = 'zhouliwei' """ function: 用于收集数据并进行处理、保存的逻辑 date:2016/11/25 """ # 跑monkey的次数 RUN_MONKEY_COUNT = 150 # 当前测试的包名 package_name = config.test_package_name version_code = AdbUtil.get_verson(package_name) METHOD_ARRAY = ['cpu', 'memory', 'kpi', 'fps', 'flow'] # METHOD_ARRAY = ['cpu', 'memory', 'kpi', 'fps', 'flow', 'monkey'] SILENT_ARRAY = ['cpu', 'flow'] # 用于存放计算之后的值[平均fps, 平均jank_count] fps_data_dict = {} # 用于存放计算之后的cpu值 cpu_data_dict = {} # 用于存放计算之后的kpi值 kpi_data_dict = {} # 用于存放计算之后的memory值