smart-test-ti / SoloX

💯SoloX - Real-time collection tool for Android/iOS performance data.(Android性能测试android performance\iOS性能测试ios performance\移动端性能测试mobile performance\APP性能测试app performance\app性能测试工具)
https://smart-test-ti.github.io/solox
MIT License
955 stars 168 forks source link
android-performance battery cpu fps ios-performance jank memory network performance-testing

English | 中文 | FAQ | 使用文档

SoloX

solox preview

🔎Preview

SoloX - Real-time collection tool for Android/iOS performance data.

Quickly locate and analyze performance issues to improve application performance and quality. No need for ROOT/jailbreak, plug and play. 10 161 9 178_50003__platform=Android lan=en (1)

📦Requirements

💡 If Windows users need to test ios, install and start Itunes. Documentation (Not support iOS17)

📥Installation

default

pip install -U solox    (pip install solox==version)

mirrors

pip install -i  https://mirrors.ustc.edu.cn/pypi/web/simple -U solox

💡 If your network is unable to download through [pip install -U solox], please try using mirrors to download, but the download of SoloX may not be the latest version.

🚀Quickstart

default

python -m solox

customize

python -m solox --host=ip --port=port

🏴󠁣󠁩󠁣󠁭󠁿Python API

# 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}',...]

apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in',platform='Android', deviceId='ca6bd5a5', surfaceview=True, 
                            noLog=False, pid=None, record=False, collect_all=False, duration=0)
# apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in', platform='iOS') only supports one device
# surfaceview: False = gfxinfo (Developer - GPU rendering mode - adb shell dumpsys gfxinfo)
# noLog : False (Save test data to log file)

# ************* Collect a performance parameter ************* #
cpu = apm.collectCpu() # %
memory = apm.collectMemory() # MB
memory_detail = apm.collectMemoryDetail() # 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() # %
disk = apm.collectDisk()
thermal = apm.collectThermal()
# ************* Collect all performance parameter ************* #

if __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: running time (second)
  #record: record android screen
  apm.collectAll(report_path=None) # report_path='/test/report.html'

# in other python file
from solox.public.apm import initPerformanceService  

initPerformanceService.stop() # stop solox

🏴󠁣󠁩󠁣󠁭󠁿Service API

Start the service in the background

# solox version >= 2.1.5

macOS/Linux: nohup python3 -m solox &
Windows: start /min python3 -m solox &

Request performance data from api

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','memory_detail','network','fps','battery','gpu']

🔥Features

Develop

debug


example
from solox.view.apis import api  
change to 
from view.apis import api
cd solox
python debug.py

Browser

Chrome

Terminal

💕Thanks