Skip to content

Commit

Permalink
v2.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rafa0128 committed Nov 24, 2023
1 parent d61bb5e commit 3e07c73
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ from solox.public.common import Devices
d = Devices()
pids = d.getPid(deviceId='ca6bd5a5', pkgName='com.bilibili.app.in') # for android

apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in',platform='Android', deviceId='ca6bd5a5',
surfaceview=True, noLog=True, pid=None)
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') 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 @@ -91,8 +90,8 @@ gpu = apm.collectGpu() # % only supports ios
# ************* 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)
# apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in', platform='iOS', deviceId='xxxx', noLog=False, record=False)
apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in',platform='Android', deviceId='ca6bd5a5', surfaceview=True, noLog=False, pid=None, record=False, collect_all=True)
# apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in', platform='iOS', deviceId='xxxx', noLog=False, record=False, collect_all=True)
#record: record android screen
apm.collectAll() # will generate HTML report

Expand Down
7 changes: 3 additions & 4 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ from solox.public.common import Devices
d = Devices()
pids = d.getPid(deviceId='ca6bd5a5', pkgName='com.bilibili.app.in') # for android

apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in',platform='Android', deviceId='ca6bd5a5',
surfaceview=True, noLog=True, pid=None)
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') only supports one device
# surfaceview: False = gfxinfo (开发者 - GPU渲染模式 - adb shell dumpsys gfxinfo)
# noLog : False (保存测试数据到log文件中)
Expand All @@ -91,8 +90,8 @@ gpu = apm.collectGpu() # % 只支持ios
# ************* 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)
# apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in', platform='iOS', deviceId='xxxx', noLog=False, record=False)
apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in',platform='Android', deviceId='ca6bd5a5', surfaceview=True, noLog=False, pid=None, record=False, collect_all=True)
# apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in', platform='iOS', deviceId='xxxx', noLog=False, record=False, collect_all=True)
# record: 是否录制
apm.collectAll() # will generate HTML report

Expand Down
2 changes: 1 addition & 1 deletion solox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

from __future__ import absolute_import

__version__ = '2.8.2'
__version__ = '2.8.3'
15 changes: 14 additions & 1 deletion solox/public/apm.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,14 +447,15 @@ class AppPerformanceMonitor(initPerformanceService):
"""for python api"""

def __init__(self, pkgName=None, platform=Platform.Android, deviceId=None,
surfaceview=True, noLog=True, pid=None, record=False):
surfaceview=True, noLog=True, pid=None, record=False, collect_all=False):
self.pkgName = pkgName
self.deviceId = deviceId
self.platform = platform
self.surfaceview = surfaceview
self.noLog = noLog
self.pid = pid
self.record = record
self.collect_all = collect_all
d.devicesCheck(platform=self.platform, deviceid=self.deviceId, pkgname=self.pkgName)

def collectCpu(self):
Expand All @@ -464,6 +465,8 @@ def collectCpu(self):
appCpuRate, systemCpuRate = _cpu.getCpuRate(noLog=self.noLog)
result = {'appCpuRate': appCpuRate, 'systemCpuRate': systemCpuRate}
logger.info(f'cpu: {result}')
if self.collect_all is False:
break
return result

def collectMemory(self):
Expand All @@ -473,6 +476,8 @@ def collectMemory(self):
total, native, dalvik = _memory.getProcessMem(noLog=self.noLog)
result = {'total': total, 'native': native, 'dalvik': dalvik}
logger.info(f'memory: {result}')
if self.collect_all is False:
break
return result

def collectBattery(self):
Expand All @@ -485,6 +490,8 @@ def collectBattery(self):
else:
result = {'temperature': final[0], 'current': final[1], 'voltage': final[2], 'power': final[3]}
logger.info(f'battery: {result}')
if self.collect_all is False:
break
return result

def collectFlow(self, wifi=True):
Expand All @@ -497,6 +504,8 @@ def collectFlow(self, wifi=True):
upFlow, downFlow = _flow.getNetWorkData(wifi=wifi,noLog=self.noLog)
result = {'send': upFlow, 'recv': downFlow}
logger.info(f'network: {result}')
if self.collect_all is False:
break
return result

def collectFps(self):
Expand All @@ -506,6 +515,8 @@ def collectFps(self):
fps, jank = _fps.getFPS(noLog=self.noLog)
result = {'fps': fps, 'jank': jank}
logger.info(f'fps: {result}')
if self.collect_all is False:
break
return result

def collectGpu(self):
Expand All @@ -517,6 +528,8 @@ def collectGpu(self):
gpu = _gpu.getGPU(noLog=self.noLog)
result = {'gpu': gpu}
logger.info(f'gpu: {result}')
if self.collect_all is False:
break
return result

def setPerfs(self):
Expand Down

0 comments on commit 3e07c73

Please sign in to comment.