From e0cd3010335299d5e707e75651346c6fdc5ac1ad Mon Sep 17 00:00:00 2001 From: chenhq Date: Thu, 30 May 2024 11:42:36 +0800 Subject: [PATCH] fix #280 --- README.md | 2 +- README.zh.md | 7 +- setup.cfg | 6 +- solox/__init__.py | 2 +- solox/__main__.py | 6 +- solox/public/apm.py | 49 +++++++--- solox/public/common.py | 1 + solox/public/report_template/android.html | 8 +- solox/public/report_template/ios.html | 8 +- solox/templates/analysis.html | 6 +- solox/templates/base.html | 9 +- solox/templates/index.html | 111 +++++++++++++++++++--- solox/templates/pk.html | 22 ++--- solox/view/apis.py | 19 +++- 14 files changed, 195 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index 172b490..10460bd 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

-SoloX +SoloX

diff --git a/README.zh.md b/README.zh.md index 7f62868..bae109d 100644 --- a/README.zh.md +++ b/README.zh.md @@ -4,7 +4,7 @@

-SoloX +SoloX

@@ -62,8 +62,7 @@ python -m solox --host={ip} --port={port} ## 🏴󠁣󠁩󠁣󠁭󠁿使用python收集 ```python -an -# solox version : >= 2.8.5 +# solox version : >= 2.9.0 from solox.public.apm import AppPerformanceMonitor from solox.public.common import Devices @@ -81,7 +80,7 @@ apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in',platform='Android', de cpu = apm.collectCpu() # % memory = apm.collectMemory() # MB memory_detail = apm.collectMemoryDetail() # MB -network = apm.collectNetwork(wifi=True) # KB , wifi=False时是收集移动网络,手机要切换数据流量 +network = apm.collectNetwork(wifi=True) # KB , wifi=False时是收集移动数据流量,手机会自动关闭wifi切换到移动网络 fps = apm.collectFps() # HZ battery = apm.collectBattery() # level:% temperature:°C current:mA voltage:mV power:w gpu = apm.collectGpu() # % 安卓只支持高通芯片的手机 diff --git a/setup.cfg b/setup.cfg index bcfeb0b..4da765a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ name = solox author = Rafa Chen author_email = rafacheninc@gamil.com -summary = tool for apm +summary = tool for app performance license = MIT home_page = https://github.com/smart-test-ti/SoloX description_file = README.md @@ -12,6 +12,10 @@ classifier = Operating System :: OS Independent Programming Language :: Python :: 3 +[files] +packages = + solox + [entry_points] console_scripts = solox = solox.__main__:main \ No newline at end of file diff --git a/solox/__init__.py b/solox/__init__.py index e73a11a..ddbfd7c 100644 --- a/solox/__init__.py +++ b/solox/__init__.py @@ -2,4 +2,4 @@ from __future__ import absolute_import -__version__ = '2.9.0' +__version__ = '2.9.1' diff --git a/solox/__main__.py b/solox/__main__.py index 1a008c2..e15670d 100644 --- a/solox/__main__.py +++ b/solox/__main__.py @@ -2,6 +2,8 @@ from logzero import logger import platform import fire as fire +# import argparse +from solox import __version__ def checkPyVer(): versions = platform.python_version().split('.') @@ -12,7 +14,9 @@ def checkPyVer(): return True if __name__ == '__main__': + # ap = argparse.ArgumentParser( + # formatter_class=argparse.ArgumentDefaultsHelpFormatter) check = checkPyVer() if check: from solox.web import main - fire.Fire(main) + fire.Fire(main) \ No newline at end of file diff --git a/solox/public/apm.py b/solox/public/apm.py index bb30f0d..b58d781 100644 --- a/solox/public/apm.py +++ b/solox/public/apm.py @@ -59,31 +59,56 @@ def getTotalCpuStat(self): for i in range(1, 8): totalCpu += float(toks[i]) return float(totalCpu) - - def getSysCpuStat(self): - """get the total cpu usage at a certain time""" + + def getCpuCoreStat(self): + """get the core cpu usage at a certain time""" cmd = 'cat /proc/stat |{} ^cpu'.format(d.filterType()) result = adb.shell(cmd=cmd, deviceId=self.deviceId) - r = re.compile(r'(? APP - +
Platform - +
Device - +
CTime - +
diff --git a/solox/public/report_template/ios.html b/solox/public/report_template/ios.html index 5dc63ed..388a7b3 100644 --- a/solox/public/report_template/ios.html +++ b/solox/public/report_template/ios.html @@ -23,25 +23,25 @@ APP - +
Platform - +
Device - +
CTime - +
diff --git a/solox/templates/analysis.html b/solox/templates/analysis.html index 9ab0f2a..2a2d2b7 100644 --- a/solox/templates/analysis.html +++ b/solox/templates/analysis.html @@ -543,7 +543,7 @@ {% if apm_data.disk_flag == True %}
-
{% if lan == 'cn' %} 磁盘使用 (MB) {% else %} Disk Usage (KB) {% endif %}
+
{% if lan == 'cn' %} 磁盘 (KB) {% else %} Disk Usage (KB) {% endif %}
{% endif %}
- +{% if platform == 'Android'%}
@@ -700,7 +700,7 @@

- +{% endif %}
@@ -385,6 +389,7 @@

netdataRecvWarning:parseInt($('#down_warning_value').val()), netdataSendWarning:parseInt($('#upflow_warning_value').val()), betteryWarning:parseInt($('#battery_warning_value').val()), + gpuWarning:parseInt($('#gpu_warning_value').val()), duration:parseInt($('#duration').val()), solox_host: $('#host').val(), host_switch:host_switch diff --git a/solox/templates/index.html b/solox/templates/index.html index 481f947..7288ac1 100644 --- a/solox/templates/index.html +++ b/solox/templates/index.html @@ -160,7 +160,7 @@

@@ -102,14 +102,14 @@ @@ -139,10 +139,10 @@