diff --git a/README.md b/README.md index a92fded..1f777bd 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ gpu = apm.collectGpu() # % only supports ios 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) - # duration : second record: record android screen + #record: record android screen apm.collectAll() # will generate HTML report # in other python file diff --git a/README.zh.md b/README.zh.md index 6fbdf7d..d486fc9 100644 --- a/README.zh.md +++ b/README.zh.md @@ -93,7 +93,7 @@ gpu = apm.collectGpu() # % 只支持ios 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) - # duration : 持续执行时间(秒) record: 是否录制 + # record: 是否录制 apm.collectAll() # will generate HTML report # 在另外的python脚本中终止solox服务可以停止测试 diff --git a/solox/__init__.py b/solox/__init__.py index 88decb3..811164d 100644 --- a/solox/__init__.py +++ b/solox/__init__.py @@ -2,4 +2,4 @@ from __future__ import absolute_import -__version__ = '2.8.1' +__version__ = '2.8.2' diff --git a/solox/public/apm.py b/solox/public/apm.py index 2bbb970..8701c60 100644 --- a/solox/public/apm.py +++ b/solox/public/apm.py @@ -439,7 +439,9 @@ def stop(cls): config_json = json.loads(open(file=cls.CONIFG_PATH, mode='r').read()) config_json['run_switch'] = 'off' with open(cls.CONIFG_PATH, "w") as file: - json.dump(config_json, file) + json.dump(config_json, file) + logger.info('stop solox success') + return True class AppPerformanceMonitor(initPerformanceService): """for python api""" @@ -462,8 +464,6 @@ def collectCpu(self): appCpuRate, systemCpuRate = _cpu.getCpuRate(noLog=self.noLog) result = {'appCpuRate': appCpuRate, 'systemCpuRate': systemCpuRate} logger.info(f'cpu: {result}') - if time.time() > self.end_time: - break return result def collectMemory(self): @@ -598,10 +598,4 @@ def collectAll(self): Scrcpy.stop_record() logger.exception(e) finally: - logger.info('End of testing') - - -if __name__ == '__main__': - apm = AppPerformanceMonitor(pkgName='com.tencent.qqmusic',platform='Android', deviceId='BRNUT21B15044184', - surfaceview=True, noLog=False, pid=None, record=False) - apm.collectAll() \ No newline at end of file + logger.info('End of testing') \ No newline at end of file