diff --git a/README.en.md b/README.en.md
deleted file mode 100644
index 4cf5d6b62e28e5c5a9bb6353dcdc5e5c7ec299ca..0000000000000000000000000000000000000000
--- a/README.en.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# developtools_smartperf_host
-
-#### Description
-{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
-
-#### Software Architecture
-Software architecture description
-
-#### Installation
-
-1. xxxx
-2. xxxx
-3. xxxx
-
-#### Instructions
-
-1. xxxx
-2. xxxx
-3. xxxx
-
-#### Contribution
-
-1. Fork the repository
-2. Create Feat_xxx branch
-3. Commit your code
-4. Create Pull Request
-
-
-#### Gitee Feature
-
-1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
-2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
-3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
-4. The most valuable open source project [GVP](https://gitee.com/gvp)
-5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
-6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
diff --git a/README.md b/README.md
index 3d93077a0aa0beaa8c81e502e3772e88a6ef7f50..4cf5d6b62e28e5c5a9bb6353dcdc5e5c7ec299ca 100644
--- a/README.md
+++ b/README.md
@@ -1,69 +1,36 @@
-# Smartperf-Host
-## 简介
-Smartperf-Host是一款深入挖掘数据、细粒度地展示数据的性能功耗调优工具,旨在为开发者提供一套性能调优平台,支持对CPU调度、频点、进程线程时间片、堆内存、帧率等数据进行采集和展示,展示方式为泳道图,支持GUI(图形用户界面)操作进行详细数据分析。
-## 架构图
-
-该组件整体分为设备端和PC端两部分,设备端和PC端基于gRPC(Remote Procedure Call)通信框架进行数据交互。
+# developtools_smartperf_host
-设备端内部分为应用程序内嵌组件、命令行工具、性能调优服务、性能调优插件集合、部分系统工具及部分系统内核等模块。设备端提供了插件扩展能力,对外提供了插件接口,基于该扩展能力可以按需定义自己的能力,并集成到框架中来,目前基于插件能力已经完成了native内存插件、trace插件等,详细介绍见[性能调优组件](https://gitee.com/openharmony/developtools_profiler)。
+#### Description
+{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
-PC端以Smartperf-Host网站的形式进行发布,内部分为Trace Streamer数据解析、SQLite数据存储、hdc设备管理、数据导入、UI绘制、数据分析等模块。下文会重点对Smartperf-Host提供的各项能力进行介绍。
-## 项目目录
-```
-/developtools/smartperf_host
-├── figures # 图片资源
-├── ide # Smartperf-Host IDE 模块目录
-│ └── src # 主机测调优模块代码
-│ │ ├── base-ui # 基础组件目录
-│ │ └── Trace # 业务逻辑目录
-├── trace_streamer # 解析模块代码目录
-│ ├── base # 基础功能
-│ ├── cfg # 配置目录
-│ ├── filter # Filter 功能
-│ ├── include # Include 头文件
-│ ├── multi_platform # 平台适配
-│ ├── parser # 解析业务逻辑
-│ │ ├── bytrace_parser # byTrace 解析业务逻辑
-│ │ └── htrace_parser # hTrace 解析业务逻辑
-│ ├── table # 表结构
-│ ├── trace_data # trace 结构
-│ ├── trace_streamer # traceStreamer 结构
-│ └── kits # js/napi 接口存放目录
-```
-## 功能介绍
-### 网页加载trace
-使用Smartperf-Host加载保存在本地的trace文件(htrace、ftrace等)并显示数据到泳道图中,trace数据分析详见《[网页加载trace说明](./ide/src/doc/md/quickstart_systemtrace.md)》。
-### 网页抓取trace
-使用Smartperf-Host在线抓取trace,可以自定义抓取内容、抓取时长、trace保存路径,详见《[网页抓取trace说明](./ide/src/doc/md/quickstart_web_record.md)》。
-### 设备抓取trace
-在设备端抓取trace,可以自定义抓取内容、抓取时长、trace保存路径,详见《[设备端抓取trace说明](./ide/src/doc/md/quickstart_device_record.md)》。
-### Ability Monitor抓取
-使用Smartperf-Host抓取应用的CPU、内存、磁盘IO和网络的使用情况,详见《[Ability Monitor抓取和展示说明](./ide/src/doc/md/quickstart_ability_monitor.md)》。
-### Native Memory抓取
-使用Smartperf-Host抓取应用的Native Memory(C和C++部分)的分配和释放情况,详见《[Native Memory抓取和展示说明](./ide/src/doc/md/quickstart_native_memory.md)》。
-### Hiperf抓取
-使用Smartperf-Host抓取应用的cpu使用量、方法的调用栈等,详见《[HiPerf的抓取和展示说明](./ide/src/doc/md/quickstart_hiperf.md)》。
-### HiSystemEvent抓取
-使用Smartperf-Host抓取应用的各个子类别功耗占比(CPU、网络、定位等)、应用的资源申请使用记录(WorkScheduler、Runninglock、Alarm、Location Request)、应用功耗异常事件显示、功耗关联系统状态显示(电池电量、屏幕状态),详见《[HiSystemEvent的抓取和展示说明](./ide/src/doc/md/quickstart_hisystemevent.md)》。
-### FileSystem抓取
-使用Smartperf-Host抓取所有文件系统系统调用信息、读写调用次数等,详见《[FileSystem的抓取和展示说明](./ide/src/doc/md/quickstart_filesystem.md)》。
-### 页内存抓取
-使用Smartperf-Host抓取页内存相关事件的开始时间、持续时间、触发进程、触发线程、事件类型、内存地址、内存大小等,详见《[页内存的抓取和展示说明](./ide/src/doc/md/quickstart_page_fault.md)》。
-### Bio抓取
-使用Smartperf-Host抓取每次IO访问的起始时间、总延迟、进程、每4k数据的平均延迟、线程、操作(写数据、页面换入、Metadata)、访问量、路径等、Block number、优先级、Backtrace调用栈,详见《[Bio的抓取和展示说明](./ide/src/doc/md/quickstart_bio.md)》。
-### 进程Smaps抓取
-使用Smartperf-Host抓取单个进程的smaps数据(类别、Pss、Rss、Vss等),数据源为/proc/$pid/smaps,详见《[进程smaps的抓取和展示说明](./ide/src/doc/md/quickstart_smaps.md)》。
-### Sql分析和Metrics说明
-Smartperf-Host网站trace解析完成后在线数据库使用说明,详见《[Sql分析和Metrics说明](./ide/src/doc/md/quickstart_sql_metrics.md)》。
-## 编译指南
-项目编译主要包括两部分,Trace Streamer编译和Smartperf-Host编译部署。
-### 构建约束
-- C++ 11或以上
-- node 版本 >= 16.15.1
-- npm 版本 >= 8.13.2
-- TypeScript 版本 >= 4.2.3
-- golang 版本 >= 1.13.8
-### Trace Streamer编译
-搭建Smartperf-Host网站需要编译出trace_streamer的wasm版本供网页端进行原始trace数据解析工作,具体的编译过程参考《[如何独立编译Trace Streamer](./trace_streamer/doc/compile_trace_streamer.md)》。
-### Smartperf-Host编译部署
-具体的编译部署过程参考《[SmartPerf 编译部署指导](./ide/README_zh.md)》,部署成功后通过浏览器访问页面 https://[部署机器ip地址]:9000/application/ 即可使用Smartperf-Host的全部功能。
+#### Software Architecture
+Software architecture description
+
+#### Installation
+
+1. xxxx
+2. xxxx
+3. xxxx
+
+#### Instructions
+
+1. xxxx
+2. xxxx
+3. xxxx
+
+#### Contribution
+
+1. Fork the repository
+2. Create Feat_xxx branch
+3. Commit your code
+4. Create Pull Request
+
+
+#### Gitee Feature
+
+1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
+2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
+3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
+4. The most valuable open source project [GVP](https://gitee.com/gvp)
+5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
+6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
diff --git a/README_zh.md b/README_zh.md
new file mode 100644
index 0000000000000000000000000000000000000000..bea68ce13520fe25ac1bc62fa0a1321593016c5d
--- /dev/null
+++ b/README_zh.md
@@ -0,0 +1,70 @@
+# Smartperf_Host
+## 简介
+Smartperf_Host是一款深入挖掘数据、细粒度地展示数据的性能功耗调优工具,旨在为开发者提供一套性能调优平台,支持对CPU调度、频点、进程线程时间片、堆内存、帧率等数据进行采集和展示,展示方式为泳道图,支持GUI(图形用户界面)操作进行详细数据分析。
+## 架构图
+
+
+该组件整体分为设备端和PC端两部分,设备端和PC端基于gRPC(Remote Procedure Call)通信框架进行数据交互。
+
+设备端内部分为应用程序内嵌组件、命令行工具、性能调优服务、性能调优插件集合、部分系统工具及部分系统内核等模块。设备端提供了插件扩展能力,对外提供了插件接口,基于该扩展能力可以按需定义自己的能力,并集成到框架中来,目前基于插件能力已经完成了native内存插件、trace插件等,详细介绍见[性能调优组件](https://gitee.com/openharmony/developtools_profiler)。
+
+PC端以Smartperf_Host网站的形式进行发布,内部分为Trace Streamer数据解析、SQLite数据存储、hdc设备管理、数据导入、UI绘制、数据分析等模块。下文会重点对Smartperf_Host提供的各项能力进行介绍。
+## 项目目录
+```
+/developtools/smartperf_host
+├── figures # 图片资源
+├── ide # Smartperf_Host IDE 模块目录
+│ └── src # 主机测调优模块代码
+│ │ ├── base-ui # 基础组件目录
+│ │ └── Trace # 业务逻辑目录
+├── trace_streamer # 解析模块代码目录
+│ ├── base # 基础功能
+│ ├── cfg # 配置目录
+│ ├── filter # Filter 功能
+│ ├── include # Include 头文件
+│ ├── multi_platform # 平台适配
+│ ├── parser # 解析业务逻辑
+│ │ ├── bytrace_parser # byTrace 解析业务逻辑
+│ │ └── htrace_parser # hTrace 解析业务逻辑
+│ ├── table # 表结构
+│ ├── trace_data # trace 结构
+│ ├── trace_streamer # traceStreamer 结构
+│ └── kits # js/napi 接口存放目录
+```
+## 功能介绍
+### 网页加载trace
+使用Smartperf_Host加载保存在本地的trace文件(htrace、ftrace等)并显示数据到泳道图中,trace数据分析详见《[网页加载trace说明](./ide/src/doc/md/quickstart_systemtrace.md)》。
+### 网页抓取trace
+使用Smartperf_Host在线抓取trace,可以自定义抓取内容、抓取时长、trace保存路径,详见《[网页抓取trace说明](./ide/src/doc/md/quickstart_web_record.md)》。
+### 设备抓取trace
+在设备端抓取trace,可以自定义抓取内容、抓取时长、trace保存路径,详见《[设备端抓取trace说明](./ide/src/doc/md/quickstart_device_record.md)》。
+### Ability Monitor抓取
+使用Smartperf_Host抓取应用的CPU、内存、磁盘IO和网络的使用情况,详见《[Ability Monitor抓取和展示说明](./ide/src/doc/md/quickstart_ability_monitor.md)》。
+### Native Memory抓取
+使用Smartperf_Host抓取应用的Native Memory(C和C++部分)的分配和释放情况,详见《[Native Memory抓取和展示说明](./ide/src/doc/md/quickstart_native_memory.md)》。
+### Hiperf抓取
+使用Smartperf_Host抓取应用的cpu使用量、方法的调用栈等,详见《[HiPerf的抓取和展示说明](./ide/src/doc/md/quickstart_hiperf.md)》。
+### HiSystemEvent抓取
+使用Smartperf_Host抓取应用的各个子类别功耗占比(CPU、网络、定位等)、应用的资源申请使用记录(WorkScheduler、Runninglock、Alarm、Location Request)、应用功耗异常事件显示、功耗关联系统状态显示(电池电量、屏幕状态),详见《[HiSystemEvent的抓取和展示说明](./ide/src/doc/md/quickstart_hisystemevent.md)》。
+### FileSystem抓取
+使用Smartperf_Host抓取所有文件系统系统调用信息、读写调用次数等,详见《[FileSystem的抓取和展示说明](./ide/src/doc/md/quickstart_filesystem.md)》。
+### 页内存抓取
+使用Smartperf_Host抓取页内存相关事件的开始时间、持续时间、触发进程、触发线程、事件类型、内存地址、内存大小等,详见《[页内存的抓取和展示说明](./ide/src/doc/md/quickstart_page_fault.md)》。
+### Bio抓取
+使用Smartperf_Host抓取每次IO访问的起始时间、总延迟、进程、每4k数据的平均延迟、线程、操作(写数据、页面换入、Metadata)、访问量、路径等、Block number、优先级、Backtrace调用栈,详见《[Bio的抓取和展示说明](./ide/src/doc/md/quickstart_bio.md)》。
+### 进程Smaps抓取
+使用Smartperf_Host抓取单个进程的smaps数据(类别、Pss、Rss、Vss等),数据源为/proc/$pid/smaps,详见《[进程smaps的抓取和展示说明](./ide/src/doc/md/quickstart_smaps.md)》。
+### Sql分析和Metrics说明
+Smartperf_Host网站trace解析完成后在线数据库使用说明,详见《[Sql分析和Metrics说明](./ide/src/doc/md/quickstart_sql_metrics.md)》。
+## 编译指南
+项目编译主要包括两部分,Trace Streamer编译和Smartperf_Host编译部署。
+### 构建约束
+- C++ 11或以上
+- node 版本 >= 16.15.1
+- npm 版本 >= 8.13.2
+- TypeScript 版本 >= 4.2.3
+- golang 版本 >= 1.13.8
+### Trace Streamer编译
+搭建Smartperf_Host网站需要编译出trace_streamer的wasm版本供网页端进行原始trace数据解析工作,具体的编译过程参考《[如何独立编译Trace Streamer](./trace_streamer/doc/compile_trace_streamer.md)》。
+### Smartperf_Host编译部署
+具体的编译部署过程参考《[SmartPerf 编译部署指导](./ide/README_zh.md)》,部署成功后通过浏览器访问页面 https://[部署机器ip地址]:9000/application/ 即可使用Smartperf_Host的全部功能。
diff --git a/figures/smartperf_frame.png b/figures/smartperf_frame.png
old mode 100755
new mode 100644
index 3ed5bb1d08cd1269078374e8ca2e962199f90e65..ec6d22ff82fcfcb4750a27a00322161bb6693e6f
Binary files a/figures/smartperf_frame.png and b/figures/smartperf_frame.png differ
diff --git a/trace_streamer/sdk/dubai_sdk/base/log.cpp b/ide/jest.setup.js
similarity index 77%
rename from trace_streamer/sdk/dubai_sdk/base/log.cpp
rename to ide/jest.setup.js
index 7d167a90cb4f5f1678b59e23518ddce9873b89d1..32b8af73b5dfd456acd01851f9e3c6925ce1967c 100644
--- a/trace_streamer/sdk/dubai_sdk/base/log.cpp
+++ b/ide/jest.setup.js
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -13,5 +13,6 @@
* limitations under the License.
*/
-#include "log.h"
-bool g_cleanMode = false;
+const { TextEncoder, TextDecoder } = require('util');
+global.TextEncoder = TextEncoder;
+global.TextDecoder = TextDecoder;
diff --git a/ide/src/base-ui/select/LitSelectOption.ts b/ide/src/base-ui/select/LitSelectOption.ts
index 60c3f3330d8d9effeb3de6429baba6b576303a32..b828752f69de40928e4a493be610f399cad418c5 100644
--- a/ide/src/base-ui/select/LitSelectOption.ts
+++ b/ide/src/base-ui/select/LitSelectOption.ts
@@ -30,9 +30,10 @@ export class LitSelectOption extends BaseElement {
transition: all .3s;
color: var(--dark-color2,#333);
tab-index: -1;
- /*overflow: scroll;*/
align-items: center;
- /*justify-content: space-between;*/
+ width: max-content;
+ max-lines: 1;
+ white-space: nowrap;
font-size: 0.8rem;
}
:host(:not([disabled])[selected]){
diff --git a/ide/src/base-ui/table/lit-table.ts b/ide/src/base-ui/table/lit-table.ts
index acc0ebfa54dbbdbdc37fee310f7ab586cc359b04..9a1555f6f1d73e905ea8e6a49bec5f2643982bc0 100644
--- a/ide/src/base-ui/table/lit-table.ts
+++ b/ide/src/base-ui/table/lit-table.ts
@@ -20,7 +20,8 @@ import '../utils/Template.js';
import { TableRowObject } from './TableRowObject.js';
import { ExcelFormater } from '../utils/ExcelFormater.js';
import { JSonToCSV } from '../utils/CSVFormater.js';
-import { LitIcon } from '../icon/LitIcon.js';
+import { NodeType } from '../../js-heap/model/DatabaseStruct.js';
+import { ConstructorType } from '../../js-heap/model/UiStruct.js';
@element('lit-table')
export class LitTable extends HTMLElement {
@@ -46,6 +47,7 @@ export class LitTable extends HTMLElement {
private isRecycleList: boolean = true;
private isScrollXOutSide: boolean = false;
private exportLoading: boolean = false;
+ private _loading: boolean = false;
constructor() {
super();
@@ -259,7 +261,12 @@ export class LitTable extends HTMLElement {
}
static get observedAttributes() {
- return ['scroll-y', 'selectable', 'no-head', 'grid-line', 'defaultOrderColumn', 'hideDownload'];
+ return ['scroll-y', 'selectable', 'no-head', 'grid-line', 'defaultOrderColumn', 'hideDownload', 'loading'];
+ }
+
+ set loading(value : boolean){
+ this._loading = value;
+ this.exportProgress!.loading = value;
}
get hideDownload() {
@@ -1129,15 +1136,46 @@ export class LitTable extends HTMLElement {
let btn = this.createExpandBtn(rowData);
td.title = rowData.data.objectName;
td.insertBefore(btn, td.firstChild);
- td.style.paddingLeft = rowData.depth * 15 + 'px';
}
if (rowData.data.hasNext) {
td.title = rowData.data.objectName;
let btn = this.createBtn(rowData);
td.insertBefore(btn, td.firstChild);
- td.style.paddingLeft = 15 * rowData.depth + 'px';
- } else {
- td.style.paddingLeft = rowData.depth * 15 + 20 + 'px';
+ }
+ td.style.paddingLeft = rowData.depth * 15 + 'px';
+ if (rowData.data.rowName === 'js-memory') {
+ let nodeText = document.createElement('text');
+ nodeText.classList.add('nodeName');
+ nodeText.textContent = rowData.data.nodeName;
+ td.append(nodeText);
+ let countText = document.createElement('text');
+ countText.classList.add('countName');
+ countText.textContent = rowData.data.count;
+ td.append(countText);
+ let nodeIdText = document.createElement('text');
+ nodeIdText.classList.add('nodeIdText');
+ nodeIdText.textContent = rowData.data.nodeId;
+ td.append(nodeIdText);
+ if (rowData.data.edgeName != '') {
+ let edgeNameText = document.createElement('text');
+ edgeNameText.classList.add('edgeNameText');
+ edgeNameText.textContent = rowData.data.edgeName;
+ td.insertBefore(edgeNameText, nodeText);
+ let span = document.createElement('span');
+ span.classList.add('span');
+ span.textContent = '\xa0' + '::' + '\xa0';
+ edgeNameText.append(span);
+ }
+ if (
+ (rowData.data.nodeType == NodeType.STRING ||
+ rowData.data.nodeType == NodeType.CONCATENATED_STRING ||
+ rowData.data.nodeType == NodeType.SLICED_STRING) &&
+ rowData.data.type != ConstructorType.ClassType
+ ) {
+ nodeText.style.color = '#d53d3d';
+ nodeText.textContent = '"' + rowData.data.nodeName + '"';
+ }
+ td.title = rowData.data.objectName;
}
(td as any).data = rowData.data;
td.classList.add('tree-first-body');
@@ -1186,7 +1224,10 @@ export class LitTable extends HTMLElement {
newTableElement.append(td);
}
});
- (this.treeElement?.lastChild as HTMLElement).style.transform = `translateY(${treeTop}px)`;
+ let lastChild = this.treeElement?.lastChild as HTMLElement
+ if (lastChild) {
+ lastChild.style.transform = `translateY(${treeTop}px)`;
+ }
(newTableElement as any).data = rowData.data;
newTableElement.style.gridTemplateColumns = gridTemplateColumns.join(' ');
newTableElement.style.position = 'absolute';
@@ -1425,15 +1466,46 @@ export class LitTable extends HTMLElement {
if (rowObject.children && rowObject.children.length > 0 && !rowObject.data.hasNext) {
let btn = this.createExpandBtn(rowObject);
firstElement.insertBefore(btn, firstElement.firstChild);
- firstElement.style.paddingLeft = 15 * rowObject.depth + 'px';
}
if (rowObject.data.hasNext) {
let btn = this.createBtn(rowObject);
firstElement.title = rowObject.data.objectName;
firstElement.insertBefore(btn, firstElement.firstChild);
- firstElement.style.paddingLeft = 15 * rowObject.depth + 'px';
- } else {
- firstElement.style.paddingLeft = 20 + 15 * rowObject.depth + 'px';
+ }
+ firstElement.style.paddingLeft = 15 * rowObject.depth + 'px';
+ if (rowObject.data.rowName === 'js-memory') {
+ let nodeText = document.createElement('text');
+ nodeText.classList.add('nodeName');
+ nodeText.textContent = rowObject.data.nodeName;
+ firstElement.append(nodeText);
+ let countText = document.createElement('text');
+ countText.classList.add('countName');
+ countText.textContent = rowObject.data.count;
+ firstElement.append(countText);
+ let nodeIdText = document.createElement('text');
+ nodeIdText.classList.add('nodeIdText');
+ nodeIdText.textContent = rowObject.data.nodeId;
+ firstElement.append(nodeIdText);
+ if (rowObject.data.edgeName != '') {
+ let edgeNameText = document.createElement('text');
+ edgeNameText.classList.add('edgeNameText');
+ edgeNameText.textContent = rowObject.data.edgeName;
+ firstElement.insertBefore(edgeNameText, nodeText);
+ let span = document.createElement('span');
+ span.classList.add('span');
+ span.textContent = '\xa0' + '::' + '\xa0';
+ edgeNameText.append(span);
+ }
+ if (
+ (rowObject.data.nodeType == NodeType.STRING ||
+ rowObject.data.nodeType == NodeType.CONCATENATED_STRING ||
+ rowObject.data.nodeType == NodeType.SLICED_STRING) &&
+ rowObject.data.type != ConstructorType.ClassType
+ ) {
+ nodeText.style.color = '#d53d3d';
+ nodeText.textContent = '"' + rowObject.data.nodeName + '"';
+ }
+ firstElement.title = rowObject.data.objectName;
}
firstElement.onclick = () => {
this.dispatchRowClickEvent(rowObject, [firstElement, element]);
diff --git a/ide/src/command/Cmd.ts b/ide/src/command/Cmd.ts
index 7bc953c5d994f0b253bd96788957212a23e9bef8..a66eb61529cf8bb441e66a6de682a6b94d883dd4 100644
--- a/ide/src/command/Cmd.ts
+++ b/ide/src/command/Cmd.ts
@@ -16,6 +16,10 @@
export class Cmd {
static CmdSendPostUtils(uri: string, callback: Function, requestData: any) {
+ // @ts-ignore
+ if (window.useWb) {
+ return;
+ }
fetch(uri, {
method: 'POST',
headers: {
@@ -39,12 +43,20 @@ export class Cmd {
* @param callback result callback
*/
static execObjDump(command: string, addr: string, callback: Function) {
+ // @ts-ignore
+ if (window.useWb) {
+ return;
+ }
const data = { cmd: command, addr: addr };
let uri = `http://${window.location.host.split(':')[0]}:${window.location.port}/exec`;
Cmd.CmdSendPostUtils(uri, callback, data);
}
static execHdcCmd(command: string, callback: Function) {
+ // @ts-ignore
+ if (window.useWb) {
+ return;
+ }
const data = {
cmd: command,
tag: 'shell',
@@ -54,6 +66,10 @@ export class Cmd {
}
static async execFileRecv(command: string, filePath: string, callback: Function) {
+ // @ts-ignore
+ if (window.useWb) {
+ return;
+ }
let fileName = filePath.substring(filePath.lastIndexOf('/') + 1);
const data = {
cmd: command,
@@ -72,6 +88,10 @@ export class Cmd {
}
static execHdcTraceCmd(command: string, serialNumber: string, callback: Function) {
+ // @ts-ignore
+ if (window.useWb) {
+ return;
+ }
const data = {
cmd: command,
tag: 'hiprofiler_cmd',
@@ -92,6 +112,10 @@ export class Cmd {
}
static showSaveFile(callback: Function) {
+ // @ts-ignore
+ if (window.useWb) {
+ return;
+ }
let uri = `http://${window.location.host.split(':')[0]}:${window.location.port}/showSaveDialog`;
fetch(uri, {
method: 'GET',
@@ -106,6 +130,10 @@ export class Cmd {
}
static uploadFile(fd: FormData, callback: Function) {
+ // @ts-ignore
+ if (window.useWb) {
+ return;
+ }
let uri = `http://${window.location.host.split(':')[0]}:${window.location.port}/upload`;
fetch(uri, {
method: 'POST',
@@ -116,6 +144,10 @@ export class Cmd {
}
static copyFile(fileName: string, distFile: string, callback: Function) {
+ // @ts-ignore
+ if (window.useWb) {
+ return;
+ }
const data = {
filename: fileName,
distfile: distFile,
@@ -133,6 +165,10 @@ export class Cmd {
}
static async openFileDialog() {
+ // @ts-ignore
+ if (window.useWb) {
+ return '';
+ }
let uri = `http://${window.location.host.split(':')[0]}:${window.location.port}/showOpenDialog`;
let res = await fetch(uri, { method: 'POST' });
let result = res.ok ? await res.text() : '';
diff --git a/ide/src/doc/md/quickstart_Application_operation_skills.md b/ide/src/doc/md/quickstart_Application_operation_skills.md
new file mode 100644
index 0000000000000000000000000000000000000000..219aa684a27e281d37db4182fdaa8f01d9f7c3ee
--- /dev/null
+++ b/ide/src/doc/md/quickstart_Application_operation_skills.md
@@ -0,0 +1,23 @@
+## 应用操作技巧
+ 应用操作技巧主要展示各个小模块的使用技巧。
+
+###可导入符号表
+符号表导入适用于所有支持调用栈的Tab页,选择一个文件夹,获取文件下及其子文件夹的所有so文件,更新数据库中符号数据。文件夹内so的格式需要与在设备上的路径一致,例如下图中,选择的文件夹为import,选择导入的libnative_hook.z.so,在设备上的路径是/system/lib64/,那么在本地选择的文件夹内也需要保证路径是import/system/lib64/libnative_hook.z.so。
+
+以NativeMemory举例,导入NativeMemory文件,点击Call info的Tab页,在搜索框中输入libnative_hook.z.so,会发现该so下的调用栈没有符号化完全。
+
+将本地编译的so通过导入按钮导入,本地导入路径是import/system/lib64/libnative_hook.z.so,红框处是导入按钮
+
+导入so以后,在搜索框中输入libnative_hook.z.so,会发现符号化数据已经更新
+
+
+###网页连接文件打开接口
+网页连接文件打开接口可以在网址后增加文件地址,打开后直接打开trace。
+接口的url路径如下:
+
+
++ 蓝色框:是Smartperf工具的url(https://localhost:9000/application/)。
++ 绿色框:trace文件的url,其中
+ 第一部分是?trace=(固定格式)。
+ 第二部分是trace文件的url(https://iot.itocm.com:9001/upload/ftrace_small.txt),此处根据文件的url实际地址填写。
+ 第三部分,&link=true(固定格式)。
diff --git a/ide/src/doc/md/quickstart_Import_so.md b/ide/src/doc/md/quickstart_Import_so.md
index 0c13dc416b8fe176936ca07aa0954cfd1cf75635..e07d95d2bf8135d0dce60937a2e8b049cedff3ec 100644
--- a/ide/src/doc/md/quickstart_Import_so.md
+++ b/ide/src/doc/md/quickstart_Import_so.md
@@ -134,13 +134,4 @@ Page Fault分为五级统计,分别按照进程,系统调用类型,线程

+ Function:函数名称。
+ Duration:该函数的系统调用的总时长。
-+ %:总时长占比。
-## 可导入符号表说明
-符号表导入适用于所有支持调用栈的Tab页,选择一个文件夹,获取文件下及其子文件夹的所有so文件,更新数据库中符号数据。文件夹内so的格式需要与在设备上的路径一致,例如下图中,选择的文件夹为import,选择导入的libnative_hook.z.so,在设备上的路径是/system/lib64/,那么在本地选择的文件夹内也需要保证路径是import/system/lib64/libnative_hook.z.so。
-
-以NativeMemory举例,导入NativeMemory文件,点击Call info的Tab页,在搜索框中输入libnative_hook.z.so,会发现该so下的调用栈没有符号化完全。
-
-将本地编译的so通过导入按钮导入,本地导入路径是import/system/lib64/libnative_hook.z.so,红框处是导入按钮
-
-导入so以后,在搜索框中输入libnative_hook.z.so,会发现符号化数据已经更新
-
\ No newline at end of file
++ %:总时长占比。
\ No newline at end of file
diff --git a/ide/src/doc/md/quickstart_Js_memory.md b/ide/src/doc/md/quickstart_Js_memory.md
index 88b52b044665df76445b2b6fc06a7dd1f649c4ab..0eb71f7bee4e96c5d9525446f9f2c819fe7e6bee 100644
--- a/ide/src/doc/md/quickstart_Js_memory.md
+++ b/ide/src/doc/md/quickstart_Js_memory.md
@@ -35,15 +35,17 @@ Summary的Tab页,主要显示了总览视图,通过类的名称来分组显
第二层为该类的实例名+id,id唯一。
第三层以下为实例中的成员变量。
+ Distance:使用节点的最短简单路径显示到根的距离。
- 例如下图其中GC Root为根节点,distance为0,G为上次GC之后新申请内存的实例,distance为1000000。A、B、C、D、E、F、H为调用节点;以E为例,从A->D->F>E,distance为4,从A->D->E,depth为3;从B->E,depth为2,遵循最小distance原则,E的distance为2,同理D的distance为2,F的distance为2,H的distance也为2。
+ 例如下图其中GC Root为根节点,distance为0,G为上次GC之后新申请内存的实例,distance为100000000。在界面上显示为-,A、B、C、D、E、F、H为调用节点;以E为例,从A->D->F>E,distance为4,从A->D->E,distance为3;从B->E,distance为2,遵循最小distance原则,E的distance为2,同理D的distance为2,F的distance为2,H的distance也为2。
+
+ 其中第一层类的distance为该类所有实例中最小的distance,如果有实例的distance为-,类的distance也为-(-表示没有被root节点引用的实例,如下图的G)

-+ ShallowSize:是指实例自身占用的内存, 可以理解为保存该'数据结构'需要多少内存。
- 例如下面的代码。:
++ ShallowSize:是指实例自身占用的内存, 可以理解为保存该'数据结构'需要多少内存
+ 例如下面的代码:
``` javascript
class X {
- a: number = 0;
- b: boolean = false;
- c: ChartStruct = new ChartStruct();
+ a: number = 0;
+ b: boolean = false;
+ c: ChartStruct = new ChartStruct();
}
```
假设当前是在64位系统, 对于类X来说, 一个X实例的Shallow Size为:
@@ -57,7 +59,7 @@ Summary的Tab页,主要显示了总览视图,通过类的名称来分组显
* 如上图所示;假设所有的节点Size都为1,按照A->B->C的顺序回收。
* 当A被回收时,H被D调用,先不回收,D没有被调用,D回收,由于D被回收,H没有被调用,H回收,由于F被C调用,E被B、F也调用了,所以不能被回收,此时A的Retained Size为3,D的Retained Size为2, H的Retained Size为1。
* 当B被回收时,由于E被F占用,所以E不会被回收,此时B的Retained Size为1。
- * 当C被回收时,F没有人被调用,E没有被调用,所以都会被回收,此时C的Retained Size为3,F的Retained Size为2, E的Retained Size为1。
+ * 当C被回收时,F没有被调用,E没有被调用,所以都会被回收,此时C的Retained Size为3,F的Retained Size为2, E的Retained Size为1。
Comparison的Tab页,主要显示了比较视图,显示两份快照间的不同之处,主要比较类创建与释放的实例数量。

diff --git a/ide/src/doc/quickstart_Application_operation_skills.html b/ide/src/doc/quickstart_Application_operation_skills.html
new file mode 100644
index 0000000000000000000000000000000000000000..c3b3a86fe6378a3e6d211cfc6f62d7c2fc37fdf0
--- /dev/null
+++ b/ide/src/doc/quickstart_Application_operation_skills.html
@@ -0,0 +1,819 @@
+
+
+
+
+ quickstart_Application_operation_skills
+
+
+
+
+
+
+
+
应用操作技巧主要展示各个小模块的使用技巧。
+
+
+
+ 符号表导入适用于所有支持调用栈的Tab页,选择一个文件夹,获取文件下及其子文件夹的所有so文件,更新数据库中符号数据。文件夹内so的格式需要与在设备上的路径一致,例如下图中,选择的文件夹为import,选择导入的libnative_hook.z.so,在设备上的路径是/system/lib64/,那么在本地选择的文件夹内也需要保证路径是import/system/lib64/libnative_hook.z.so。
+ 
+ 以NativeMemory举例,导入NativeMemory文件,点击Call info的Tab页,在搜索框中输入libnative_hook.z.so,会发现该so下的调用栈没有符号化完全。
+ 
+ 将本地编译的so通过导入按钮导入,本地导入路径是import/system/lib64/libnative_hook.z.so,红框处是导入按钮
+ 
+ 导入so以后,在搜索框中输入libnative_hook.z.so,会发现符号化数据已经更新
+ 
+
+
+
网页连接文件打开接口可以在网址后增加文件地址,打开后直接打开trace。
+ 接口的url路径如下:
+ 
+
+ -
+
蓝色框:是Smartperf工具的url(https://localhost:9000/application/)。
+
+
+ -
+
绿色框:trace文件的url,其中
+ 第一部分是?trace=(固定格式)。
+ 第二部分是trace文件的url(https://iot.itocm.com:9001/upload/ftrace_small.txt),此处根据文件的url实际地址填写。
+ 第三部分,&link=true(固定格式)。
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ide/src/doc/quickstart_Import_so.html b/ide/src/doc/quickstart_Import_so.html
index 043098e1bf40bf14a2b917971087bec9ece8653a..1e27b61e8fdf708b37f15d5cde19c9502bbbfcc1 100644
--- a/ide/src/doc/quickstart_Import_so.html
+++ b/ide/src/doc/quickstart_Import_so.html
@@ -1193,17 +1193,6 @@
-
-
-
- 符号表导入适用于所有支持调用栈的Tab页,选择一个文件夹,获取文件下及其子文件夹的所有so文件,更新数据库中符号数据。文件夹内so的格式需要与在设备上的路径一致,例如下图中,选择的文件夹为import,选择导入的libnative_hook.z.so,在设备上的路径是/system/lib64/,那么在本地选择的文件夹内也需要保证路径是import/system/lib64/libnative_hook.z.so。
- 
- 以NativeMemory举例,导入NativeMemory文件,点击Call info的Tab页,在搜索框中输入libnative_hook.z.so,会发现该so下的调用栈没有符号化完全。
- 
- 将本地编译的so通过导入按钮导入,本地导入路径是import/system/lib64/libnative_hook.z.so,红框处是导入按钮
- 
- 导入so以后,在搜索框中输入libnative_hook.z.so,会发现符号化数据已经更新
- 
diff --git a/ide/src/doc/quickstart_Js_memory.html b/ide/src/doc/quickstart_Js_memory.html
index 457044ba18a0a0201c5961cf9763ad3bc7e8b6b0..f337844b610fbada96ca7327a3e4bd48903f5927 100644
--- a/ide/src/doc/quickstart_Js_memory.html
+++ b/ide/src/doc/quickstart_Js_memory.html
@@ -819,22 +819,26 @@
Distance:使用节点的最短简单路径显示到根的距离。
- 例如下图其中GC Root为根节点,distance为0,G为上次GC之后新申请内存的实例,distance为1000000。A、B、C、D、E、F、H为调用节点;以E为例,从A->D->F>E,distance为4,从A->D->E,depth为3;从B->E,depth为2,遵循最小distance原则,E的distance为2,同理D的distance为2,F的distance为2,H的distance也为2。
-
+ 例如下图其中GC
+ Root为根节点,distance为0,G为上次GC之后新申请内存的实例,distance为100000000。在界面上显示为-,A、B、C、D、E、F、H为调用节点;以E为例,从A->D->F>E,distance为4,从A->D->E,distance为3;从B->E,distance为2,遵循最小distance原则,E的distance为2,同理D的distance为2,F的distance为2,H的distance也为2。
+
+ 其中第一层类的distance为该类所有实例中最小的distance,如果有实例的distance为-,类的distance也为-(-表示没有被root节点引用的实例,如下图的G)
+ 
+
-ShallowSize:是指实例自身占用的内存, 可以理解为保存该'数据结构'需要多少内存。
- 例如下面的代码。:
+ShallowSize:是指实例自身占用的内存, 可以理解为保存该'数据结构'需要多少内存
+ 例如下面的代码:
class X {
- a: number = : number = 0;
- b: boolean = false;
- c: ChartStruct : boolean = false;
+ c: ChartStruct = new ChartStruct();
@@ -858,7 +862,7 @@
Size为3,D的Retained Size为2, H的Retained Size为1。
当B被回收时,由于E被F占用,所以E不会被回收,此时B的Retained Size为1。
- 当C被回收时,F没有人被调用,E没有被调用,所以都会被回收,此时C的Retained Size为3,F的Retained
+ 当C被回收时,F没有被调用,E没有被调用,所以都会被回收,此时C的Retained Size为3,F的Retained
Size为2, E的Retained Size为1。
diff --git a/ide/src/figures/OperationSkills/Operation_soimport_dir.jpg b/ide/src/figures/OperationSkills/Operation_soimport_dir.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..30ec9c2595a0e328bdf421395a207269fc92ce54
Binary files /dev/null and b/ide/src/figures/OperationSkills/Operation_soimport_dir.jpg differ
diff --git a/ide/src/figures/OperationSkills/Operation_soimport_local.jpg b/ide/src/figures/OperationSkills/Operation_soimport_local.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..2822640f85ac6bf4f89d4c70118a4a33eba15f90
Binary files /dev/null and b/ide/src/figures/OperationSkills/Operation_soimport_local.jpg differ
diff --git a/ide/src/figures/OperationSkills/Operation_soimport_nativehook.jpg b/ide/src/figures/OperationSkills/Operation_soimport_nativehook.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..6c623f5047bee2386e52a44800caf729326a8824
Binary files /dev/null and b/ide/src/figures/OperationSkills/Operation_soimport_nativehook.jpg differ
diff --git a/ide/src/figures/OperationSkills/Operation_soimport_new.jpg b/ide/src/figures/OperationSkills/Operation_soimport_new.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..999ebb8e4f3669fa9a84bee5fcf0dc2b992caf1e
Binary files /dev/null and b/ide/src/figures/OperationSkills/Operation_soimport_new.jpg differ
diff --git a/ide/src/figures/OperationSkills/Opertion_urltrace.jpg b/ide/src/figures/OperationSkills/Opertion_urltrace.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..1713ce287f7845bffe3b2d6f959a54e040aa50ed
Binary files /dev/null and b/ide/src/figures/OperationSkills/Opertion_urltrace.jpg differ
diff --git a/ide/src/js-heap/model/DatabaseStruct.ts b/ide/src/js-heap/model/DatabaseStruct.ts
index 891270327362f811a9865717021e3864ee4ae028..4e8a89cef45d96496f70f732765ebdd4d5bce1c9 100644
--- a/ide/src/js-heap/model/DatabaseStruct.ts
+++ b/ide/src/js-heap/model/DatabaseStruct.ts
@@ -16,6 +16,18 @@
import { HeapLoader } from '../logic/HeapLoader.js';
import { AllocationFunction, FileInfo } from './UiStruct.js';
+export enum EdgeType {
+ CONTEXT = 0,
+ ELEMENT = 1,
+ PROPERTY = 2,
+ INTERNAL = 3,
+ HIDDEN = 4,
+ SHORTCUT = 5,
+ WEAK = 6,
+ STRING_OR_NUMBER = 6,
+ NODE = 7,
+ INVISIBLE = 8,
+}
export enum NodeType {
HIDDEN = 0,
ARRAY = 1,
@@ -34,19 +46,6 @@ export enum NodeType {
OBJECT_SHAPE = 14,
}
-export enum EdgeType {
- CONTEXT = 0,
- ELEMENT = 1,
- PROPERTY = 2,
- INTERNAL = 3,
- HIDDEN = 4,
- SHORTCUT = 5,
- WEAK = 6,
- STRING_OR_NUMBER = 6,
- NODE = 7,
- INVISIBLE = 8,
-}
-
function getNodeTypeName(nodeType: NodeType): keyof typeof NodeType {
return Object.keys(NodeType).find(
(key) => NodeType[key as keyof typeof NodeType] === nodeType
diff --git a/ide/src/js-heap/model/UiStruct.ts b/ide/src/js-heap/model/UiStruct.ts
index 1a03320b134b9a39a729ed1cf2edf4582f65141c..98302e44fad9e9f92296d90f17fb21a726caadb3 100644
--- a/ide/src/js-heap/model/UiStruct.ts
+++ b/ide/src/js-heap/model/UiStruct.ts
@@ -14,8 +14,8 @@
*/
import { HeapDataInterface } from '../HeapDataInterface.js';
-import { EdgeType } from './DatabaseStruct';
-
+import { EdgeType, NodeType } from './DatabaseStruct.js';
+const ROW_TYPE = 'js-memory';
export enum FileType {
SNAPSHOT,
TIMELINE,
@@ -30,6 +30,7 @@ export enum ConstructorType {
}
export class ConstructorItem {
+ rowName = ROW_TYPE;
fileId = -1;
nodeName = '';
edgeName = '';
@@ -46,6 +47,7 @@ export class ConstructorItem {
edgeCount = 0;
edgeType!: EdgeType;
type!: ConstructorType;
+ nodeType!: NodeType;
nextId: [] = [];
id = -1;
index = -1;
@@ -71,6 +73,10 @@ export class ConstructorItem {
return this.children;
}
+ isString(): boolean {
+ return [NodeType.STRING, NodeType.CONCATENATED_STRING, NodeType.SLICED_STRING].includes(this.nodeType);
+ }
+
clone(): ConstructorItem {
let copyItem = new ConstructorItem();
this.cloneContent(copyItem);
diff --git a/ide/src/js-heap/utils/Utils.ts b/ide/src/js-heap/utils/Utils.ts
index a4be1d475e6cea1da6f18c00f2cc544f5b1e9786..462a9b0e6885ed0b97bbe0df6cb7c7c3cdb3f38f 100644
--- a/ide/src/js-heap/utils/Utils.ts
+++ b/ide/src/js-heap/utils/Utils.ts
@@ -26,6 +26,7 @@ export function HeapNodeToConstructorItem(node: HeapNode): ConstructorComparison
constructor.distance = node.distance;
constructor.shallowSize = node.selfSize;
constructor.retainedSize = node.retainedSize;
+ constructor.nodeType = node.type;
return constructor;
}
diff --git a/ide/src/statistics/util/SpStatisticsHttpUtil.ts b/ide/src/statistics/util/SpStatisticsHttpUtil.ts
index 5ac69493e6a3c98827eae1fc8626bb56694a91b6..df84a3301b093188d77f7a9f88c5c1b184bcc4af 100644
--- a/ide/src/statistics/util/SpStatisticsHttpUtil.ts
+++ b/ide/src/statistics/util/SpStatisticsHttpUtil.ts
@@ -88,6 +88,10 @@ export class SpStatisticsHttpUtil {
}
static addUserVisitAction(requestUrl: string) {
+ // @ts-ignore
+ if (window.useWb) {
+ return;
+ }
if (SpStatisticsHttpUtil.requestServerInfo === '') {
SpStatisticsHttpUtil.requestServerInfo = SpStatisticsHttpUtil.getRequestServerInfo();
}
@@ -127,6 +131,10 @@ export class SpStatisticsHttpUtil {
}
static addOrdinaryVisitAction(requestBody: BurialPointRequestBody) {
+ // @ts-ignore
+ if (window.useWb) {
+ return;
+ }
if (SpStatisticsHttpUtil.requestServerInfo === '') {
SpStatisticsHttpUtil.requestServerInfo = SpStatisticsHttpUtil.getRequestServerInfo();
}
diff --git a/ide/src/trace/SpApplication.ts b/ide/src/trace/SpApplication.ts
index 5e6889952ecf0a00fa2927c5f2381a2f4a6f10ec..452e993c212df899692d86c27ae4ab0e5825bced 100644
--- a/ide/src/trace/SpApplication.ts
+++ b/ide/src/trace/SpApplication.ts
@@ -471,6 +471,10 @@ export class SpApplication extends BaseElement {
};
window.subscribe(window.SmartEvent.UI.MenuTrace, () => showContent(spSystemTrace!));
+ window.subscribe(window.SmartEvent.UI.Error,(err) => {
+ litSearch.setPercent(err,-1);
+ progressEL.loading = false;
+ });
window.subscribe(window.SmartEvent.UI.Loading, (loading) => {
litSearch.setPercent(loading ? 'Import So File' : '', loading ? -1 : 101);
progressEL.loading = loading
diff --git a/ide/src/trace/bean/BoxSelection.ts b/ide/src/trace/bean/BoxSelection.ts
index 20b9f15755c7daa23991f791b760f1e654be5064..a3d73099ac25fd6e9d085947bab0ad3b44261ad6 100644
--- a/ide/src/trace/bean/BoxSelection.ts
+++ b/ide/src/trace/bean/BoxSelection.ts
@@ -37,6 +37,7 @@ export class SelectionParam {
cpuFreqFilterIds: Array = [];
cpuFreqLimitDatas: Array> = [];
threadIds: Array = [];
+ processIds: Array = [];
processTrackIds: Array = [];
virtualTrackIds: Array = [];
clockMapData: Map> = new Map>();
diff --git a/ide/src/trace/bean/EnergyStruct.ts b/ide/src/trace/bean/EnergyStruct.ts
index b13c58a5f4bab963933d78f3e2269a78fda49e0c..fc0e0a0c60392caeb317ed6f56e0c68dba8bcf33 100644
--- a/ide/src/trace/bean/EnergyStruct.ts
+++ b/ide/src/trace/bean/EnergyStruct.ts
@@ -18,7 +18,7 @@ export class PowerDetailsEnergy {
this.event = eventName;
}
- event: string = '';
+ event: string;
charge: number = 0;
background_time: number = 0;
screen_on_time: number = 0;
diff --git a/ide/src/trace/component/SpHelp.ts b/ide/src/trace/component/SpHelp.ts
index 077f740620c7d89e87083f20e303a35e2146e4d3..6ce5e24fa45b0f5aa42378c4f0464a7d89c71bf5 100644
--- a/ide/src/trace/component/SpHelp.ts
+++ b/ide/src/trace/component/SpHelp.ts
@@ -313,6 +313,21 @@ export class SpHelp extends BaseElement {
' width="100%" height="100%">';
},
},
+ {
+ title: '应用操作技巧',
+ icon: '',
+ clickHandler: function (item: MenuItem) {
+ SpStatisticsHttpUtil.addOrdinaryVisitAction({
+ event: 'operation_skills',
+ action: 'help_doc',
+ });
+ that.appContent!.innerHTML =
+ '';
+ },
+ },
],
},
{
diff --git a/ide/src/trace/component/SpRecordTrace.ts b/ide/src/trace/component/SpRecordTrace.ts
index 0d06a1febc2e9399f3d91d7a1f90b47a44e3ac5c..8c320d798adc8c2e5f7b94f72d5733323599309b 100644
--- a/ide/src/trace/component/SpRecordTrace.ts
+++ b/ide/src/trace/component/SpRecordTrace.ts
@@ -368,7 +368,7 @@ export class SpRecordTrace extends BaseElement {
public deviceSelect: HTMLSelectElement | undefined;
public deviceVersion: HTMLSelectElement | undefined;
- private stopButtonEl: HTMLButtonElement | null | undefined;
+ private recordButtonText:HTMLSpanElement | undefined;
private recordButton: LitButton | undefined;
private sp: SpApplication | undefined;
@@ -391,6 +391,8 @@ export class SpRecordTrace extends BaseElement {
private menuGroup: LitMainMenuGroup | undefined | null;
private appContent: HTMLElement | undefined | null;
+ private record= 'Record';
+ private stop = 'StopCmd';
compareArray(devs: Array): boolean {
let clearFlag: boolean = false;
@@ -646,6 +648,7 @@ export class SpRecordTrace extends BaseElement {
});
this.recordButton = this.shadowRoot?.querySelector('.record') as LitButton;
+ this.recordButtonText = this.shadowRoot?.querySelector('.record_text') as HTMLSpanElement;
this.sp = document.querySelector('sp-application') as SpApplication;
this.progressEL = this.sp.shadowRoot?.querySelector('.progress') as LitProgressBar;
this.litSearch = this.sp.shadowRoot?.querySelector('#lit-search') as LitSearch;
@@ -657,7 +660,11 @@ export class SpRecordTrace extends BaseElement {
this.recordButton!.hidden = true;
}
this.recordButton!.addEventListener('click', () => {
- this.recordButtonListener();
+ if (this.recordButtonText!.textContent == this.record) {
+ this.recordButtonListener();
+ } else {
+ this.stopRecordListener();
+ }
});
this.spRecordPerf!.addEventListener('addProbe', (event: any) => {
this.showHint = false;
@@ -671,10 +678,6 @@ export class SpRecordTrace extends BaseElement {
this.spRecordTemplate!.addEventListener('addProbe', (event: any) => {
this.showHint = false;
});
- this.stopButtonEl = this.traceCommand!.shadowRoot?.querySelector('#stop-button');
- this.stopButtonEl!.addEventListener('click', (ev) => {
- this.stopRecordListener();
- });
this.menuGroup = this.shadowRoot?.querySelector('#menu-group') as LitMainMenuGroup;
this.appContent = this.shadowRoot?.querySelector('#app-content') as HTMLElement;
if (this.record_template) {
@@ -717,6 +720,7 @@ export class SpRecordTrace extends BaseElement {
}
stopRecordListener() {
+ this.recordButtonText!.textContent = 'Record'
if (this.vs) {
let cmd = Cmd.formatString(CmdConstant.CMS_HDC_STOP, [SpRecordTrace.serialNumber]);
Cmd.execHdcCmd(cmd, (res: string) => {
@@ -725,11 +729,9 @@ export class SpRecordTrace extends BaseElement {
this.progressEL!.loading = false;
this.sp!.search = false;
this.litSearch!.clear();
- this.recordButton!.style.pointerEvents = 'auto';
this.addButton!.style.pointerEvents = 'auto';
this.deviceSelect!.style.pointerEvents = 'auto';
this.disconnectButton!.style.pointerEvents = 'auto';
- this.traceCommand!.show = false;
});
} else {
let selectedOption = this.deviceSelect!.options[this.deviceSelect!.selectedIndex] as HTMLOptionElement;
@@ -742,7 +744,6 @@ export class SpRecordTrace extends BaseElement {
this.sp!.search = false;
this.litSearch!.clear();
this.disconnectButton!.style.pointerEvents = 'auto';
- this.recordButton!.style.pointerEvents = 'auto';
this.addButton!.style.pointerEvents = 'auto';
this.deviceSelect!.style.pointerEvents = 'auto';
SpRecordTrace.stopRecord = true;
@@ -750,7 +751,6 @@ export class SpRecordTrace extends BaseElement {
} catch (exception) {
log(exception);
}
- this.traceCommand!.show = false;
}
});
}
@@ -1020,6 +1020,7 @@ export class SpRecordTrace extends BaseElement {
this.litSearch!.clear();
this.litSearch!.setPercent('tracing ' + this.recordSetting!.maxDur * 1000 + 'ms', -1);
this.initRecordUIState();
+ this.recordButtonText!.textContent = this.stop;
Cmd.execHdcTraceCmd(traceCommandStr, SpRecordTrace.serialNumber, (traceResult: string) => {
if (traceResult.indexOf('DestroySession done') != -1) {
this.litSearch!.setPercent('tracing htrace down', -1);
@@ -1036,6 +1037,7 @@ export class SpRecordTrace extends BaseElement {
let child = children[0].children as Array