# SoloX **Repository Path**: FunXiaoYuZhou/SoloX ## Basic Information - **Project Name**: SoloX - **Description**: 移动终端性能监测工具,web版本,依赖python3.10 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2023-12-12 - **Last Updated**: 2024-04-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

中文 | English | FAQ

SoloX

solox preview

## 🔎简介 SoloX - Android/iOS性能数据的实时采集工具。 我们致力于解决低效、繁琐的测试执行问题,我们的目标是在【Simple Test In SoloX】 ![preview](https://github.com/smart-test-ti/SoloX/assets/24454096/79964f92-de3a-435f-b6ab-3d39ac8da425) ## 📦环境 - 安装 Python 3.10 + [**Download**](https://www.python.org/downloads/) - 安装 adb和配置好环境变量 (SoloX自带的adb不一定适配你的电脑,建议自己安装) [**Download**](https://developer.android.com/studio/releases/platform-tools) 💡 Python 3.6 ~ 3.9 , 请安装solox版本低于2.5.4. 💡 如果Windows用户需要测试iOS,请先安装Itunes. [**参考**](https://github.com/alibaba/taobao-iphone-device) ## 📥安装 ### 默认 ```shell pip install -U solox (指定版本:pip install solox==版本) ``` ### 镜像 ```shell pip install -i https://mirrors.ustc.edu.cn/pypi/web/simple -U solox ``` 💡 如果你的网络无法通过 [pip install -U solox] 下载, 可以尝试使用镜像下载,但是可能不是最新版本. ## 🚀启动 ### 默认 ```shell python -m solox ``` ### 自定义 ```shell python -m solox --host={ip} --port={port} ``` ## 🏴󠁣󠁩󠁣󠁭󠁿使用python收集 ```python # solox version : >= 2.8.5 from solox.public.apm import AppPerformanceMonitor from solox.public.common import Devices d = Devices() processList = d.getPid(deviceId='ca6bd5a5', pkgName='com.bilibili.app.in') # for android print(processList) # ['{pid}:{packagename}',...],一个app可能会有多个进程,如果需要指定pid,可以从这里获取 apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in',platform='Android', deviceId='ca6bd5a5', surfaceview=True, noLog=False, pid=None, record=False, collect_all=False) # apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in', platform='iOS') # surfaceview: 为False时是使用gfxinfo方式,需要在手机上设置:(手机开发者 - GPU渲染模式 - adb shell dumpsys gfxinfo) # noLog : False (保存测试数据到log文件中) # ************* 收集单个性能参数 ************* # cpu = apm.collectCpu() # % memory = apm.collectMemory() # MB network = apm.collectNetwork(wifi=True) # KB fps = apm.collectFps() # HZ battery = apm.collectBattery() # level:% temperature:°C current:mA voltage:mV power:w gpu = apm.collectGpu() # % 只支持ios # ************* 收集所有性能参数 ************* # if __name__ == '__main__': #必须要在__name__ == '__main__'里面执行 apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in',platform='Android', deviceId='ca6bd5a5', surfaceview=True, noLog=False, pid=None, record=False, collect_all=True, duration=0) # apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in', platform='iOS', deviceId='xxxx', noLog=False, record=False, collect_all=True, duration=0) #duration: 执行时长(秒),只有>0的时候才生效 #record: 是否录制 apm.collectAll() # 结束会生成测试报告 # 在另外的python脚本中可以主动终止solox服务,无需等待设置的执行时长结束 from solox.public.apm import initPerformanceService initPerformanceService.stop() ``` ## 🏴󠁣󠁩󠁣󠁭󠁿使用API收集 ### 后台启动服务 ``` # solox version >= 2.1.5 macOS/Linux: nohup python3 -m solox & Windows: start /min python3 -m solox & ``` ### 通过api请求数据 ```shell Android: http://{ip}:{port}/apm/collect?platform=Android&deviceid=ca6bd5a5&pkgname=com.bilibili.app.in&target=cpu iOS: http://{ip}:{port}/apm/collect?platform=iOS&pkgname=com.bilibili.app.in&target=cpu target in ['cpu','memory','network','fps','battery','gpu'] ``` ## 🔥功能 * **无需ROOT/越狱:** Android设备无需ROOT,iOS设备无需越狱。高效解决Android & iOS性能测试分析难题。 * **数据完整性:** 可提供FPS、Jank、CPU、GPU、Memory、Battery 、Network等性能参数,这些您都可以轻松获得。 * **美观的报告看板:** 报告看板,您可以随时随地存储、可视化、编辑、管理和下载使用任何版本的SoloX收集的所有测试数据。 * **好用的监控设置:** 支持在监控过程中设置告警值、收集时长、访问其他PC机器的移动设备。 * **比对模式:** 支持两台移动设备同时对比测试。 - 🌱2-devices: 使用两台不同的设备测试同一个app。 - 🌱2-apps: 使用两台配置相同的设备测试两个不同的app。 * **API收集性能数据:** 支持python、API收集性能数据,帮助用户轻松集成在CI/CD流程。 ## 浏览器 Chrome ## 终端 - windows: PowerShell - macOS:iTerm2 (https://iterm2.com/) ## 💕感谢 - https://github.com/alibaba/taobao-iphone-device - https://github.com/Genymobile/scrcpy