Skip to content

Commit

Permalink
v2.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rafa0128 committed Sep 9, 2024
1 parent 2751e56 commit 0c8970f
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 119 deletions.
8 changes: 5 additions & 3 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@

## 5️⃣ 为什么Android的FPS经常会为0 ?

* 支持SurfaceView和gfxinfo(界面关闭surfaceview开关切换)两种方式,可以都切换尝试是否收集到数据;如果使用gpfinfo方式需要到手机设置:开发者 - GPU渲染模式 - adb shell dumpsys gfxinfo。
* 支持SurfaceView和gfxinfo(界面关闭surfaceview开关切换)两种方式,可以都切换尝试是否收集到数据;如果使用gfxinfo方式需要到手机设置:开发者 - GPU渲染模式 - adb shell dumpsys gfxinfo。
* 界面相对静止的fps预期就是0,请检查页面是否滑动和动态。
* 游戏类的APP大部分机器不支持,多使用华为的机器。

## 6️⃣ 为什么"python -m solox"会运行失败 ?

Expand Down Expand Up @@ -89,10 +90,11 @@
* 插拔usb重新连接,多次尝试。
* 更换设备,tidevice还是有一定的兼容性。
* 检查tidevice的版本,不能自己安装最新版本,只能用solox自带的,因为部分代码二次开发过。
* 如果日志中提示是支持包下载失败,可以自行到(https://github.com/filsv/iOSDeviceSupport)这里下载放到这个路径 ~/.tidevice/device-support/

## 1️⃣7️⃣ 为什么Android不支持收集GPU数据?

因为通过adb的方式访问gpu相关的数据文件,需要root权限才可以
目前只支持部分高通芯片的设备(小米、oppo、vivo多点)

## 1️⃣8️⃣ 如何在收集过程种录制APP的屏幕?

Expand All @@ -110,4 +112,4 @@
## 2️⃣0️⃣ Android/iOS最高支持的系统版本?

- Android: 6.0+
- iOS: 12.0+
- iOS: https://github.com/filsv/iOSDeviceSupport,这个路径有的都支持,因为是外网可能会下载失败,可以自行下载支持包放在本地~/.tidevice/device-support/
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
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)](https://github.com/smart-test-ti/SoloX/assets/24454096/61a0b801-23b4-4711-8215-51cd7bc9dc04)

## 📦Requirements
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.9.2'
__version__ = '2.9.3'
92 changes: 46 additions & 46 deletions solox/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,51 +21,51 @@
app.register_blueprint(api)
app.register_blueprint(page)

socketio = SocketIO(app, cors_allowed_origins="*")
thread = True
thread_lock = Lock()


@socketio.on('connect', namespace='/logcat')
def connect():
socketio.emit('start connect', {'data': 'Connected'}, namespace='/logcat')
logDir = os.path.join(os.getcwd(),'adblog')
if not os.path.exists(logDir):
os.mkdir(logDir)
global thread
thread = True
with thread_lock:
if thread:
thread = socketio.start_background_task(target=backgroundThread)


def backgroundThread():
global thread
try:
# logger.info('Initializing adb environment ...')
# os.system('adb kill-server')
# os.system('adb start-server')
current_time = time.strftime("%Y%m%d%H", time.localtime())
logPath = os.path.join(os.getcwd(),'adblog',f'{current_time}.log')
logcat = subprocess.Popen(f'adb logcat *:E > {logPath}', stdout=subprocess.PIPE,
shell=True)
with open(logPath, "r") as f:
while thread:
socketio.sleep(1)
for line in f.readlines():
socketio.emit('message', {'data': line}, namespace='/logcat')
if logcat.poll() == 0:
thread = False
except Exception:
pass


@socketio.on('disconnect_request', namespace='/logcat')
def disconnect():
global thread
logger.warning('Logcat client disconnected')
thread = False
disconnect()
# socketio = SocketIO(app, cors_allowed_origins="*")
# thread = True
# thread_lock = Lock()


# @socketio.on('connect', namespace='/logcat')
# def connect():
# socketio.emit('start connect', {'data': 'Connected'}, namespace='/logcat')
# logDir = os.path.join(os.getcwd(),'adblog')
# if not os.path.exists(logDir):
# os.mkdir(logDir)
# global thread
# thread = True
# with thread_lock:
# if thread:
# thread = socketio.start_background_task(target=backgroundThread)


# def backgroundThread():
# global thread
# try:
# # logger.info('Initializing adb environment ...')
# # os.system('adb kill-server')
# # os.system('adb start-server')
# current_time = time.strftime("%Y%m%d%H", time.localtime())
# logPath = os.path.join(os.getcwd(),'adblog',f'{current_time}.log')
# logcat = subprocess.Popen(f'adb logcat *:E > {logPath}', stdout=subprocess.PIPE,
# shell=True)
# with open(logPath, "r") as f:
# while thread:
# socketio.sleep(1)
# for line in f.readlines():
# socketio.emit('message', {'data': line}, namespace='/logcat')
# if logcat.poll() == 0:
# thread = False
# except Exception:
# pass


# @socketio.on('disconnect_request', namespace='/logcat')
# def disconnect():
# global thread
# logger.warning('Logcat client disconnected')
# thread = False
# disconnect()

def ip() -> str:
try:
Expand Down Expand Up @@ -103,7 +103,7 @@ def open_url(host: str, port: int):

def start(host: str, port: int):
logger.info('Running on http://{}:{}/?platform=Android&lan=en (Press CTRL+C to quit)'.format(host, port))
socketio.run(app, host=host, debug=True, port=port)
app.run(host=host, port=port, debug=True)

def main(host=ip(), port=50003):
start(host, port)
Expand Down
17 changes: 9 additions & 8 deletions solox/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,11 @@ <h2 class="offcanvas-title" id="offcanvasBottomLabel">Error Log</h2>
</div>
<div class="offcanvas-body">
<div class="btn-list logcat-btn-list">
<a id="run-logcat" class="btn btn-default" onclick="startLogcat()">
<a id="run-logcat" class="btn btn-default">
<svg t="1647757457022" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21859" width="200" height="200"><path d="M511.4 512.1m-448 0a448 448 0 1 0 896 0 448 448 0 1 0-896 0Z" fill="#006DFC" p-id="21860"></path><path d="M658.4 555.6L475.5 661.1c-33.4 19.3-75-4.8-75-43.3V406.6c0-38.5 41.7-62.6 75-43.3l182.9 105.6c33.3 19.3 33.3 67.4 0 86.7z" fill="#FFFFFF" p-id="21861"></path></svg>
{% if lan == 'cn' %} 开始 {% else %} Start {% endif %}
</a>
<a id="stop-logcat" class="btn btn-default" style="display: none" onclick="stopLogcat()">
<a id="stop-logcat" class="btn btn-default" style="display: none">
<svg t="1638096947956" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="235254" width="200" height="200"><path d="M512 512m-512 0a512 512 0 1 0 1024 0 512 512 0 1 0-1024 0Z" fill="#EE827F" p-id="235255"></path><path d="M512 512m-443.191534 0a443.191534 443.191534 0 1 0 886.383068 0 443.191534 443.191534 0 1 0-886.383068 0Z" fill="#E64537" p-id="235256"></path><path d="M0 512C0 794.638448 229.180952 1023.8194 512 1023.8194V0C229.180952 0 0 229.180952 0 512z" fill="#FEFFFF" opacity=".1" p-id="235257"></path><path d="M477.866667 683.208466H375.647266c-1.083598 0-1.986596-0.902998-1.986596-1.986597V342.597531c0-1.083598 0.902998-1.986596 1.986596-1.986596h102.4c1.083598 0 1.986596 0.902998 1.986596 1.986596v338.443739c-0.1806 1.264198-1.083598 2.167196-2.167195 2.167196zM648.352734 683.208466h-102.4c-1.083598 0-1.986596-0.902998-1.986596-1.986597V342.597531c0-1.083598 0.902998-1.986596 1.986596-1.986596H648.352734c1.083598 0 1.986596 0.902998 1.986596 1.986596v338.443739c0 1.264198-0.902998 2.167196-1.986596 2.167196z" fill="#FFFFFF" p-id="235258"></path></svg>
{% if lan == 'cn' %} 停止 {% else %} Stop {% endif %}
</a>
Expand Down Expand Up @@ -567,6 +567,7 @@ <h5 class="modal-title">Add More</h5>
type: "GET",
async: true,
cache: false,
timeout:10000,
beforeSend: function () {
$('.select-device').empty();
$('.select-app').empty();
Expand All @@ -584,7 +585,7 @@ <h5 class="modal-title">Add More</h5>
console.log(data);
if(data['status'] != 1 ) {
if(lan == 'cn' ){
SwalFire('error', '连接失败','请检查当前移动设备的是否连接了PC端', 5000);
SwalFire('error', '连接失败','请检查当前移动设备是否连接了PC端', 5000);
}else{
SwalFire('error', 'Connect failed !', 'No devices found', 5000);
}
Expand Down Expand Up @@ -2257,12 +2258,12 @@ <h5 class="modal-title">Add More</h5>
$('#stop-apm').hide();
}});

var status = false;
var socket
if(platform == 'Android'){
socket = io.connect('http://' + document.domain + ':' + location.port + '/logcat',{'forceNew':true });
// var status = false;
// var socket
// if(platform == 'Android'){
// socket = io.connect('http://' + document.domain + ':' + location.port + '/logcat',{'forceNew':true });

}
// }
function startLogcat() {
let device = $('.select-device').val();
if(device){
Expand Down
16 changes: 8 additions & 8 deletions solox/templates/pk.html
Original file line number Diff line number Diff line change
Expand Up @@ -545,25 +545,25 @@ <h6 class="dropdown-header">{% if lan == 'cn' %} 性能指标 {% else %} APM Tar

function cpuInitialize(){
//初始化cpu
let cpu_chart = chartsInitialize('cpu','CPU(%)');
let cpu_chart = chartsInitialize('cpu','CPU Usage (%)');
return cpu_chart
}

function memInitialize(){
//初始化mem
let mem_chart = chartsInitialize('mem','Memory(MB)');
let mem_chart = chartsInitialize('mem','Memory Usage (MB)');
return mem_chart
}

function networkInitialize(){
//初始化network
let network_chart = chartsInitialize('network','Network DataKB)');
let network_chart = chartsInitialize('network','Network Data (KB)');
return network_chart
}

function fpsInitialize(){
//初始化fps
let fps_chart = chartsInitialize('fps','FPS(HZ)');
let fps_chart = chartsInitialize('fps','FPS (HZ)');
return fps_chart

}
Expand Down Expand Up @@ -644,22 +644,22 @@ <h6 class="dropdown-header">{% if lan == 'cn' %} 性能指标 {% else %} APM Tar

function collectCpu(device,pkgname){
cpuInitialize();
cpu_chart = collectPers(device,pkgname,'cpu','CPU(%)',getCpuRate(pkgname,device));
cpu_chart = collectPers(device,pkgname,'cpu','CPU Usage (%)',getCpuRate(pkgname,device));
}

function collectMem(device,pkgname){
memInitialize();
mem_chart = collectPers(device,pkgname,'mem','Memory(MB)',getMemPss(pkgname,device));
mem_chart = collectPers(device,pkgname,'mem','Memory Usage (MB)',getMemPss(pkgname,device));
}

function collectNetwork(device,pkgname){
networkInitialize();
network_chart = collectPers(device,pkgname,'network','Network Data(KB)',getNetWork(pkgname,device));
network_chart = collectPers(device,pkgname,'network','Network Data (KB)',getNetWork(pkgname,device));
}

function collectFps(device,pkgname){
fpsInitialize();
fps_chart = collectPers(device,pkgname,'fps','FPS(HZ)',getFps(pkgname,device));
fps_chart = collectPers(device,pkgname,'fps','FPS (HZ)',getFps(pkgname,device));
}

$('#run-apm').click(function () {
Expand Down
8 changes: 4 additions & 4 deletions solox/view/apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from logzero import logger
from flask import Blueprint
from solox import __version__
from solox.public.apm import CPU, Memory, Network, FPS, Battery, GPU, Energy, Disk,ThermalSensor, Target
from solox.public.apm_pk import CPU_PK, MEM_PK, Flow_PK, FPS_PK
from solox.public.common import Devices, File, Method, Install, Platform, Scrcpy
from solox.public.apm import (CPU, Memory, Network, FPS, Battery, GPU, Energy, Disk,ThermalSensor, Target)
from solox.public.apm_pk import (CPU_PK, MEM_PK, Flow_PK, FPS_PK)
from solox.public.common import (Devices, File, Method, Install, Platform, Scrcpy)

d = Devices()
f = File()
Expand Down Expand Up @@ -46,7 +46,7 @@ def setCookie():
@api.route('/solox/version', methods=['post', 'get'])
def version():
try:
pypi = json.loads(requests.get(url='https://pypi.org/pypi/solox/json',timeout=5).text)
pypi = json.loads(requests.get(url='https://pypi.org/pypi/solox/json',timeout=3).text)
version = pypi['info']['version']
result = {'status': 1, 'lastest_version': version, 'current_version': __version__}
except Exception as e:
Expand Down
6 changes: 0 additions & 6 deletions solox/view/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ def page_404(e):
settings = m._settings(request)
return render_template('404.html', **locals()), 404


@page.app_errorhandler(500)
def page_500(e):
settings = m._settings(request)
return render_template('500.html', **locals()), 500


@page.route('/')
def index():
platform = request.args.get('platform')
Expand All @@ -37,7 +35,6 @@ def pk():
settings = m._settings(request)
return render_template('pk.html', **locals())


@page.route('/report')
def report():
lan = request.args.get('lan')
Expand Down Expand Up @@ -70,7 +67,6 @@ def report():
apm_data_len = len(apm_data)
return render_template('report.html', **locals())


@page.route('/analysis', methods=['post', 'get'])
def analysis():
lan = request.args.get('lan')
Expand Down Expand Up @@ -122,8 +118,6 @@ def analysis_pk():
break
return render_template('analysis_pk.html', **locals())



@page.route('/compare_analysis', methods=['post', 'get'])
def analysis_compare():
platform = request.args.get('platform')
Expand Down
Loading

0 comments on commit 0c8970f

Please sign in to comment.