收集内存 def get_app_memory_usage(device_id,package_name): command = f"adb -s {device_id} shell dumpsys meminfo {package_name}" output = subprocess.check_output(command, shell=True).decode() # 在输出中找到指定包名应用的内存使用情况 start_index = output.find("TOTAL") end_index = output.find("Objects") if start_index != -1 and end_index != -1: memory_usage = output[start_index:end_index].strip() return memory_usage # return int(memory_usage.split("TOTAL:")[1].split("TOTAL SWAP PSS")[0].strip()) else: return 0 def writeFile(file_path, file): localtime = time.strftime("%Y%m%d%H%M%S", time.localtime()) if not os.path.exists(file_path): os.makedirs(file_path) with open(file_path+'.txt', 'a') as f: f.write(str(file)+"\n") 内存曲线 impo