Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rafa0128 committed Nov 24, 2023
1 parent 9a829ed commit ad48bc0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 21 deletions.
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ python -m solox --host={ip} --port={port}
## 🏴󠁣󠁩󠁣󠁭󠁿Collect in python

```python

from solox.public.apm import APM
# solox version : >= 2.8.1
from solox.public.apm import AppPerformanceMonitor
from solox.public.common import Devices

d = Devices()
pids = d.getPid(deviceId='ca6bd5a5', pkgName='com.bilibili.app.in') # for android

apm = APM(pkgName='com.bilibili.app.in',platform='Android', deviceId='ca6bd5a5',
apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in',platform='Android', deviceId='ca6bd5a5',
surfaceview=True, noLog=True, pid=None)
# apm = APM(pkgName='com.bilibili.app.in', platform='iOS') only supports one device
# 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)

Expand All @@ -89,12 +89,17 @@ battery = apm.collectBattery() # level:% temperature:°C current:mA voltage:mV p
gpu = apm.collectGpu() # % only supports ios

# ************* Collect all performance parameter ************* #
apm = APM(pkgName='com.bilibili.app.in',platform='Android', deviceId='ca6bd5a5',
surfaceview=True, noLog=False, pid=None, duration=20, record=False)
# duration : second record: record android screen
# apm = APM(pkgName='com.bilibili.app.in', platform='iOS', deviceId='xxxx', noLog=False, duration=20, record=False)

if __name__ == '__main__':
apm.collectAll() # will generate HTML report
apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in',platform='Android', deviceId='ca6bd5a5', surfaceview=True, noLog=False, pid=None, record=False)
# apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in', platform='iOS', deviceId='xxxx', noLog=False, record=False)
# duration : second record: record android screen
apm.collectAll() # will generate HTML report

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

initPerformanceService.stop() # stop solox
```

## 🏴󠁣󠁩󠁣󠁭󠁿Collect in API
Expand Down
31 changes: 19 additions & 12 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,32 +67,39 @@ python -m solox --host={ip} --port={port}

```python

from solox.public.apm import APM
# solox version : >= 2.8.1
from solox.public.apm import AppPerformanceMonitor
from solox.public.common import Devices

d = Devices()
pids = d.getPid(deviceId='ca6bd5a5', pkgName='com.bilibili.app.in') # for android

apm = APM(pkgName='com.bilibili.app.in',platform='Android', deviceId='ca6bd5a5',
apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in',platform='Android', deviceId='ca6bd5a5',
surfaceview=True, noLog=True, pid=None)
# apm = APM(pkgName='com.bilibili.app.in', platform='iOS') only supports one device
# surfaceview: False = gfxinfo (手机开发者 - GPU渲染模式 - adb shell dumpsys gfxinfo)
# noLog : False (为false时才会存储测试数据到log文件中)
# apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in', platform='iOS') only supports one device
# surfaceview: False = gfxinfo (开发者 - GPU渲染模式 - adb shell dumpsys gfxinfo)
# noLog : False (保存测试数据到log文件中)

# ************* 收集单个性能指标 ************* #
# ************* Collect a performance parameter ************* #
cpu = apm.collectCpu() # %
memory = apm.collectMemory() # MB
flow = apm.collectFlow(wifi=True) # KB
fps = apm.collectFps() # HZ
battery = apm.collectBattery() # level:% temperature:°C current:mA voltage:mV power:w
gpu = apm.collectGpu() # % only supports ios
gpu = apm.collectGpu() # % 只支持ios

# ************* 收集全部的性能指标 ************* #
apm = APM(pkgName='com.bilibili.app.i',platform='Android', deviceId='ca6bd5a5',
surfaceview=True, noLog=False, pid=None, duration=20, record=False) # duration : 秒 (持续执行时间) record: 是否录屏(只支持安卓)
# apm = APM(pkgName='com.bilibili.app.in.ios', platform='iOS', deviceId='xxxx',noLog=False, duration=20)
# ************* Collect all performance parameter ************* #

if __name__ == '__main__':
apm.collectAll() # 会生成HTML报告
apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in',platform='Android', deviceId='ca6bd5a5', surfaceview=True, noLog=False, pid=None, record=False)
# apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in', platform='iOS', deviceId='xxxx', noLog=False, record=False)
# duration : 持续执行时间(秒) record: 是否录制
apm.collectAll() # will generate HTML report

# 在另外的python脚本中终止solox服务可以停止测试
from solox.public.apm import initPerformanceService

initPerformanceService.stop() # stop solox
```

## 🏴󠁣󠁩󠁣󠁭󠁿使用API收集
Expand Down

0 comments on commit ad48bc0

Please sign in to comment.