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(图形用户界面)操作进行详细数据分析。 -## 架构图 -![系统架构图](./figures/smartperf_frame.png) -该组件整体分为设备端和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(图形用户界面)操作进行详细数据分析。 +## 架构图 +![系统架构图](./figures/smartperf_frame.png) + +该组件整体分为设备端和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。 +![GitHub Logo](../../figures/OperationSkills/Operation_soimport_dir.jpg) +以NativeMemory举例,导入NativeMemory文件,点击Call info的Tab页,在搜索框中输入libnative_hook.z.so,会发现该so下的调用栈没有符号化完全。 +![GitHub Logo](../../figures/OperationSkills/Operation_soimport_nativehook.jpg) +将本地编译的so通过导入按钮导入,本地导入路径是import/system/lib64/libnative_hook.z.so,红框处是导入按钮 +![GitHub Logo](../../figures/OperationSkills/Operation_soimport_local.jpg) +导入so以后,在搜索框中输入libnative_hook.z.so,会发现符号化数据已经更新 +![GitHub Logo](../../figures/OperationSkills/Operation_soimport_new.jpg) + +###网页连接文件打开接口 +网页连接文件打开接口可以在网址后增加文件地址,打开后直接打开trace。 +接口的url路径如下: +![GitHub Logo](../../figures/OperationSkills/Opertion_urltrace.jpg) + ++ 蓝色框:是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分为五级统计,分别按照进程,系统调用类型,线程 ![GitHub Logo](../../figures/ImportSo/pagefault_import_func.jpg) + Function:函数名称。 + Duration:该函数的系统调用的总时长。 -+ %:总时长占比。 -## 可导入符号表说明 -符号表导入适用于所有支持调用栈的Tab页,选择一个文件夹,获取文件下及其子文件夹的所有so文件,更新数据库中符号数据。文件夹内so的格式需要与在设备上的路径一致,例如下图中,选择的文件夹为import,选择导入的libnative_hook.z.so,在设备上的路径是/system/lib64/,那么在本地选择的文件夹内也需要保证路径是import/system/lib64/libnative_hook.z.so。 -![GitHub Logo](../../figures/ImportSo/so_import_dir.jpg) -以NativeMemory举例,导入NativeMemory文件,点击Call info的Tab页,在搜索框中输入libnative_hook.z.so,会发现该so下的调用栈没有符号化完全。 -![GitHub Logo](../../figures/ImportSo/so_import_nativehook.jpg) -将本地编译的so通过导入按钮导入,本地导入路径是import/system/lib64/libnative_hook.z.so,红框处是导入按钮 -![GitHub Logo](../../figures/ImportSo/so_import_local.jpg) -导入so以后,在搜索框中输入libnative_hook.z.so,会发现符号化数据已经更新 -![GitHub Logo](../../figures/ImportSo/so_import_new.jpg) \ 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) ![GitHub Logo](../../figures/Jsmemory/js_sample.png) -+ 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页,主要显示了比较视图,显示两份快照间的不同之处,主要比较类创建与释放的实例数量。 ![GitHub Logo](../../figures/Jsmemory/JsComparison.jpg) 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。
+ GitHub Logo
+ 以NativeMemory举例,导入NativeMemory文件,点击Call info的Tab页,在搜索框中输入libnative_hook.z.so,会发现该so下的调用栈没有符号化完全。
+ GitHub Logo
+ 将本地编译的so通过导入按钮导入,本地导入路径是import/system/lib64/libnative_hook.z.so,红框处是导入按钮
+ GitHub Logo
+ 导入so以后,在搜索框中输入libnative_hook.z.so,会发现符号化数据已经更新
+ GitHub Logo

+

网页连接文件打开接口

+ +

网页连接文件打开接口可以在网址后增加文件地址,打开后直接打开trace。
+ 接口的url路径如下:
+ GitHub Logo

+ + +
+ + + + + + \ 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。
- GitHub Logo
- 以NativeMemory举例,导入NativeMemory文件,点击Call info的Tab页,在搜索框中输入libnative_hook.z.so,会发现该so下的调用栈没有符号化完全。
- GitHub Logo
- 将本地编译的so通过导入按钮导入,本地导入路径是import/system/lib64/libnative_hook.z.so,红框处是导入按钮
- GitHub Logo
- 导入so以后,在搜索框中输入libnative_hook.z.so,会发现符号化数据已经更新
- GitHub Logo

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。
    - GitHub Logo
  • +

    例如下图其中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)
    + GitHub Logo

    +
  • -
    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; let fileHandler = child[0].fileHandler; if (fileHandler && !SpRecordTrace.stopRecord) { + this.recordButtonText!.textContent = this.record this.freshMenuDisable(false); this.freshConfigMenuDisable(false); fileHandler({ detail: file }); @@ -1045,7 +1047,7 @@ export class SpRecordTrace extends BaseElement { }); } else { this.litSearch!.setPercent('tracing htrace failed, please check your config ', -2); - this.traceCommand!.show = false; + this.recordButtonText!.textContent = this.record this.freshMenuDisable(false); this.freshConfigMenuDisable(false); this.progressEL!.loading = false; @@ -1075,14 +1077,12 @@ export class SpRecordTrace extends BaseElement { this.litSearch!.clear(); this.litSearch!.setPercent('tracing ' + this.recordSetting!.maxDur * 1000 + 'ms', -1); this.buttonDisable(true); - this.traceCommand!.show = true; this.freshMenuDisable(true); this.freshConfigMenuDisable(true); HdcDeviceManager.shellResultAsString(CmdConstant.CMD_SHELL + traceCommandStr, false).then( (traceResult) => { let re = this.isSuccess(traceResult); if (re == 0) { - this.traceCommand!.show = false; this.litSearch!.setPercent('tracing htrace down', -1); HdcDeviceManager.shellResultAsString( CmdConstant.CMD_TRACE_FILE_SIZE + this.recordSetting!.output, @@ -1117,6 +1117,7 @@ export class SpRecordTrace extends BaseElement { }); }); } else { + this.recordButtonText!.textContent = this.record this.litSearch!.setPercent('htrace file is too big', -2); } }); @@ -1142,7 +1143,6 @@ export class SpRecordTrace extends BaseElement { }); }); } catch (e) { - this.traceCommand!.show = false; this.freshMenuDisable(false); this.freshConfigMenuDisable(false); this.buttonDisable(false); @@ -1158,7 +1158,6 @@ export class SpRecordTrace extends BaseElement { private initRecordUIState() { this.buttonDisable(true); - this.traceCommand!.show = true; this.freshMenuDisable(true); this.freshConfigMenuDisable(true); } @@ -1527,7 +1526,7 @@ export class SpRecordTrace extends BaseElement { Disconnect Record + border_radius="16px" back='#0A59F7' opacity="0.6" border="0 solid">Record
    @@ -1875,10 +1874,8 @@ export class SpRecordTrace extends BaseElement { querySelectors!.forEach((item) => { if (disable) { item.style.pointerEvents = 'none'; - this.traceCommand!.show = true; } else { item.style.pointerEvents = 'auto'; - this.traceCommand!.show = false; } item.disabled = disable; }); @@ -1895,13 +1892,13 @@ export class SpRecordTrace extends BaseElement { buttonDisable(disable: boolean) { if (disable) { this.disconnectButton!.style.pointerEvents = 'none'; - this.recordButton!.style.pointerEvents = 'none'; + this.recordButtonText!.textContent = this.stop; this.addButton!.style.pointerEvents = 'none'; this.deviceSelect!.style.pointerEvents = 'none'; this.deviceVersion!.style.pointerEvents = 'none'; } else { + this.recordButtonText!.textContent = this.record this.disconnectButton!.style.pointerEvents = 'auto'; - this.recordButton!.style.pointerEvents = 'auto'; this.addButton!.style.pointerEvents = 'auto'; this.deviceSelect!.style.pointerEvents = 'auto'; this.deviceVersion!.style.pointerEvents = 'auto'; diff --git a/ide/src/trace/component/SpSystemTrace.ts b/ide/src/trace/component/SpSystemTrace.ts index 6108b07b74eeaa0df93e742b0a8e239b7ee4347a..2424b12b13a3b07841bb61145a6342dfd3f4e3cf 100644 --- a/ide/src/trace/component/SpSystemTrace.ts +++ b/ide/src/trace/component/SpSystemTrace.ts @@ -145,6 +145,7 @@ export class SpSystemTrace extends BaseElement { this.linkNodes.length = 0; } + initElements(): void { this.rowsEL = this.shadowRoot?.querySelector('.rows'); this.tipEL = this.shadowRoot?.querySelector('.tip'); @@ -205,29 +206,9 @@ export class SpSystemTrace extends BaseElement { if (this.rowsEL!.contains(currentRow)) { this.rowsEL!.replaceChild(replaceRow, currentRow); } else { - for (let index = 0; index < currentRow.familyGenealogy.length; index++) { - let family = currentRow.familyGenealogy[index]; - let parent = this.rowsEL!.querySelector>( - `trace-row[row-id='${family.rowId}'][row-type='${family.rowType}']` - ); - if (parent) { - while ( - parent!.folder && - index < currentRow.familyGenealogy.length && - currentRow.familyGenealogy.length > 1 - ) { - let child: TraceRow = parent!.childrenList.filter((chd) => { - let genealogy = currentRow.familyGenealogy[index + 1]; - return chd.rowId == genealogy.rowId && chd.rowType == genealogy.rowType; - })[0]; - if (child) { - parent = child; - } else { - break; - } - } - parent!.replaceTraceRow(replaceRow, currentRow); - } + if (currentRow.hasParentRowEl) { + let parent = currentRow.parentRowEl; + parent!.replaceTraceRow(replaceRow, currentRow); } } this.favoriteRowsEL!.append(currentRow); @@ -239,13 +220,14 @@ export class SpSystemTrace extends BaseElement { this.collectRows.splice(rowIndex, 1); } } - currentRow.familyGenealogy.forEach((relationship:{rowId:any, rowType:any}) => { - let parentRow = this.rowsEL!.querySelector>( - `trace-row[row-id='${relationship.rowId}'][row-type='${relationship.rowType}'][folder]`); - if (parentRow) { - parentRow.expansion = true; + let row = currentRow; + while (row.hasParentRowEl) { + let parent = row.parentRowEl; + if (!parent.expansion && parent.hasAttribute('scene')) { + parent.expansion = true; } - }); + row = parent; + } let replaceRow = this.rowsEL!.querySelector( `div[row-id='${currentRow.rowId}-${currentRow.rowType}']` ); @@ -394,6 +376,7 @@ export class SpSystemTrace extends BaseElement { if (!it.expansion) { processChildRows = [...it.childrenList]; } + selection.processIds.push(parseInt(it.rowId!)); processChildRows.forEach((th) => { th.rangeSelect = true; th.checkType = '2'; @@ -424,13 +407,17 @@ export class SpSystemTrace extends BaseElement { th.rangeSelect = true; th.checkType = '2'; if (th.getAttribute('heap-type') === 'native_hook_statistic') { - selection.nativeMemoryStatistic.push(it.rowId!); + selection.nativeMemoryStatistic.push(th.rowId!); } else { - selection.nativeMemory.push(it.rowId!); + selection.nativeMemory.push(th.rowId!); } }); info('load nativeMemory traceRow id is : ', it.rowId); } else if (it.rowType == TraceRow.ROW_TYPE_THREAD) { + let pid = parseInt(it.rowParentId!); + if (!selection.processIds.includes(pid)) { + selection.processIds.push(pid) + } selection.threadIds.push(parseInt(it.rowId!)); info('load thread traceRow id is : ', it.rowId); } else if (it.rowType == TraceRow.ROW_TYPE_FUNC) { @@ -1797,7 +1784,7 @@ export class SpSystemTrace extends BaseElement { endParentRow = this.shadowRoot?.querySelector>( `trace-row[row-id='frameTime'][folder]` ); - endParentRow.childrenList.forEach((item: TraceRow) => { + endParentRow?.childrenList?.forEach((item: TraceRow) => { if (item.rowId === 'actual frameTime' && item.rowType === 'janks') { endRowStruct = item; } @@ -2079,25 +2066,17 @@ export class SpSystemTrace extends BaseElement { window.subscribe(window.SmartEvent.UI.UploadSOFile, (data) => { this.chartManager?.importSoFileUpdate().then(() => { window.publish(window.SmartEvent.UI.Loading, false); - if ( - this.selectionParam && - (this.selectionParam.nativeMemory.length > 0 || - this.selectionParam.nativeMemoryStatistic.length > 0 || - this.selectionParam.perfSampleIds.length > 0 || - this.selectionParam.fileSystemType.length > 0 || - this.selectionParam.fsCount > 0 || - this.selectionParam.fileSysVirtualMemory || - this.selectionParam.vmCount > 0 || - this.selectionParam.diskIOLatency || - this.selectionParam.diskIOipids.length > 0) - ) { + let updateCanvas = this.traceSheetEL?.updateRangeSelect(); + if (updateCanvas) { this.refreshCanvas(true); - let param: SelectionParam = new SelectionParam(); - Object.assign(param, this.selectionParam); - this.traceSheetEL?.rangeSelect(param, true); } }); }); + window.subscribe(window.SmartEvent.UI.CheckALL,(data) => { + this.favoriteRowsEL?.querySelectorAll>(`trace-row[row-parent-id='${data.rowId}']`).forEach((it) => { + it.checkType = data.isCheck ? '2' : '0' + }); + }) } scrollToProcess(rowId: string, rowParentId: string, rowType: string, smooth: boolean = true) { @@ -2487,31 +2466,50 @@ export class SpSystemTrace extends BaseElement { } scrollToActFunc(funcStract: any, highlight: boolean) { + const toTargetDepth = (entry: any) => { + this.hoverStructNull(); + this.selectStructNull(); + FuncStruct.hoverFuncStruct = entry; + FuncStruct.selectFuncStruct = entry; + this.onClickHandler(TraceRow.ROW_TYPE_FUNC); + this.scrollToDepth(`${funcRowID}`, `${funcStract.pid}`, funcStract.type, true, funcStract.depth || 0); + }; let funcRowID = funcStract.cookie == null ? funcStract.tid : `${funcStract.funName}-${funcStract.pid}`; + let targetRow = this.favoriteRowsEL!.querySelector>(`trace-row[row-id='${funcRowID}'][row-type='func']`); + if (targetRow) { + //如果目标泳道图在收藏上面,则跳转至收藏 + let searchEntry = targetRow!.dataList!.find((dat) => dat.startTs === funcStract.startTime); + toTargetDepth(searchEntry); + return; + } let parentRow = this.shadowRoot!.querySelector>(`trace-row[row-id='${funcStract.pid}'][folder]`); if (!parentRow) { return; } let filterRow = parentRow.childrenList.filter((child) => child.rowId == funcRowID && child.rowType == 'func')[0]; - if (filterRow == null) return; + if (filterRow == null) { + let funcRow = this.shadowRoot?.querySelector>(`trace-row[row-id='${funcRowID}'][row-type='func']`); + if (funcRow) { + filterRow = funcRow; + } else { + return; + } + } filterRow!.highlight = highlight; this.closeAllExpandRows(funcStract.pid); let row = this.shadowRoot!.querySelector>(`trace-row[row-id='${funcStract.pid}'][folder]`); if (row && !row.expansion) { row.expansion = true; } - let completeEntry = () => { - let searchEntry = filterRow!.dataList!.find((dat) => dat.startTs === funcStract.startTime); - this.hoverStructNull(); - this.selectStructNull(); - FuncStruct.hoverFuncStruct = searchEntry; - FuncStruct.selectFuncStruct = searchEntry; - this.onClickHandler(TraceRow.ROW_TYPE_FUNC); - this.scrollToDepth(`${funcRowID}`, `${funcStract.pid}`, funcStract.type, true, funcStract.depth || 0); + const completeEntry = () => { + let entry = filterRow!.dataList!.find((dat) => dat.startTs === funcStract.startTime); + toTargetDepth(entry); }; if (filterRow!.isComplete) { completeEntry(); } else { + this.scrollToProcess(`${funcStract.tid}`, `${funcStract.pid}`, 'process', false); + this.scrollToProcess(`${funcStract.tid}`, `${funcStract.pid}`, 'func', true); filterRow!.onComplete = completeEntry; } } diff --git a/ide/src/trace/component/StackBar.ts b/ide/src/trace/component/StackBar.ts index c01643a3e61bb66416dc2e99ea29532ad948955a..1972638e1287db0f6dc908dc9aec70e4f5d65332 100644 --- a/ide/src/trace/component/StackBar.ts +++ b/ide/src/trace/component/StackBar.ts @@ -74,7 +74,7 @@ export class StackBar extends BaseElement { width: 10%;display: inline-block;overflow: hidden;white-space: nowrap;padding: 5px; margin-right: 2px;font-size: 9pt; } -
    +
    `; } diff --git a/ide/src/trace/component/chart/SpFrameTimeChart.ts b/ide/src/trace/component/chart/SpFrameTimeChart.ts index 84b0731b9e1476dcd82d966dbad8c201087f945b..725b64abf62d1191a78c17929e36e95c490b0425 100644 --- a/ide/src/trace/component/chart/SpFrameTimeChart.ts +++ b/ide/src/trace/component/chart/SpFrameTimeChart.ts @@ -115,6 +115,7 @@ export class SpFrameTimeChart { expectedTimeLineRow.style.height = `40px`; expectedTimeLineRow.style.height = `${maxHeight}px`; expectedTimeLineRow.name = `Expected Timeline`; + expectedTimeLineRow.addTemplateTypes('FrameTimeline'); expectedTimeLineRow.setAttribute('height', `${maxHeight}`); expectedTimeLineRow.setAttribute('children', ''); expectedTimeLineRow.supplier = () => @@ -184,6 +185,7 @@ export class SpFrameTimeChart { actualTimeLineRow.style.width = `100%`; actualTimeLineRow.style.height = `${maxHeight}px`; actualTimeLineRow.name = `Actual Timeline`; + actualTimeLineRow.addTemplateTypes('FrameTimeline'); actualTimeLineRow.setAttribute('height', `${maxHeight}`); actualTimeLineRow.setAttribute('children', ''); actualTimeLineRow.dataList = frameActualData; diff --git a/ide/src/trace/component/chart/SpProcessChart.ts b/ide/src/trace/component/chart/SpProcessChart.ts index 4dc65880f32dccb8ff27e9c34966fbef522c9fdc..d24fd46e5eea73cfe280a47037f0dcda924b09e4 100644 --- a/ide/src/trace/component/chart/SpProcessChart.ts +++ b/ide/src/trace/component/chart/SpProcessChart.ts @@ -289,6 +289,7 @@ export class SpProcessChart { expectedRow.setAttribute('height', `${maxHeight}`); expectedRow.setAttribute('frame_type', expectedData[0].frame_type); expectedRow.name = `Expected Timeline`; + expectedRow.addTemplateTypes('FrameTimeline'); expectedRow.setAttribute('children', ''); expectedRow.supplier = () => new Promise((resolve) => { @@ -352,6 +353,7 @@ export class SpProcessChart { actualRow.style.height = `${maxHeight}px`; actualRow.setAttribute('height', `${maxHeight}`); actualRow.name = `Actual Timeline`; + actualRow.addTemplateTypes('FrameTimeline'); actualRow.setAttribute('frame_type', actualData[0].frame_type); actualRow.setAttribute('children', ''); actualRow.dataList = actualData; diff --git a/ide/src/trace/component/setting/SpProbesConfig.ts b/ide/src/trace/component/setting/SpProbesConfig.ts index d3f8003decee3037efd9f8d7584611ce69b276b9..ff441c612a0707e17f1f8bfdbb646531d60fbb60 100644 --- a/ide/src/trace/component/setting/SpProbesConfig.ts +++ b/ide/src/trace/component/setting/SpProbesConfig.ts @@ -50,7 +50,7 @@ export class SpProbesConfig extends BaseElement { if (this.ftraceBufferSizeResult?.hasAttribute('percent')) { return Number(this.ftraceBufferSizeResult?.getAttribute('percent')); } - return 1024; + return 20480; } get memoryConfig() { @@ -264,9 +264,9 @@ export class SpProbesConfig extends BaseElement { let ftraceBufferSizeSlider = this.shadowRoot?.querySelector('#ftrace-buff-size-slider') as LitSlider; this.ftraceBufferSizeResult = this.shadowRoot?.querySelector('#ftrace-buff-size-div') as HTMLDivElement; ftraceBufferSizeSlider.sliderStyle = { - minRange: 1024, - maxRange: 65536, - defaultValue: '1024', + minRange: 2048, + maxRange: 307200, + defaultValue: '20480', resultUnit: 'KB', stepSize: 2, lineColor: 'var(--dark-color3,#46B1E3)', @@ -280,10 +280,10 @@ export class SpProbesConfig extends BaseElement { if (this.ftraceBufferSizeResult!.hasAttribute('percent')) { ftraceBuffSizeResultInput.value = Number(this.ftraceBufferSizeResult!.getAttribute('percent')).toString(); } else { - ftraceBuffSizeResultInput.value = '1024'; + ftraceBuffSizeResultInput.value = '20480'; } }); - ftraceBufferSizeSliderParent.setAttribute('percent', '1024'); + ftraceBufferSizeSliderParent.setAttribute('percent', '20480'); ftraceBuffSizeResultInput.style.color = 'var(--dark-color1,#000000)'; ftraceBuffSizeResultInput.addEventListener('input', (ev) => { if (this.ftraceBufferSizeResult!.hasAttribute('percent')) { @@ -294,7 +294,7 @@ export class SpProbesConfig extends BaseElement { ftraceBuffSizeResultInput.style.backgroundColor = 'var(--dark-background5,#F2F2F2)'; if (ftraceBuffSizeResultInput.value.trim() == '') { ftraceBuffSizeResultInput.style.color = 'red'; - ftraceBufferSizeSliderParent.setAttribute('percent', '1024'); + ftraceBufferSizeSliderParent.setAttribute('percent', '20480'); return; } let ftraceBufferSize = Number(ftraceBuffSizeResultInput.value); @@ -303,7 +303,7 @@ export class SpProbesConfig extends BaseElement { ftraceBufferSize > ftraceBufferSizeSlider!.sliderStyle.maxRange ) { ftraceBuffSizeResultInput.parentElement!.classList.add('border-red'); - ftraceBufferSizeSliderParent.setAttribute('percent', '1024'); + ftraceBufferSizeSliderParent.setAttribute('percent', '20480'); } else { ftraceBuffSizeResultInput.parentElement!.classList.remove('border-red'); ftraceBufferSizeSlider!.percent = ftraceBuffSizeResultInput.value; @@ -316,8 +316,8 @@ export class SpProbesConfig extends BaseElement { ftraceBuffSizeResultInput.addEventListener('focusout', (ev) => { if (ftraceBuffSizeResultInput.value.trim() == '') { ftraceBuffSizeResultInput.parentElement!.classList.remove('border-red'); - ftraceBufferSizeSliderParent.setAttribute('percent', '1024'); - ftraceBuffSizeResultInput.value = '1024'; + ftraceBufferSizeSliderParent.setAttribute('percent', '20480'); + ftraceBuffSizeResultInput.value = '20480'; ftraceBuffSizeResultInput.style.color = 'var(--dark-color,#6a6f77)'; ftraceBufferSizeSliderParent.setAttribute('percent', ftraceBuffSizeResultInput.value); ftraceBufferSizeSliderParent.setAttribute('percentValue', ftraceBuffSizeResultInput.value); @@ -472,13 +472,13 @@ export class SpProbesConfig extends BaseElement {

    Buffer Size

    -

    The ftrace buffer size range is 1024 Kb to 65536 KB

    +

    The ftrace buffer size range is 2048 KB to 307200 KB

    - + KB
    diff --git a/ide/src/trace/component/setting/SpSdkConfig.ts b/ide/src/trace/component/setting/SpSdkConfig.ts index 0c13506b99c82901b85a59640746bb658ce29a70..2a1b0c10c81c1319cc95485e832ed916040d7540 100644 --- a/ide/src/trace/component/setting/SpSdkConfig.ts +++ b/ide/src/trace/component/setting/SpSdkConfig.ts @@ -163,6 +163,10 @@ export class SpSdkConfig extends BaseElement { }) .catch((err) => {}); if (this.worker == null) { + // @ts-ignore + if (window.useWb) { + return; + } this.worker = new Worker('trace/database/ConfigWorker.js'); } } catch (e) {} diff --git a/ide/src/trace/component/setting/SpTraceCommand.ts b/ide/src/trace/component/setting/SpTraceCommand.ts index e461f92d05a903ed294e313672b72bc6ecf91770..257e41da5f1857e25bee239351ea353fd91777ca 100644 --- a/ide/src/trace/component/setting/SpTraceCommand.ts +++ b/ide/src/trace/component/setting/SpTraceCommand.ts @@ -24,18 +24,6 @@ export class SpTraceCommand extends BaseElement { private copyEl: HTMLElement | undefined | null; private codeCopyText: HTMLInputElement | undefined; - set show(show: boolean) { - if (show) { - this.setAttribute('show', ''); - } else { - this.removeAttribute('show'); - } - } - - get show() { - return this.hasAttribute('show'); - } - get hdcCommon(): string { return this.codeHl!.textContent + ''; } @@ -163,34 +151,12 @@ export class SpTraceCommand extends BaseElement { border-radius: 6px; background-color: var(--dark-background7,#e7c9c9); } - - #stop-button{ - display: none; - border-radius: 15px; - background-color: #0A59F7; - width: 120px; - height: 32px; - font-family: Helvetica-Bold; - font-size: 14px; - color: #FFFFFF; - text-align: center; - line-height: 20px; - margin-left: 80%; - border: 1px solid #FFFFFF; - opacity: 0.6; - cursor:pointer; - } - - :host([show]) #stop-button { - display: block - }
    -
    `; } diff --git a/ide/src/trace/component/trace/base/Extension.ts b/ide/src/trace/component/trace/base/Extension.ts index 5f6bb585b0b315a90121bddcb5988ad795c30412..c5eb55e619c0bfa732097013d331b0cf1077c54f 100644 --- a/ide/src/trace/component/trace/base/Extension.ts +++ b/ide/src/trace/component/trace/base/Extension.ts @@ -49,6 +49,8 @@ declare global { KeyboardEnable: string; // SystemTrace Keyboard enable UploadSOFile: string; // Upload so file Loading: string; // Upload so file + Error: string; // load error + CheckALL: string; // Check all child chart }; }; @@ -95,6 +97,8 @@ window.SmartEvent = { KeyboardEnable: 'SmartEvent-UI-StopWASD', UploadSOFile: 'SmartEvent-UI-UploadSoFile', Loading: 'SmartEvent-UI-Loading', + Error: 'SmartEvent-UI-Error', + CheckALL: 'SmartEvent-UI-CheckALL' }, }; Window.prototype.subscribe = (ev, fn) => EventCenter.subscribe(ev, fn); diff --git a/ide/src/trace/component/trace/base/TraceRow.ts b/ide/src/trace/component/trace/base/TraceRow.ts index 95118858a864a862ac77a602ee02c86c63904ebd..fe33b4c82b56933b1239609e661a550d02fbb4b4 100644 --- a/ide/src/trace/component/trace/base/TraceRow.ts +++ b/ide/src/trace/component/trace/base/TraceRow.ts @@ -28,6 +28,7 @@ import { LitPopover } from '../../../../base-ui/popover/LitPopoverV.js'; import { info } from '../../../../log/Log.js'; import { ColorUtils } from './ColorUtils.js'; import { drawSelectionRange } from '../../../database/ui-worker/ProcedureWorkerCommon.js'; +import { TraceRowConfig } from './TraceRowConfig.js'; export class RangeSelectStruct { startX: number | undefined; @@ -119,6 +120,7 @@ export class TraceRow extends HTMLElement { public _frame: Rect | undefined; public isLoading: boolean = false; public readonly args: any; + public templateType: Array = []; private rootEL: HTMLDivElement | null | undefined; private nameEL: HTMLLabelElement | null | undefined; private _rangeSelect: boolean = false; @@ -130,9 +132,7 @@ export class TraceRow extends HTMLElement { asyncFuncNamePID: number | undefined | null; translateY: number = 0; //single canvas offsetY; childrenList: Array> = []; - familyGenealogy:Array<{rowId:string | undefined | null, rowType:string | undefined | null}> = []; - - depth: number = 1; + parentRowEl: TraceRow | undefined; focusHandler?: (ev: MouseEvent) => void | undefined; constructor( @@ -186,6 +186,10 @@ export class TraceRow extends HTMLElement { ]; } + get hasParentRowEl(): boolean { + return this.parentRowEl !== undefined; + } + get rowDiscard(): boolean { return this.hasAttribute('row-discard'); } @@ -317,6 +321,10 @@ export class TraceRow extends HTMLElement { ); } + addTemplateTypes(...type:string[]) { + this.templateType.push(...type); + } + replaceTraceRow(newNode:any, oldNode:any) { let oldIndex = this.childrenList.indexOf(oldNode); if (oldIndex != -1) { @@ -324,26 +332,29 @@ export class TraceRow extends HTMLElement { } } - addChildTraceRow(child: TraceRow) { - this.addFamilyGenealogy(child); - this.depth = 2; - if (child.rowType == TraceRow.ROW_TYPE_HIPERF_PROCESS) { - this.depth = 3; + toParentAddTemplateType = (currentRowEl: TraceRow) => { + let parentRow = currentRowEl.parentRowEl; + if (parentRow !== undefined) { + parentRow.templateType.push(...currentRowEl.templateType); + if (parentRow.parentRowEl !== undefined) { + this.toParentAddTemplateType(parentRow); + } } - this.childrenList.push(child); } - private addFamilyGenealogy(child: TraceRow) { - if (this.familyGenealogy.length > 0) { - child.familyGenealogy.push(...this.familyGenealogy) - } - child.familyGenealogy.push({rowId:this.rowId,rowType:this.rowType}) + addChildTraceRow(child: TraceRow) { + TraceRowConfig.allTraceRowList.push(child); + child.parentRowEl = this; + this.toParentAddTemplateType(child); + child.setAttribute('scene', ''); + this.childrenList.push(child); } addChildTraceRowAfter(child: TraceRow, targetRow: TraceRow) { - this.depth = 2; - this.addFamilyGenealogy(child); + TraceRowConfig.allTraceRowList.push(child); + child.parentRowEl = this; let index = this.childrenList.indexOf(targetRow); + child.setAttribute('scene', ''); if (index != -1) { this.childrenList.splice(index + 1, 0, child); } else { @@ -352,7 +363,9 @@ export class TraceRow extends HTMLElement { } addChildTraceRowSpecifyLocation(child: TraceRow, index: number) { - this.addFamilyGenealogy(child); + TraceRowConfig.allTraceRowList.push(child); + child.parentRowEl = this; + child.setAttribute('scene', ''); this.childrenList.splice(index, 0, child); } insertAfter(newEl: DocumentFragment, targetEl: HTMLElement) { @@ -442,6 +455,9 @@ export class TraceRow extends HTMLElement { this.checkBoxEL!.indeterminate = false; break; } + if (this.folder) { + this.childrenList.forEach(it => it.checkType = value) + } } get drawType(): number { @@ -691,10 +707,17 @@ export class TraceRow extends HTMLElement { setCheckBox(isCheck: boolean) { if (this.folder) { + // favorite row check change; + window.publish(window.SmartEvent.UI.CheckALL,{ + rowId: this.rowId, + isCheck: isCheck + }); this.childrenList!.forEach((ck) => { ck.setAttribute('check-type', isCheck ? '2' : '0'); let allCheck: LitCheckBox | null | undefined = ck?.shadowRoot?.querySelector('.lit-check-box'); - allCheck!.checked = isCheck; + if (allCheck) { + allCheck!.checked = isCheck; + } }); } else if (this.rowParentId == '' && !this.folder) { let traceRowList: Array> = []; @@ -731,12 +754,9 @@ export class TraceRow extends HTMLElement { return it.checkType === '0'; }); } - let parentRow = this.parentElement?.querySelector>( - `trace-row[row-id='${this.folder ? this.rowId : this.rowParentId}'][folder]` - ); - let parentCheck: LitCheckBox | null | undefined = parentRow?.shadowRoot?.querySelector('.lit-check-box'); + let parentCheck: LitCheckBox | null | undefined = this.parentRowEl?.shadowRoot?.querySelector('.lit-check-box'); if (unselectedList?.length == 0 && unselectedList.length === 0) { - parentRow?.setAttribute('check-type', '2'); + this.parentRowEl?.setAttribute('check-type', '2'); if (parentCheck) { parentCheck!.checked = true; parentCheck!.indeterminate = false; @@ -752,7 +772,7 @@ export class TraceRow extends HTMLElement { it.draw(); }); } else { - parentRow?.setAttribute('check-type', '1'); + this.parentRowEl?.setAttribute('check-type', '1'); if (parentCheck) { parentCheck!.checked = false; parentCheck!.indeterminate = true; @@ -780,7 +800,7 @@ export class TraceRow extends HTMLElement { } if (checkList?.length == 0 && checkList2?.length === 0) { - parentRow?.setAttribute('check-type', '0'); + this.parentRowEl?.setAttribute('check-type', '0'); if (parentCheck) { parentCheck!.checked = false; parentCheck!.indeterminate = false; diff --git a/ide/src/trace/component/trace/base/TraceRowConfig.ts b/ide/src/trace/component/trace/base/TraceRowConfig.ts index c40f91b1ff0a36abc84fb5fcf340f823d69eab1c..5717e24ad650610eee707f4b965b2de0d1240873 100644 --- a/ide/src/trace/component/trace/base/TraceRowConfig.ts +++ b/ide/src/trace/component/trace/base/TraceRowConfig.ts @@ -24,16 +24,13 @@ import { CpuStruct } from '../../../database/ui-worker/ProcedureWorkerCPU.js'; @element('trace-row-config') export class TraceRowConfig extends BaseElement { - selectTypeList: Array | undefined; + static allTraceRowList: Array> = []; + selectTypeList: Array | undefined = []; private spSystemTrace: SpSystemTrace | null | undefined; private sceneTable: HTMLDivElement | null | undefined; private chartTable: HTMLDivElement | null | undefined; private inputElement: HTMLInputElement | null | undefined; - private allTraceRowList: any; private traceRowList: NodeListOf> | undefined; - private selectTypeMap: any = {}; - private selectTypeOption: any = {}; - private sceneRowList: any; get value() { return this.getAttribute('value') || ''; @@ -48,237 +45,160 @@ export class TraceRowConfig extends BaseElement { } init() { - let sceneList = [ - { - title: 'Frame timeline', - name: 'janks', - }, - ]; - this.sceneRowList = []; + let sceneList = ['FrameTimeline']; this.selectTypeList = []; this.sceneTable!.innerHTML = ''; this.chartTable!.innerHTML = ''; - this.allTraceRowList = []; this.spSystemTrace = this.parentElement!.querySelector('sp-system-trace'); - let parentRows = - this.spSystemTrace!.shadowRoot?.querySelector('div[class=rows]')!.querySelectorAll>('trace-row[row-parent-id=""]'); - if (parentRows && parentRows.length > 0) { - parentRows.forEach((traceRow: TraceRow) => { - let temporaryRows: Array> = traceRow.childrenList; - let temporary: Array> = []; - traceRow.setAttribute('scene', ''); - this.allTraceRowList.push(traceRow); - for (let index = 1; index < traceRow.depth; index++) { - temporary = []; - for (let childIndex = 0; childIndex < temporaryRows.length; childIndex++) { - let childrenListEl = temporaryRows[childIndex]; - childrenListEl.setAttribute('scene', ''); - this.allTraceRowList.push(childrenListEl); - if (1 !== childrenListEl.depth) { - temporary.push(...childrenListEl.childrenList); - } - if (childIndex === temporaryRows.length - 1) { - temporaryRows = []; - temporaryRows.push(...temporary); - } - } - } - }) - } this.traceRowList = this.spSystemTrace!.shadowRoot?.querySelector('div[class=rows-pane]')!.querySelectorAll>( "trace-row[row-parent-id='']" ); - if (this.traceRowList) { - this.traceRowList!.forEach((it) => { - this.initConfigChartTable(it); - }); - } - sceneList!.forEach((it) => { - let sceneTraceRowList = this.spSystemTrace!.shadowRoot?.querySelector('div[class=rows]')!.querySelector< - TraceRow - >(`trace-row[row-type=${it.name}]`); - if (sceneTraceRowList) { - this.initConfigSceneTable(it); - let parentRow: any = {}; - let selectParentOption: any = {}; - let selectParentRow: any = {}; - this.allTraceRowList!.forEach((traceRow: TraceRow) => { - if (traceRow) { - if (traceRow.rowParentId == '') { - parentRow['parent'] = traceRow; - } - if (traceRow.rowType == it.name && !selectParentRow[traceRow.rowParentId!]) { - selectParentOption[traceRow.rowParentId!] = parentRow['parent'].name; - selectParentRow[traceRow.rowParentId!] = parentRow['parent']; - } + let allowSceneList: Array = []; + TraceRowConfig.allTraceRowList.push(...this.traceRowList!); + this.traceRowList!.forEach((traceRow: TraceRow) => { + traceRow.setAttribute('scene', ''); + if (traceRow.templateType.length > 0) { + traceRow.templateType.forEach((type) => { + if (sceneList.indexOf(type) > -1 && allowSceneList.indexOf(type) === -1) { + allowSceneList.push(type); + this.initConfigSceneTable(type); } }); - // @ts-ignore - this.selectTypeMap[it.name] = Object.values(selectParentRow); - // @ts-ignore - this.selectTypeOption[it.name] = Object.values(selectParentOption); } + this.initConfigChartTable(traceRow); }); } initConfigSceneTable(item: any) { let div = document.createElement('div'); div.className = 'scene-option-div'; - div.textContent = item.title; + div.textContent = item; let optionCheckBox: LitCheckBox = new LitCheckBox(); optionCheckBox.checked = false; optionCheckBox.style.justifySelf = 'center'; optionCheckBox.style.height = '100%'; - optionCheckBox.title = item.title; - optionCheckBox.setAttribute('rowType', item.name); + optionCheckBox.title = item; optionCheckBox.addEventListener('change', (e) => { - this.resetChartOption(item, optionCheckBox.checked); - this.resetChartTable(item, optionCheckBox.checked); + if (optionCheckBox.checked) { + this.selectTypeList!.push(item); + } else { + if (this.selectTypeList!.length > 0) { + let indexNum = this.selectTypeList!.indexOf(item); + this.selectTypeList!.splice(indexNum, 1); + } + } + this.resetChartOption(); + this.resetChartTable(); }); this.sceneTable?.append(...[div, optionCheckBox]); } initConfigChartTable(row: TraceRow) { + let templateType = ''; + if (row.templateType.length > 0) { + templateType = row.templateType.reduce((pre, cur) => pre + ':' + cur); + } let div = document.createElement('div'); div.className = 'chart-option-div chart-item'; div.textContent = row.name; - div.title = row.name; + div.title = templateType; + div.setAttribute('search_text', row.name); let optionCheckBox: LitCheckBox = new LitCheckBox(); optionCheckBox.checked = true; optionCheckBox.className = 'chart-config-check chart-item'; optionCheckBox.style.height = '100%'; optionCheckBox.style.justifySelf = 'center'; - optionCheckBox.title = row.name; - optionCheckBox.setAttribute('rowType', row.rowType || ''); + optionCheckBox.title = templateType; + optionCheckBox.setAttribute('search_text', row.name); optionCheckBox.addEventListener('change', (e) => { - if (optionCheckBox.checked) { - row.removeAttribute('row-hidden'); - row.setAttribute('scene', ''); - this.resetChildRowModel(row, true, false); - if (this.spSystemTrace!.collectRows.length > 0) { - this.spSystemTrace!.collectRows.forEach((collectRow) => { - let isParentRow = row.folder ? collectRow.rowParentId === row.rowId : collectRow.rowId === row.rowId; - if (isParentRow) { - collectRow.removeAttribute('row-hidden'); - collectRow.setAttribute('scene', ''); - } - }); - } - } else { - if (row.rowParentId == '') { - row.expansion = false; - } - row.setAttribute('row-hidden', ''); - row.removeAttribute('scene'); - this.resetChildRowModel(row, false, true); - if (this.spSystemTrace!.collectRows.length > 0) { - this.spSystemTrace!.collectRows.forEach((collectRow) => { - let isParentRow = row.folder ? collectRow.rowParentId === row.rowId : collectRow.rowId === row.rowId; - if (isParentRow) { - collectRow.removeAttribute('scene'); - collectRow.setAttribute('row-hidden', ''); - } - }); + TraceRowConfig.allTraceRowList.forEach(chartRow => { + let upParentRow = getUpParentRow(chartRow); + if (upParentRow == row) { + if (optionCheckBox.checked) { + chartRow.removeAttribute('row-hidden'); + chartRow.setAttribute('scene', ''); + } else { + chartRow.removeAttribute('scene'); + chartRow.setAttribute('row-hidden', ''); + } } - } + }); this.refreshSystemPanel(); }); + + let getUpParentRow = (currentTraceRow: TraceRow) => { + let newTraceRow = currentTraceRow; + if (currentTraceRow.hasParentRowEl) { + newTraceRow = currentTraceRow.parentRowEl!; + getUpParentRow(newTraceRow); + } + return newTraceRow; + } this.chartTable!.append(...[div, optionCheckBox]); } - resetChartOption(item: any, isCheck: boolean) { - if (isCheck) { - this.selectTypeOption[item.name].forEach((selectName: any) => { - this.selectTypeList!.push(selectName); - }); - } else { - this.selectTypeOption[item.name].forEach((name: any) => { - let selectIndex = this.selectTypeList!.indexOf(name); - delete this.selectTypeList![selectIndex]; - }); - } - this.selectTypeList = this.selectTypeList!.filter((selectName) => selectName != ''); + resetChartOption() { this.shadowRoot!.querySelectorAll('.chart-item').forEach((litCheckBox: LitCheckBox) => { - if (this.selectTypeList!.length > 0) { - litCheckBox.checked = this.selectTypeList!.indexOf(litCheckBox.title) > -1; + let isShowCheck: boolean = false; + if (this.selectTypeList!.length == 0) { + isShowCheck = true; } else { - litCheckBox.checked = true; + if (litCheckBox.title !== '') { + let divTemplateTypeList = litCheckBox.title.split(':'); + for (let index = 0; index < divTemplateTypeList.length; index++) { + let type = divTemplateTypeList[index]; + if (this.selectTypeList!.indexOf(type) > -1) { + isShowCheck = true; + break; + } + } + } } + litCheckBox.checked = isShowCheck; }); } - resetChartTable(item: any, isCheck: boolean) { - let favoriteRowList = this.spSystemTrace?.favoriteRowsEL?.querySelectorAll>('trace-row'); - if (this.selectTypeList!.length > 0) { - this.traceRowList!.forEach((traceRow) => { - if (this.selectTypeList!.indexOf(traceRow.name) > -1) { + resetChartTable() { + if (this.traceRowList && this.traceRowList.length > 0) { + TraceRowConfig.allTraceRowList.forEach((traceRow: TraceRow) => { + let isShowRow: boolean = false; + if (this.selectTypeList!.length == 0) { traceRow.removeAttribute('row-hidden'); - this.resetChildRowModel(traceRow, true, false); + traceRow.setAttribute('scene', ''); } else { - traceRow.setAttribute('row-hidden', ''); - if (traceRow.expansion) { - traceRow.removeAttribute('expansion'); + for (let index = 0; index < traceRow.templateType!.length; index++) { + let type = traceRow.templateType![index]; + if (this.selectTypeList!.indexOf(type) > -1) { + isShowRow = true; + break; + } } - this.resetChildRowModel(traceRow, false, true); - } - }); - favoriteRowList!.forEach((traceRow) => { - if (traceRow.rowType == item.name) { - traceRow.removeAttribute('row-hidden'); - if (isCheck) { - traceRow.setAttribute('scene', ''); + if (isShowRow) { + if (traceRow.templateType.length > 0) { + traceRow.expansion = false; + traceRow.removeAttribute('row-hidden'); + traceRow.setAttribute('scene', ''); + } } else { traceRow.removeAttribute('scene'); - } - } else { - traceRow.setAttribute('row-hidden', ''); - if (isCheck) { - traceRow.removeAttribute('scene'); - } else { - traceRow.setAttribute('scene', ''); + traceRow.setAttribute('row-hidden', ''); } } }); - } else { - this.traceRowList!.forEach((traceRow) => { - traceRow.removeAttribute('row-hidden'); - this.resetChildRowModel(traceRow, true, false); - }); - favoriteRowList!.forEach((traceRow) => { - traceRow.removeAttribute('row-hidden'); - traceRow.setAttribute('scene', ''); - }); - } - this.refreshSystemPanel(); - } - - resetChildRowModel(row: any, hasRowSceneModel: boolean, hasRowHidden: boolean = false) { - if (hasRowSceneModel) { - row.setAttribute('scene', ''); - } else { - row.removeAttribute('scene'); + this.refreshSystemPanel(); } - let sonRowList = this.spSystemTrace!.shadowRoot?.querySelector('div[class=rows]')!.querySelectorAll>( - `trace-row[row-parent-id='${row.rowId}']` - ); - sonRowList!.forEach((sonRow) => { - if (hasRowSceneModel) { - sonRow.setAttribute('scene', ''); - } else { - sonRow.removeAttribute('scene'); - } - if (hasRowHidden) { - sonRow.setAttribute('row-hidden', ''); - } - }); } refreshSystemPanel() { this.clearSearchAndFlag(); - this.spSystemTrace!.scrollToProcess('', '', '', false); + this.spSystemTrace!.rowsPaneEL!.scroll({ + top: 0 - this.spSystemTrace!.canvasPanel!.offsetHeight, + left: 0, + behavior: 'smooth', + }); this.spSystemTrace!.refreshFavoriteCanvas(); - this.spSystemTrace!.refreshCanvas(false); + this.spSystemTrace!.refreshCanvas(true); } clearSearchAndFlag() { @@ -309,7 +229,8 @@ export class TraceRowConfig extends BaseElement { this.inputElement = this.shadowRoot!.querySelector('input'); this.inputElement?.addEventListener('keyup', () => { this.shadowRoot!.querySelectorAll('.chart-item').forEach((elementOption: HTMLElement) => { - if (elementOption.title!.indexOf(this.inputElement!.value) <= -1) { + let searchText = elementOption.getAttribute('search_text') || ''; + if (searchText!.indexOf(this.inputElement!.value) <= -1) { elementOption.style.display = 'none'; } else { elementOption.style.display = 'block'; diff --git a/ide/src/trace/component/trace/base/TraceSheet.ts b/ide/src/trace/component/trace/base/TraceSheet.ts index 733c5c7adef544c0da8521838a0e80098bbb63ed..9de7f5295e4dd61f92399fa5ccacf82321f8f29c 100644 --- a/ide/src/trace/component/trace/base/TraceSheet.ts +++ b/ide/src/trace/component/trace/base/TraceSheet.ts @@ -445,7 +445,28 @@ export class TraceSheet extends BaseElement { return false; } } + } + updateRangeSelect() : boolean { + if ( + this.selection && + (this.selection.nativeMemory.length > 0 || + this.selection.nativeMemoryStatistic.length > 0 || + this.selection.perfSampleIds.length > 0 || + this.selection.fileSystemType.length > 0 || + this.selection.fsCount > 0 || + this.selection.fileSysVirtualMemory || + this.selection.vmCount > 0 || + this.selection.diskIOLatency || + this.selection.diskIOipids.length > 0) + ) { + let param: SelectionParam = new SelectionParam(); + Object.assign(param, this.selection); + this.rangeSelect(param,true); + return true; + } else { + return false; + } } showUploadSoBt(selection: SelectionParam | null | undefined) { diff --git a/ide/src/trace/component/trace/base/TraceSheetConfig.ts b/ide/src/trace/component/trace/base/TraceSheetConfig.ts index 986ad5b523d560cafdc2bdf3f64a61c0c71ebf7d..6a2f819acdd682645eee2e1a1584e6f1cd893e66 100644 --- a/ide/src/trace/component/trace/base/TraceSheetConfig.ts +++ b/ide/src/trace/component/trace/base/TraceSheetConfig.ts @@ -120,6 +120,16 @@ export let tabConfig: any = { type: TabPanePTS, require: (param: SelectionParam) => param.cpus.length > 0, }, + 'box-thread-states': { + title: 'Thread States', + type: TabPaneThreadStates, + require: (param: SelectionParam) => param.threadIds.length > 0, + }, + 'box-thread-usage': { + title: 'Thread Usage', + type: TabPaneThreadUsage, + require: (param: SelectionParam) => param.threadIds.length > 0, + }, 'box-slices': { title: 'Slices', type: TabPaneSlices, @@ -245,16 +255,7 @@ export let tabConfig: any = { type: TabPaneCounterSample, require: (param: SelectionParam) => param.cpuStateFilterIds.length > 0, }, - 'box-thread-states': { - title: 'Thread States', - type: TabPaneThreadStates, - require: (param: SelectionParam) => param.threadIds.length > 0, - }, - 'box-thread-usage': { - title: 'Thread Usage', - type: TabPaneThreadUsage, - require: (param: SelectionParam) => param.threadIds.length > 0, - }, + 'box-frequency-sample': { title: 'Cpu Frequency', type: TabPaneFrequencySample, diff --git a/ide/src/trace/component/trace/sheet/TabPaneCurrentSelection.ts b/ide/src/trace/component/trace/sheet/TabPaneCurrentSelection.ts index 47b5c3045bfe28f192575c3e206ec88475cb91e8..04196871d9fe9722abecf1a673f2d09884b0f155 100644 --- a/ide/src/trace/component/trace/sheet/TabPaneCurrentSelection.ts +++ b/ide/src/trace/component/trace/sheet/TabPaneCurrentSelection.ts @@ -124,7 +124,7 @@ export class TabPaneCurrentSelection extends BaseElement { if (data.processId) { list.push({ name: 'Thread', - value: `
    + value: `
    ${name || 'Process'} [${data.tid}]
    `, @@ -132,7 +132,7 @@ export class TabPaneCurrentSelection extends BaseElement { } else { list.push({ name: 'Thread', - value: `
    + value: `
    ${name || 'Process'} [${data.tid}]
    `, }); @@ -224,7 +224,7 @@ export class TabPaneCurrentSelection extends BaseElement { if (asyncBinderStract != undefined) { list.unshift({ name: 'Name', - value: `
    + value: `
    ${name || 'binder'}
    `, @@ -256,7 +256,7 @@ export class TabPaneCurrentSelection extends BaseElement { binderSliceId = Number(item.strValue); list.unshift({ name: 'Name', - value: `
    + value: `
    ${name || 'binder'}
    `, @@ -470,7 +470,7 @@ export class TabPaneCurrentSelection extends BaseElement { if (fromBean != null && fromBean != undefined && fromBean.pid != 0 && fromBean.tid != 0) { list.push({ name: 'wakeup from tid', - value: `
    + value: `
    ${fromBean.tid}
    `, @@ -480,7 +480,7 @@ export class TabPaneCurrentSelection extends BaseElement { wakeUps.map((e) => { list.push({ name: 'wakeup tid', - value: `
    + value: `
    ${e.tid}
    `, diff --git a/ide/src/trace/component/trace/sheet/cpu/TabPaneBoxChild.ts b/ide/src/trace/component/trace/sheet/cpu/TabPaneBoxChild.ts index fe1668219d23bc4c914c92be7fa17542b475b1cf..64e5821205c8e85289c71e188817905373cdd97a 100644 --- a/ide/src/trace/component/trace/sheet/cpu/TabPaneBoxChild.ts +++ b/ide/src/trace/component/trace/sheet/cpu/TabPaneBoxChild.ts @@ -15,12 +15,11 @@ import { BaseElement, element } from '../../../../../base-ui/BaseElement.js'; import { LitTable } from '../../../../../base-ui/table/lit-table.js'; -import { BoxJumpParam, SelectionData } from '../../../../bean/BoxSelection.js'; +import {BoxJumpParam, SelectionData} from '../../../../bean/BoxSelection.js'; import { getTabBoxChildData } from '../../../../database/SqlLite.js'; import { Utils } from '../../base/Utils.js'; import { SpSystemTrace } from '../../../SpSystemTrace.js'; import { SPTChild } from '../../../../bean/StateProcessThread.js'; -import { TraceRow } from '../../base/TraceRow.js'; import { resizeObserver } from "../SheetUtils.js"; @element('tabpane-box-child') diff --git a/ide/src/trace/component/trace/sheet/cpu/TabPaneCpuByProcess.ts b/ide/src/trace/component/trace/sheet/cpu/TabPaneCpuByProcess.ts index 7596c33b08b24a2bc1d0e0fdae9a2d0b03987438..d846f19399556cd1d3405bb9e33f03b1b87d496c 100644 --- a/ide/src/trace/component/trace/sheet/cpu/TabPaneCpuByProcess.ts +++ b/ide/src/trace/component/trace/sheet/cpu/TabPaneCpuByProcess.ts @@ -26,14 +26,21 @@ export class TabPaneCpuByProcess extends BaseElement { private cpuByProcessTbl: LitTable | null | undefined; private cpuByProcessRange: HTMLLabelElement | null | undefined; private cpuByProcessSource: Array = []; + private currentSelectionParam: SelectionParam | undefined; set data(cpuByProcessValue: SelectionParam | any) { + if (this.currentSelectionParam === cpuByProcessValue) { + return; + } + this.currentSelectionParam = cpuByProcessValue; this.cpuByProcessRange!.textContent = 'Selected range: ' + parseFloat(((cpuByProcessValue.rightNs - cpuByProcessValue.leftNs) / 1000000.0).toFixed(5)) + ' ms'; // @ts-ignore this.cpuByProcessTbl!.shadowRoot!.querySelector('.table')?.style?.height = this.parentElement!.clientHeight - 45 + 'px'; this.cpuByProcessTbl!.recycleDataSource = []; + this.cpuByProcessTbl!.loading = true; getTabCpuByProcess(cpuByProcessValue.cpus, cpuByProcessValue.leftNs, cpuByProcessValue.rightNs).then((result) => { + this.cpuByProcessTbl!.loading = false; if (result != null && result.length > 0) { log('getTabCpuByProcess size :' + result.length); let sumWall = 0.0; diff --git a/ide/src/trace/component/trace/sheet/cpu/TabPaneCpuByThread.ts b/ide/src/trace/component/trace/sheet/cpu/TabPaneCpuByThread.ts index 2b98dbfa2a11fe9405ab95df444a1c7521a0a4de..08e1fdf36a4f4f22cfa215208edd42c8bf41860b 100644 --- a/ide/src/trace/component/trace/sheet/cpu/TabPaneCpuByThread.ts +++ b/ide/src/trace/component/trace/sheet/cpu/TabPaneCpuByThread.ts @@ -27,6 +27,7 @@ export class TabPaneCpuByThread extends BaseElement { private cpuByThreadTbl: LitTable | null | undefined; private range: HTMLLabelElement | null | undefined; private cpuByThreadSource: Array = []; + private currentSelectionParam: SelectionParam | undefined; private pubColumns = ` @@ -45,10 +46,16 @@ export class TabPaneCpuByThread extends BaseElement { `; set data(cpuByThreadValue: SelectionParam | any) { + if (this.currentSelectionParam === cpuByThreadValue) { + return; + } + this.currentSelectionParam = cpuByThreadValue; this.cpuByThreadTbl!.innerHTML = this.getTableColumns(cpuByThreadValue.cpus); this.range!.textContent = 'Selected range: ' + parseFloat(((cpuByThreadValue.rightNs - cpuByThreadValue.leftNs) / 1000000.0).toFixed(5)) + ' ms'; + this.cpuByThreadTbl!.loading = true; getTabCpuByThread(cpuByThreadValue.cpus, cpuByThreadValue.leftNs, cpuByThreadValue.rightNs).then((result) => { + this.cpuByThreadTbl!.loading = false; if (result != null && result.length > 0) { log('getTabCpuByThread size :' + result.length); let sumWall = 0.0; diff --git a/ide/src/trace/component/trace/sheet/cpu/TabPaneCpuUsage.ts b/ide/src/trace/component/trace/sheet/cpu/TabPaneCpuUsage.ts index 71f729df8d885f80fc41e1bb9c07af8603115338..1a560188980fa27a49cca7066932904731098f32 100644 --- a/ide/src/trace/component/trace/sheet/cpu/TabPaneCpuUsage.ts +++ b/ide/src/trace/component/trace/sheet/cpu/TabPaneCpuUsage.ts @@ -25,16 +25,23 @@ export class TabPaneCpuUsage extends BaseElement { private cpuUsageTbl: LitTable | null | undefined; private range: HTMLLabelElement | null | undefined; private orderByOldList: any[] = []; + private currentSelectionParam: SelectionParam | undefined; set data(cpuUsageValue: SelectionParam | any) { + if (this.currentSelectionParam === cpuUsageValue) { + return; + } + this.currentSelectionParam = cpuUsageValue; // @ts-ignore this.cpuUsageTbl?.shadowRoot.querySelector('.table').style.height = this.parentElement.clientHeight - 45 + 'px'; this.range!.textContent = 'Selected range: ' + parseFloat(((cpuUsageValue.rightNs - cpuUsageValue.leftNs) / 1000000.0).toFixed(5)) + ' ms'; + this.cpuUsageTbl!.loading = true; Promise.all([ getTabCpuUsage(cpuUsageValue.cpus, cpuUsageValue.leftNs, cpuUsageValue.rightNs), getTabCpuFreq(cpuUsageValue.cpus, cpuUsageValue.leftNs, cpuUsageValue.rightNs), ]).then((result) => { + this.cpuUsageTbl!.loading = false; let usages = result[0]; let freqMap = this.groupByCpuToMap(result[1]); let data = []; diff --git a/ide/src/trace/component/trace/sheet/cpu/TabPanePTS.ts b/ide/src/trace/component/trace/sheet/cpu/TabPanePTS.ts index 64636f8c797cbc552db9a43d41867acea53a626f..ae718541f028c7eaf6ca43e7649f54f377d5b3e7 100644 --- a/ide/src/trace/component/trace/sheet/cpu/TabPanePTS.ts +++ b/ide/src/trace/component/trace/sheet/cpu/TabPanePTS.ts @@ -60,6 +60,7 @@ export class TabPanePTS extends BaseElement { } getDataBySPT(ptsLeftNs: number, ptsRightNs: number, ptsSource: Array) { + this.ptsTbl!.loading = true; let pMap: Map = new Map(); let ptMap: Map = new Map(); let ptsMap: Map = new Map(); @@ -165,6 +166,7 @@ export class TabPanePTS extends BaseElement { } ptsArr.push(ptsValues!); } + this.ptsTbl!.loading = false; this.ptsTbl!.recycleDataSource = ptsArr; } diff --git a/ide/src/trace/component/trace/sheet/cpu/TabPaneSPT.ts b/ide/src/trace/component/trace/sheet/cpu/TabPaneSPT.ts index 3f5c573c615bb26bb6343f215de698886af1bd31..58ff50ee19e249a1b101eafa69d39ef84b134b10 100644 --- a/ide/src/trace/component/trace/sheet/cpu/TabPaneSPT.ts +++ b/ide/src/trace/component/trace/sheet/cpu/TabPaneSPT.ts @@ -56,6 +56,7 @@ export class TabPaneSPT extends BaseElement { } getDataBySPT(leftNs: number, rightNs: number, source: Array) { + this.sptTbl!.loading = true; let statesMap: Map = new Map(); let spMap: Map = new Map(); let sptMap: Map = new Map(); @@ -159,6 +160,7 @@ export class TabPaneSPT extends BaseElement { } sptArr.push(stateValue!); } + this.sptTbl!.loading = false; this.sptTbl!.recycleDataSource = sptArr; } diff --git a/ide/src/trace/component/trace/sheet/file-system/TabPaneFilesystemStatisticsAnalysis.ts b/ide/src/trace/component/trace/sheet/file-system/TabPaneFilesystemStatisticsAnalysis.ts index 6f76507f2a555eba50eea171ee3e7f39962360c4..ebfcc5631ceb0d96805a67bfc7e0b9fbc876e0dc 100644 --- a/ide/src/trace/component/trace/sheet/file-system/TabPaneFilesystemStatisticsAnalysis.ts +++ b/ide/src/trace/component/trace/sheet/file-system/TabPaneFilesystemStatisticsAnalysis.ts @@ -55,7 +55,7 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { private libStatisticsData!: any; private functionStatisticsData!: any; set data(val: SelectionParam | any) { - if (val == this.fileStatisticsAnalysisCurrentSelection) { + if (val === this.fileStatisticsAnalysisCurrentSelection) { this.fileStatisticsAnalysisPidData.unshift(this.processStatisticsData); this.fileStatisticsAnalysisTableProcess!.recycleDataSource = this.fileStatisticsAnalysisPidData; // @ts-ignore @@ -166,17 +166,7 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { angleClick: (it) => { // @ts-ignore if (it.tableName != 'other') { - this.clearData(); - this.back!.style.visibility = 'visible'; - this.fileStatisticsAnalysisTableProcess!.style.display = 'none'; - this.fileStatisticsAnalysisTableType!.style.display = 'grid'; - this.fileStatisticsAnalysisTableProcess!.setAttribute('hideDownload', ''); - this.fileStatisticsAnalysisTableType?.removeAttribute('hideDownload'); - this.getFilesystemType(it, val); - // @ts-ignore - this.fileStatisticsAnalysisProcessName = it.tableName; - this.shadowRoot!.querySelector('.title')!.textContent = this.fileStatisticsAnalysisProcessName; - this.fileStatisticsAnalysisPie?.hideTip(); + this.fileProcessLevelClickEvent(it, val); } }, hoverHandler: (data) => { @@ -215,6 +205,25 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); }); + this.fileStatisticsAnalysisTableProcess!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.duration !== 0) { + this.fileProcessLevelClickEvent(data, val); + } + }); + } + fileProcessLevelClickEvent(it: any, val: any) { + this.clearData(); + this.back!.style.visibility = 'visible'; + this.fileStatisticsAnalysisTableProcess!.style.display = 'none'; + this.fileStatisticsAnalysisTableType!.style.display = 'grid'; + this.fileStatisticsAnalysisTableProcess!.setAttribute('hideDownload', ''); + this.fileStatisticsAnalysisTableType?.removeAttribute('hideDownload'); + this.getFilesystemType(it, val); + // @ts-ignore + this.fileStatisticsAnalysisProcessName = it.tableName; + this.shadowRoot!.querySelector('.title')!.textContent = this.fileStatisticsAnalysisProcessName; + this.fileStatisticsAnalysisPie?.hideTip(); } typePieChart(val: any) { this.fileStatisticsAnalysisPie!.config = { @@ -235,18 +244,7 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { `; }, angleClick: (it) => { - // @ts-ignore - this.clearData(); - this.fileStatisticsAnalysisTableType!.style.display = 'none'; - this.fileStatisticsAnalysisTableThread!.style.display = 'grid'; - this.fileStatisticsAnalysisTableType!.setAttribute('hideDownload', ''); - this.fileStatisticsAnalysisTableThread?.removeAttribute('hideDownload'); - this.getFilesystemThread(it, val); - // @ts-ignore - this.typeName = it.tableName; - this.shadowRoot!.querySelector('.title')!.textContent = - this.fileStatisticsAnalysisProcessName + ' / ' + this.typeName; - this.fileStatisticsAnalysisPie?.hideTip(); + this.fileTypeLevelClickEvent(it, val); }, hoverHandler: (data) => { if (data) { @@ -284,6 +282,25 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); }); + this.fileStatisticsAnalysisTableType!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.duration !== 0) { + this.fileTypeLevelClickEvent(data, val); + } + }); + } + fileTypeLevelClickEvent(it: any, val: any) { + this.clearData(); + this.fileStatisticsAnalysisTableType!.style.display = 'none'; + this.fileStatisticsAnalysisTableThread!.style.display = 'grid'; + this.fileStatisticsAnalysisTableType!.setAttribute('hideDownload', ''); + this.fileStatisticsAnalysisTableThread?.removeAttribute('hideDownload'); + this.getFilesystemThread(it, val); + // @ts-ignore + this.typeName = it.tableName; + this.shadowRoot!.querySelector('.title')!.textContent = + this.fileStatisticsAnalysisProcessName + ' / ' + this.typeName; + this.fileStatisticsAnalysisPie?.hideTip(); } threadPieChart(val: any) { this.sumDur = this.threadStatisticsData.allDuration; @@ -307,18 +324,7 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { angleClick: (it) => { // @ts-ignore if (it.tableName != 'other') { - this.clearData(); - this.back!.style.visibility = 'visible'; - this.fileStatisticsAnalysisTableThread!.style.display = 'none'; - this.fileStatisticsAnalysisTableSo!.style.display = 'grid'; - this.fileStatisticsAnalysisTableThread!.setAttribute('hideDownload', ''); - this.fileStatisticsAnalysisTableSo?.removeAttribute('hideDownload'); - this.getFilesystemSo(it, val); - // @ts-ignore - this.fileStatisticsAnalysisThreadName = it.tableName; - this.shadowRoot!.querySelector('.title')!.textContent = - this.fileStatisticsAnalysisProcessName + ' / ' + this.typeName + ' / ' + this.fileStatisticsAnalysisThreadName; - this.fileStatisticsAnalysisPie?.hideTip(); + this.fileThreadLevelClickEvent(it, val); } }, hoverHandler: (data) => { @@ -345,7 +351,8 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { this.fileStatisticsAnalysisPie?.showHover(); this.fileStatisticsAnalysisPie?.hideTip(); }); - this.shadowRoot!.querySelector('.title')!.textContent = this.fileStatisticsAnalysisProcessName + ' / ' + this.typeName; + this.shadowRoot!.querySelector('.title')!.textContent = + this.fileStatisticsAnalysisProcessName + ' / ' + this.typeName; this.tabName!.textContent = 'Statistic By Thread AllDuration'; this.fileStatisticsAnalysisThreadData.unshift(this.threadStatisticsData); this.fileStatisticsAnalysisTableThread!.recycleDataSource = this.fileStatisticsAnalysisThreadData; @@ -357,6 +364,26 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); }); + this.fileStatisticsAnalysisTableThread!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.duration !== 0) { + this.fileThreadLevelClickEvent(data, val); + } + }); + } + fileThreadLevelClickEvent(it: any, val: any) { + this.clearData(); + this.back!.style.visibility = 'visible'; + this.fileStatisticsAnalysisTableThread!.style.display = 'none'; + this.fileStatisticsAnalysisTableSo!.style.display = 'grid'; + this.fileStatisticsAnalysisTableThread!.setAttribute('hideDownload', ''); + this.fileStatisticsAnalysisTableSo?.removeAttribute('hideDownload'); + this.getFilesystemSo(it, val); + // @ts-ignore + this.fileStatisticsAnalysisThreadName = it.tableName; + this.shadowRoot!.querySelector('.title')!.textContent = + this.fileStatisticsAnalysisProcessName + ' / ' + this.typeName + ' / ' + this.fileStatisticsAnalysisThreadName; + this.fileStatisticsAnalysisPie?.hideTip(); } libraryPieChart(val: any) { this.sumDur = this.libStatisticsData.allDuration; @@ -380,17 +407,7 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { angleClick: (it) => { // @ts-ignore if (it.tableName != 'other') { - this.clearData(); - this.back!.style.visibility = 'visible'; - this.fileStatisticsAnalysisTableSo!.style.display = 'none'; - this.fileStatisticsAnalysisTableFunction!.style.display = 'grid'; - this.fileStatisticsAnalysisTableSo!.setAttribute('hideDownload', ''); - this.fileStatisticsAnalysisTableFunction?.removeAttribute('hideDownload'); - this.getFilesystemFunction(it, val); - this.shadowRoot!.querySelector('.title')!.textContent = - // @ts-ignore - this.fileStatisticsAnalysisProcessName + ' / ' + this.typeName + ' / ' + this.fileStatisticsAnalysisThreadName + ' / ' + it.tableName; - this.fileStatisticsAnalysisPie?.hideTip(); + this.fileSoLevelClickEvent(it, val); } }, hoverHandler: (data) => { @@ -430,6 +447,31 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); }); + this.fileStatisticsAnalysisTableSo!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.duration !== 0) { + this.fileSoLevelClickEvent(data, val); + } + }); + } + fileSoLevelClickEvent(it: any, val: any) { + this.clearData(); + this.back!.style.visibility = 'visible'; + this.fileStatisticsAnalysisTableSo!.style.display = 'none'; + this.fileStatisticsAnalysisTableFunction!.style.display = 'grid'; + this.fileStatisticsAnalysisTableSo!.setAttribute('hideDownload', ''); + this.fileStatisticsAnalysisTableFunction?.removeAttribute('hideDownload'); + this.getFilesystemFunction(it, val); + this.shadowRoot!.querySelector('.title')!.textContent = + // @ts-ignore + this.fileStatisticsAnalysisProcessName + + ' / ' + + this.typeName + + ' / ' + + this.fileStatisticsAnalysisThreadName + + ' / ' + + it.tableName; + this.fileStatisticsAnalysisPie?.hideTip(); } sortByColumn(column: string, fsaSort: number) { this.fileStatisticsAnalysisSortColumn = column; @@ -455,7 +497,7 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { if (!fsaCurrentTable) { return; } - if (fsaSort == 0) { + if (fsaSort === 0) { let fsaArr = [...this.currentLevelData]; switch (this.currentLevel) { case 0: @@ -477,12 +519,12 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { fsaCurrentTable!.recycleDataSource = fsaArr; } else { let fsaArr = [...this.currentLevelData]; - if (column == 'tableName') { + if (column === 'tableName') { fsaCurrentTable!.recycleDataSource = fsaArr.sort((a, b) => { - if (fsaSort == 1) { + if (fsaSort === 1) { if (a.tableName > b.tableName) { return 1; - } else if (a.tableName == b.tableName) { + } else if (a.tableName === b.tableName) { return 0; } else { return -1; @@ -490,20 +532,16 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { } else { if (b.tableName > a.tableName) { return 1; - } else if (a.tableName == b.tableName) { + } else if (a.tableName === b.tableName) { return 0; } else { return -1; } } }); - } else if (column == 'durFormat') { - fsaCurrentTable!.recycleDataSource = fsaArr.sort((a, b) => { - return fsaSort == 1 ? a.duration - b.duration : b.duration - a.duration; - }); - } else if (column == 'percent') { + } else if (column === 'durFormat' || column === 'percent') { fsaCurrentTable!.recycleDataSource = fsaArr.sort((a, b) => { - return fsaSort == 1 ? a.duration - b.duration : b.duration - a.v; + return fsaSort === 1 ? a.duration - b.duration : b.duration - a.duration; }); } switch (this.currentLevel) { @@ -528,7 +566,7 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { } getFilesystemProcess(val: any, result: Array) { this.fileStatisticsAnalysisProcessData = JSON.parse(JSON.stringify(result)); - if (!this.fileStatisticsAnalysisProcessData || this.fileStatisticsAnalysisProcessData.length == 0) { + if (!this.fileStatisticsAnalysisProcessData || this.fileStatisticsAnalysisProcessData.length === 0) { this.fileStatisticsAnalysisPidData = []; this.processStatisticsData = []; this.processPieChart(val); @@ -552,7 +590,7 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { let pName = ''; for (let item of value) { pName = item.processName = - item.processName == null || item.processName == undefined + item.processName === null || item.processName === undefined ? `Process(${item.pid})` : `${item.processName}(${item.pid})`; dur += item.dur; @@ -623,7 +661,7 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { let pid = item.pid; let type = item.type; let allDur = 0; - if (!this.fileStatisticsAnalysisProcessData || this.fileStatisticsAnalysisProcessData.length == 0) { + if (!this.fileStatisticsAnalysisProcessData || this.fileStatisticsAnalysisProcessData.length === 0) { return; } for (let fspItem of this.fileStatisticsAnalysisProcessData) { @@ -646,7 +684,7 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { for (let item of value) { dur += item.dur; tName = item.threadName = - item.threadName == null || item.threadName == undefined ? `Thread(${item.tid})` : `${item.threadName}`; + item.threadName === null || item.threadName === undefined ? `Thread(${item.tid})` : `${item.threadName}`; } const threadData = { tableName: tName, @@ -673,7 +711,7 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { let type = item.type; let allDur = 0; let libMap = new Map>(); - if (!this.fileStatisticsAnalysisProcessData || this.fileStatisticsAnalysisProcessData.length == 0) { + if (!this.fileStatisticsAnalysisProcessData || this.fileStatisticsAnalysisProcessData.length === 0) { return; } for (let itemData of this.fileStatisticsAnalysisProcessData) { @@ -695,7 +733,7 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { let soName = ''; for (let item of value) { dur += item.dur; - if (key == null) { + if (key === null) { item.libName = 'unkown'; } soName = item.libName; @@ -732,11 +770,16 @@ export class TabPaneFilesystemStatisticsAnalysis extends BaseElement { let libId = item.libId; let allDur = 0; let symbolMap = new Map>(); - if (!this.fileStatisticsAnalysisProcessData || this.fileStatisticsAnalysisProcessData.length == 0) { + if (!this.fileStatisticsAnalysisProcessData || this.fileStatisticsAnalysisProcessData.length === 0) { return; } for (let fsProcessData of this.fileStatisticsAnalysisProcessData) { - if (fsProcessData.pid !== pid || fsProcessData.tid !== tid || fsProcessData.type !== type || fsProcessData.libId !== libId) { + if ( + fsProcessData.pid !== pid || + fsProcessData.tid !== tid || + fsProcessData.type !== type || + fsProcessData.libId !== libId + ) { continue; } allDur += fsProcessData.dur; diff --git a/ide/src/trace/component/trace/sheet/file-system/TabPaneIOTierStatisticsAnalysis.ts b/ide/src/trace/component/trace/sheet/file-system/TabPaneIOTierStatisticsAnalysis.ts index 561d16b99e41dc3cc2eceecc9561deee4a9ba42e..7374311f9aeca85ef74fc2861411b183538e7adc 100644 --- a/ide/src/trace/component/trace/sheet/file-system/TabPaneIOTierStatisticsAnalysis.ts +++ b/ide/src/trace/component/trace/sheet/file-system/TabPaneIOTierStatisticsAnalysis.ts @@ -55,7 +55,7 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { private libStatisticsData!: any; private functionStatisticsData!: any; set data(ioTierStatisticsAnalysisSelection: SelectionParam | any) { - if (ioTierStatisticsAnalysisSelection == this.currentSelection) { + if (ioTierStatisticsAnalysisSelection === this.currentSelection) { this.pidData.unshift(this.processStatisticsData); this.tableProcess!.recycleDataSource = this.pidData; // @ts-ignore @@ -71,7 +71,11 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { this.tableFunction!.style.display = 'none'; this.iOTierStatisticsAnalysisBack!.style.visibility = 'hidden'; this.range!.textContent = - 'Selected range: ' + parseFloat(((ioTierStatisticsAnalysisSelection.rightNs - ioTierStatisticsAnalysisSelection.leftNs) / 1000000.0).toFixed(5)) + ' ms'; + 'Selected range: ' + + parseFloat( + ((ioTierStatisticsAnalysisSelection.rightNs - ioTierStatisticsAnalysisSelection.leftNs) / 1000000.0).toFixed(5) + ) + + ' ms'; this.progressEL!.loading = true; this.getDataByWorker( [ @@ -166,17 +170,7 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { angleClick: (it) => { // @ts-ignore if (it.tableName != 'other') { - this.clearData(); - this.iOTierStatisticsAnalysisBack!.style.visibility = 'visible'; - this.tableProcess!.style.display = 'none'; - this.tableType!.style.display = 'grid'; - this.tableProcess!.setAttribute('hideDownload', ''); - this.tableType?.removeAttribute('hideDownload'); - this.getIOTierType(it, val); - // @ts-ignore - this.processName = it.tableName; - this.iOTierStatisticsAnalysisPie?.hideTip(); - this.shadowRoot!.querySelector('.title')!.textContent = this.processName; + this.ioTierProcessLevelClickEvent(it, val); } }, hoverHandler: (data) => { @@ -215,6 +209,24 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); }); + this.tableProcess!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.duration !== 0) { + this.ioTierProcessLevelClickEvent(data, val); + } + }); + } + ioTierProcessLevelClickEvent(it: any, val: any) { + this.clearData(); + this.iOTierStatisticsAnalysisBack!.style.visibility = 'visible'; + this.tableProcess!.style.display = 'none'; + this.tableType!.style.display = 'grid'; + this.tableProcess!.setAttribute('hideDownload', ''); + this.tableType?.removeAttribute('hideDownload'); + this.getIOTierType(it, val); + this.processName = it.tableName; + this.iOTierStatisticsAnalysisPie?.hideTip(); + this.shadowRoot!.querySelector('.title')!.textContent = this.processName; } typePieChart(val: any) { this.iOTierStatisticsAnalysisPie!.config = { @@ -235,18 +247,7 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { `; }, angleClick: (it) => { - // @ts-ignore - this.clearData(); - this.tableType!.style.display = 'none'; - this.tableThread!.style.display = 'grid'; - this.tableType!.setAttribute('hideDownload', ''); - this.tableThread?.removeAttribute('hideDownload'); - this.getIOTierThread(it, val); - // @ts-ignore - this.typeName = it.tableName; - this.iOTierStatisticsAnalysisPie?.hideTip(); - this.shadowRoot!.querySelector('.title')!.textContent = - this.processName + ' / ' + this.typeName; + this.ioTierTypeLevelClickEvent(it, val); }, hoverHandler: (data) => { if (data) { @@ -284,6 +285,23 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); }); + this.tableType!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.duration !== 0) { + this.ioTierTypeLevelClickEvent(data, val); + } + }); + } + ioTierTypeLevelClickEvent(it: any, val: any) { + this.clearData(); + this.tableType!.style.display = 'none'; + this.tableThread!.style.display = 'grid'; + this.tableType!.setAttribute('hideDownload', ''); + this.tableThread?.removeAttribute('hideDownload'); + this.getIOTierThread(it, val); + this.typeName = it.tableName; + this.iOTierStatisticsAnalysisPie?.hideTip(); + this.shadowRoot!.querySelector('.title')!.textContent = this.processName + ' / ' + this.typeName; } threadPieChart(val: any) { this.sumDur = this.threadStatisticsData.allDuration; @@ -307,18 +325,7 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { angleClick: (it) => { // @ts-ignore if (it.tableName != 'other') { - this.clearData(); - this.iOTierStatisticsAnalysisBack!.style.visibility = 'visible'; - this.tableThread!.style.display = 'none'; - this.tableSo!.style.display = 'grid'; - this.tableThread!.setAttribute('hideDownload', ''); - this.tableSo?.removeAttribute('hideDownload'); - this.getIOTierSo(it, val); - // @ts-ignore - this.threadName = it.tableName; - this.iOTierStatisticsAnalysisPie?.hideTip(); - this.shadowRoot!.querySelector('.title')!.textContent = - this.processName + ' / ' + this.typeName + ' / ' + this.threadName; + this.ioTierThreadLevelClickEvent(it, val); } }, hoverHandler: (data) => { @@ -357,6 +364,25 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); }); + this.tableThread!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.duration !== 0) { + this.ioTierThreadLevelClickEvent(data, val); + } + }); + } + ioTierThreadLevelClickEvent(it: any, val: any) { + this.clearData(); + this.iOTierStatisticsAnalysisBack!.style.visibility = 'visible'; + this.tableThread!.style.display = 'none'; + this.tableSo!.style.display = 'grid'; + this.tableThread!.setAttribute('hideDownload', ''); + this.tableSo?.removeAttribute('hideDownload'); + this.getIOTierSo(it, val); + this.threadName = it.tableName; + this.iOTierStatisticsAnalysisPie?.hideTip(); + this.shadowRoot!.querySelector('.title')!.textContent = + this.processName + ' / ' + this.typeName + ' / ' + this.threadName; } libraryPieChart(val: any) { this.sumDur = this.libStatisticsData.allDuration; @@ -380,17 +406,7 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { angleClick: (it) => { // @ts-ignore if (it.tableName != 'other') { - this.clearData(); - this.iOTierStatisticsAnalysisBack!.style.visibility = 'visible'; - this.tableSo!.style.display = 'none'; - this.tableFunction!.style.display = 'grid'; - this.tableSo!.setAttribute('hideDownload', ''); - this.tableFunction?.removeAttribute('hideDownload'); - this.getIOTierFunction(it, val); - this.iOTierStatisticsAnalysisPie?.hideTip(); - this.shadowRoot!.querySelector('.title')!.textContent = - // @ts-ignore - this.processName + ' / ' + this.typeName + ' / ' + this.threadName + ' / ' + it.tableName; + this.ioTierSoLevelClickEvent(it, val); } }, hoverHandler: (data) => { @@ -430,6 +446,24 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); }); + this.tableSo!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.duration !== 0) { + this.ioTierSoLevelClickEvent(data, val); + } + }); + } + ioTierSoLevelClickEvent(it: any, val: any) { + this.clearData(); + this.iOTierStatisticsAnalysisBack!.style.visibility = 'visible'; + this.tableSo!.style.display = 'none'; + this.tableFunction!.style.display = 'grid'; + this.tableSo!.setAttribute('hideDownload', ''); + this.tableFunction?.removeAttribute('hideDownload'); + this.getIOTierFunction(it, val); + this.iOTierStatisticsAnalysisPie?.hideTip(); + this.shadowRoot!.querySelector('.title')!.textContent = + this.processName + ' / ' + this.typeName + ' / ' + this.threadName + ' / ' + it.tableName; } sortByColumn(column: string, ioSort: number) { this.sortColumn = column; @@ -455,7 +489,7 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { if (!currentTable) { return; } - if (ioSort == 0) { + if (ioSort === 0) { let ioArr = [...this.currentLevelData]; switch (this.currentLevel) { case 0: @@ -477,12 +511,12 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { currentTable!.recycleDataSource = ioArr; } else { let ioArr = [...this.currentLevelData]; - if (column == 'tableName') { + if (column === 'tableName') { currentTable!.recycleDataSource = ioArr.sort((a, b) => { - if (ioSort == 1) { + if (ioSort === 1) { if (a.tableName > b.tableName) { return 1; - } else if (a.tableName == b.tableName) { + } else if (a.tableName === b.tableName) { return 0; } else { return -1; @@ -490,20 +524,16 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { } else { if (b.tableName > a.tableName) { return 1; - } else if (a.tableName == b.tableName) { + } else if (a.tableName === b.tableName) { return 0; } else { return -1; } } }); - } else if (column == 'durFormat') { - currentTable!.recycleDataSource = ioArr.sort((a, b) => { - return ioSort == 1 ? a.duration - b.duration : b.duration - a.duration; - }); - } else if (column == 'percent') { + } else if (column === 'durFormat' || column === 'percent') { currentTable!.recycleDataSource = ioArr.sort((a, b) => { - return ioSort == 1 ? a.duration - b.duration : b.duration - a.v; + return ioSort === 1 ? a.duration - b.duration : b.duration - a.duration; }); } switch (this.currentLevel) { @@ -528,7 +558,7 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { } getIOTierProcess(val: any, result: Array) { this.processData = JSON.parse(JSON.stringify(result)); - if (!this.processData || this.processData.length == 0) { + if (!this.processData || this.processData.length === 0) { this.pidData = []; this.processStatisticsData = []; this.processPieChart(val); @@ -552,7 +582,7 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { let pName = ''; for (let item of value) { pName = item.processName = - item.processName == null || item.processName == undefined + item.processName === null || item.processName === undefined ? `Process(${item.pid})` : `${item.processName}(${item.pid})`; dur += item.dur; @@ -577,7 +607,7 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { let typeMap = new Map>(); let pid = item.pid; let allDur = 0; - if (!this.processData || this.processData.length == 0) { + if (!this.processData || this.processData.length === 0) { return; } for (let processItem of this.processData) { @@ -621,7 +651,7 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { let pid = item.pid; let type = item.type; let allDur = 0; - if (!this.processData || this.processData.length == 0) { + if (!this.processData || this.processData.length === 0) { return; } for (let itemData of this.processData) { @@ -644,7 +674,7 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { for (let item of value) { dur += item.dur; tName = item.threadName = - item.threadName == null || item.threadName == undefined ? `Thread(${item.tid})` : `${item.threadName}`; + item.threadName === null || item.threadName === undefined ? `Thread(${item.tid})` : `${item.threadName}`; } const threadData = { tableName: tName, @@ -670,7 +700,7 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { let type = item.type; let allDur = 0; let libMap = new Map>(); - if (!this.processData || this.processData.length == 0) { + if (!this.processData || this.processData.length === 0) { return; } for (let processItemData of this.processData) { @@ -692,7 +722,7 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { let libName = ''; for (let item of value) { dur += item.dur; - if (key == null) { + if (key === null) { item.libName = 'unkown'; } libName = item.libName; @@ -728,11 +758,16 @@ export class TabPaneIOTierStatisticsAnalysis extends BaseElement { let libId = item.libId; let allDur = 0; let symbolMap = new Map>(); - if (!this.processData || this.processData.length == 0) { + if (!this.processData || this.processData.length === 0) { return; } for (let processData of this.processData) { - if (processData.pid !== pid || processData.tid !== tid || processData.type !== type || processData.libId !== libId) { + if ( + processData.pid !== pid || + processData.tid !== tid || + processData.type !== type || + processData.libId !== libId + ) { continue; } allDur += processData.dur; diff --git a/ide/src/trace/component/trace/sheet/file-system/TabPaneVirtualMemoryStatisticsAnalysis.ts b/ide/src/trace/component/trace/sheet/file-system/TabPaneVirtualMemoryStatisticsAnalysis.ts index 7bdf737d195cb5f9529d77d76940172b86d4b69e..cadff4a1019e0960dbba33d26f0b2eb3400ba4c4 100644 --- a/ide/src/trace/component/trace/sheet/file-system/TabPaneVirtualMemoryStatisticsAnalysis.ts +++ b/ide/src/trace/component/trace/sheet/file-system/TabPaneVirtualMemoryStatisticsAnalysis.ts @@ -55,7 +55,7 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { private libStatisticsData!: any; private functionStatisticsData!: any; set data(vmStatisticsAnalysisSelection: SelectionParam | any) { - if (vmStatisticsAnalysisSelection == this.vmStatisticsAnalysisCurrentSelection) { + if (vmStatisticsAnalysisSelection === this.vmStatisticsAnalysisCurrentSelection) { this.vmStatisticsAnalysisPidData.unshift(this.processStatisticsData); this.vmStatisticsAnalysisTableProcess!.recycleDataSource = this.vmStatisticsAnalysisPidData; // @ts-ignore @@ -71,7 +71,11 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { this.vmStatisticsAnalysisTableFunction!.style.display = 'none'; this.back!.style.visibility = 'hidden'; this.vmStatisticsAnalysisRange!.textContent = - 'Selected range: ' + parseFloat(((vmStatisticsAnalysisSelection.rightNs - vmStatisticsAnalysisSelection.leftNs) / 1000000.0).toFixed(5)) + ' ms'; + 'Selected range: ' + + parseFloat( + ((vmStatisticsAnalysisSelection.rightNs - vmStatisticsAnalysisSelection.leftNs) / 1000000.0).toFixed(5) + ) + + ' ms'; this.vmStatisticsAnalysisProgressEL!.loading = true; this.getDataByWorker( [ @@ -166,17 +170,7 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { angleClick: (it) => { // @ts-ignore if (it.tableName != 'other') { - this.clearData(); - this.back!.style.visibility = 'visible'; - this.vmStatisticsAnalysisTableProcess!.style.display = 'none'; - this.vmStatisticsAnalysisTableType!.style.display = 'grid'; - this.vmStatisticsAnalysisTableProcess!.setAttribute('hideDownload', ''); - this.vmStatisticsAnalysisTableType?.removeAttribute('hideDownload'); - this.getVirtualMemoryType(it, val); - // @ts-ignore - this.processName = it.tableName; - this.shadowRoot!.querySelector('.title')!.textContent = this.processName; - this.vmStatisticsAnalysisPie?.hideTip(); + this.vmProcessLevelClickEvent(it, val); } }, hoverHandler: (data) => { @@ -215,6 +209,24 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); }); + this.vmStatisticsAnalysisTableProcess!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.duration !== 0) { + this.vmProcessLevelClickEvent(data, val); + } + }); + } + vmProcessLevelClickEvent(it: any, val: any) { + this.clearData(); + this.back!.style.visibility = 'visible'; + this.vmStatisticsAnalysisTableProcess!.style.display = 'none'; + this.vmStatisticsAnalysisTableType!.style.display = 'grid'; + this.vmStatisticsAnalysisTableProcess!.setAttribute('hideDownload', ''); + this.vmStatisticsAnalysisTableType?.removeAttribute('hideDownload'); + this.getVirtualMemoryType(it, val); + this.processName = it.tableName; + this.shadowRoot!.querySelector('.title')!.textContent = this.processName; + this.vmStatisticsAnalysisPie?.hideTip(); } typePieChart(val: any) { this.vmStatisticsAnalysisPie!.config = { @@ -235,18 +247,7 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { `; }, angleClick: (it) => { - // @ts-ignore - this.clearData(); - this.vmStatisticsAnalysisTableType!.style.display = 'none'; - this.vmStatisticsAnalysisTableThread!.style.display = 'grid'; - this.vmStatisticsAnalysisTableType!.setAttribute('hideDownload', ''); - this.vmStatisticsAnalysisTableThread?.removeAttribute('hideDownload'); - this.getVirtualMemoryThread(it, val); - // @ts-ignore - this.typeName = it.tableName; - this.vmStatisticsAnalysisPie?.hideTip(); - this.shadowRoot!.querySelector('.title')!.textContent = - this.processName + ' / ' + this.typeName; + this.vmTypeLevelClickEvent(it, val); }, hoverHandler: (data) => { if (data) { @@ -284,6 +285,23 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); }); + this.vmStatisticsAnalysisTableType!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.duration !== 0) { + this.vmTypeLevelClickEvent(data, val); + } + }); + } + vmTypeLevelClickEvent(it: any, val: any) { + this.clearData(); + this.vmStatisticsAnalysisTableType!.style.display = 'none'; + this.vmStatisticsAnalysisTableThread!.style.display = 'grid'; + this.vmStatisticsAnalysisTableType!.setAttribute('hideDownload', ''); + this.vmStatisticsAnalysisTableThread?.removeAttribute('hideDownload'); + this.getVirtualMemoryThread(it, val); + this.typeName = it.tableName; + this.vmStatisticsAnalysisPie?.hideTip(); + this.shadowRoot!.querySelector('.title')!.textContent = this.processName + ' / ' + this.typeName; } threadPieChart(val: any) { this.sumDur = this.threadStatisticsData.allDuration; @@ -307,18 +325,7 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { angleClick: (it) => { // @ts-ignore if (it.tableName != 'other') { - this.clearData(); - this.back!.style.visibility = 'visible'; - this.vmStatisticsAnalysisTableThread!.style.display = 'none'; - this.vmStatisticsAnalysisTableSo!.style.display = 'grid'; - this.vmStatisticsAnalysisTableThread!.setAttribute('hideDownload', ''); - this.vmStatisticsAnalysisTableSo?.removeAttribute('hideDownload'); - this.getVirtualMemorySo(it, val); - // @ts-ignore - this.threadName = it.tableName; - this.vmStatisticsAnalysisPie?.hideTip(); - this.shadowRoot!.querySelector('.title')!.textContent = - this.processName + ' / ' + this.typeName + ' / ' + this.threadName; + this.vmThreadLevelClickEvent(it, val); } }, hoverHandler: (data) => { @@ -357,6 +364,25 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); }); + this.vmStatisticsAnalysisTableThread!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.duration !== 0) { + this.vmThreadLevelClickEvent(data, val); + } + }); + } + vmThreadLevelClickEvent(it: any, val: any) { + this.clearData(); + this.back!.style.visibility = 'visible'; + this.vmStatisticsAnalysisTableThread!.style.display = 'none'; + this.vmStatisticsAnalysisTableSo!.style.display = 'grid'; + this.vmStatisticsAnalysisTableThread!.setAttribute('hideDownload', ''); + this.vmStatisticsAnalysisTableSo?.removeAttribute('hideDownload'); + this.getVirtualMemorySo(it, val); + this.threadName = it.tableName; + this.vmStatisticsAnalysisPie?.hideTip(); + this.shadowRoot!.querySelector('.title')!.textContent = + this.processName + ' / ' + this.typeName + ' / ' + this.threadName; } libraryPieChart(val: any) { this.sumDur = this.libStatisticsData.allDuration; @@ -380,17 +406,7 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { angleClick: (it) => { // @ts-ignore if (it.tableName != 'other') { - this.clearData(); - this.back!.style.visibility = 'visible'; - this.vmStatisticsAnalysisTableSo!.style.display = 'none'; - this.vmStatisticsAnalysisTableFunction!.style.display = 'grid'; - this.vmStatisticsAnalysisTableSo!.setAttribute('hideDownload', ''); - this.vmStatisticsAnalysisTableFunction?.removeAttribute('hideDownload'); - this.getVirtualMemoryFunction(it, val); - this.vmStatisticsAnalysisPie?.hideTip(); - this.shadowRoot!.querySelector('.title')!.textContent = - // @ts-ignore - this.processName + ' / ' + this.typeName + ' / ' + this.threadName + ' / ' + it.tableName; + this.vmSoLevelClickEvent(it, val); } }, hoverHandler: (data) => { @@ -430,6 +446,24 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); }); + this.vmStatisticsAnalysisTableSo!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.duration !== 0) { + this.vmSoLevelClickEvent(data, val); + } + }); + } + vmSoLevelClickEvent(it: any, val: any) { + this.clearData(); + this.back!.style.visibility = 'visible'; + this.vmStatisticsAnalysisTableSo!.style.display = 'none'; + this.vmStatisticsAnalysisTableFunction!.style.display = 'grid'; + this.vmStatisticsAnalysisTableSo!.setAttribute('hideDownload', ''); + this.vmStatisticsAnalysisTableFunction?.removeAttribute('hideDownload'); + this.getVirtualMemoryFunction(it, val); + this.vmStatisticsAnalysisPie?.hideTip(); + this.shadowRoot!.querySelector('.title')!.textContent = + this.processName + ' / ' + this.typeName + ' / ' + this.threadName + ' / ' + it.tableName; } sortByColumn(column: string, vmsSort: number) { this.vmStatisticsAnalysisSortColumn = column; @@ -455,7 +489,7 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { if (!vmsCurrentTable) { return; } - if (vmsSort == 0) { + if (vmsSort === 0) { let vmsArr = [...this.currentLevelData]; switch (this.currentLevel) { case 0: @@ -477,12 +511,12 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { vmsCurrentTable!.recycleDataSource = vmsArr; } else { let vmsArr = [...this.currentLevelData]; - if (column == 'tableName') { + if (column === 'tableName') { vmsCurrentTable!.recycleDataSource = vmsArr.sort((a, b) => { - if (vmsSort == 1) { + if (vmsSort === 1) { if (a.tableName > b.tableName) { return 1; - } else if (a.tableName == b.tableName) { + } else if (a.tableName === b.tableName) { return 0; } else { return -1; @@ -490,20 +524,16 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { } else { if (b.tableName > a.tableName) { return 1; - } else if (a.tableName == b.tableName) { + } else if (a.tableName === b.tableName) { return 0; } else { return -1; } } }); - } else if (column == 'durFormat') { - vmsCurrentTable!.recycleDataSource = vmsArr.sort((a, b) => { - return vmsSort == 1 ? a.duration - b.duration : b.duration - a.duration; - }); - } else if (column == 'percent') { + } else if (column === 'durFormat' || column === 'percent') { vmsCurrentTable!.recycleDataSource = vmsArr.sort((a, b) => { - return vmsSort == 1 ? a.duration - b.duration : b.duration - a.v; + return vmsSort === 1 ? a.duration - b.duration : b.duration - a.duration; }); } switch (this.currentLevel) { @@ -529,7 +559,7 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { getVirtualMemoryProcess(val: any, result: Array) { this.vmStatisticsAnalysisProgressEL!.loading = true; this.vmStatisticsAnalysisProcessData = JSON.parse(JSON.stringify(result)); - if (!this.vmStatisticsAnalysisProcessData || this.vmStatisticsAnalysisProcessData.length == 0) { + if (!this.vmStatisticsAnalysisProcessData || this.vmStatisticsAnalysisProcessData.length === 0) { this.vmStatisticsAnalysisPidData = []; this.processStatisticsData = []; this.processPieChart(val); @@ -553,7 +583,7 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { let pName = ''; for (let item of value) { pName = item.processName = - item.processName == null || item.processName == undefined + item.processName === null || item.processName === undefined ? `Process(${item.pid})` : `${item.processName}(${item.pid})`; dur += item.dur; @@ -578,7 +608,7 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { let typeMap = new Map>(); let pid = item.pid; let allDur = 0; - if (!this.vmStatisticsAnalysisProcessData || this.vmStatisticsAnalysisProcessData.length == 0) { + if (!this.vmStatisticsAnalysisProcessData || this.vmStatisticsAnalysisProcessData.length === 0) { return; } for (let vmsItem of this.vmStatisticsAnalysisProcessData) { @@ -622,7 +652,7 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { let pid = item.pid; let type = item.type; let allDur = 0; - if (!this.vmStatisticsAnalysisProcessData || this.vmStatisticsAnalysisProcessData.length == 0) { + if (!this.vmStatisticsAnalysisProcessData || this.vmStatisticsAnalysisProcessData.length === 0) { return; } for (let vmapItem of this.vmStatisticsAnalysisProcessData) { @@ -645,7 +675,7 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { for (let item of value) { dur += item.dur; tName = item.threadName = - item.threadName == null || item.threadName == undefined ? `Thread(${item.tid})` : `${item.threadName}`; + item.threadName === null || item.threadName === undefined ? `Thread(${item.tid})` : `${item.threadName}`; } const threadData = { tableName: tName, @@ -671,7 +701,7 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { let type = item.type; let allDur = 0; let libMap = new Map>(); - if (!this.vmStatisticsAnalysisProcessData || this.vmStatisticsAnalysisProcessData.length == 0) { + if (!this.vmStatisticsAnalysisProcessData || this.vmStatisticsAnalysisProcessData.length === 0) { return; } for (let vmItemData of this.vmStatisticsAnalysisProcessData) { @@ -693,7 +723,7 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { let vmLibName = ''; for (let item of value) { dur += item.dur; - if (key == null) { + if (key === null) { item.libName = 'unkown'; } vmLibName = item.libName; @@ -730,11 +760,16 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { let libId = item.libId; let allDur = 0; let symbolMap = new Map>(); - if (!this.vmStatisticsAnalysisProcessData || this.vmStatisticsAnalysisProcessData.length == 0) { + if (!this.vmStatisticsAnalysisProcessData || this.vmStatisticsAnalysisProcessData.length === 0) { return; } for (let vmProcessData of this.vmStatisticsAnalysisProcessData) { - if (vmProcessData.pid !== pid || vmProcessData.tid !== tid || vmProcessData.type !== type || vmProcessData.libId !== libId) { + if ( + vmProcessData.pid !== pid || + vmProcessData.tid !== tid || + vmProcessData.type !== type || + vmProcessData.libId !== libId + ) { continue; } allDur += vmProcessData.dur; @@ -827,9 +862,9 @@ export class TabPaneVirtualMemoryStatisticsAnalysis extends BaseElement { } typeIdToString(type: any) { let releaseType: any; - if (type == 1) { + if (type === 1) { releaseType = 'File Backed In'; - } else if (type == 7) { + } else if (type === 7) { releaseType = 'Copy On Writer'; } return releaseType; diff --git a/ide/src/trace/component/trace/sheet/hiperf/TabPanePerfAnalysis.ts b/ide/src/trace/component/trace/sheet/hiperf/TabPanePerfAnalysis.ts index bd3fa43186fba4b23c14992eb58dd275256a0d63..fd843071aecc08d4917e3524ae16956a55fd2835 100644 --- a/ide/src/trace/component/trace/sheet/hiperf/TabPanePerfAnalysis.ts +++ b/ide/src/trace/component/trace/sheet/hiperf/TabPanePerfAnalysis.ts @@ -54,7 +54,7 @@ export class TabPanePerfAnalysis extends BaseElement { private currentLevel = -1; private currentLevelData!: Array; set data(val: SelectionParam | any) { - if (val == this.currentSelection) { + if (val === this.currentSelection) { this.pidData.unshift(this.allProcessCount); this.tableProcess!.recycleDataSource = this.pidData; // @ts-ignore @@ -69,7 +69,7 @@ export class TabPanePerfAnalysis extends BaseElement { this.tableFunction!.style.display = 'none'; this.back!.style.visibility = 'hidden'; this.perfAnalysisRange!.textContent = - 'Selected range: ' + parseFloat(((val.rightNs - val.leftNs) / 1000000.0).toFixed(5)) + ' ms'; + 'Selected range: ' + parseFloat(((val.rightNs - val.leftNs) / 1000000.0).toFixed(5)) + ' ms'; if (!this.callChainMap) { this.getCallChainDataFromWorker(val); } @@ -147,18 +147,7 @@ export class TabPanePerfAnalysis extends BaseElement { angleClick: (it) => { // @ts-ignore if (it.tableName != 'other') { - this.clearData(); - this.back!.style.visibility = 'visible'; - this.tableProcess!.style.display = 'none'; - this.perfTableThread!.style.display = 'grid'; - this.tableProcess!.setAttribute('hideDownload', ''); - this.perfTableThread?.removeAttribute('hideDownload'); - this.getHiperfThread(it, val); - // @ts-ignore - this.shadowRoot!.querySelector('.title')!.textContent = it.tableName; - // @ts-ignore - this.processName = it.tableName; - this.perfAnalysisPie?.hideTip(); + this.perfProcessLevelClickEvent(it, val); } }, hoverHandler: (data) => { @@ -189,17 +178,37 @@ export class TabPanePerfAnalysis extends BaseElement { this.tabName!.textContent = 'Statistic By Process Count'; this.pidData.unshift(this.allProcessCount); this.tableProcess!.recycleDataSource = this.pidData; + this.tableProcess?.reMeauseHeight(); // @ts-ignore this.pidData.shift(this.allProcessCount); this.currentLevelData = this.pidData; - this.tableProcess?.reMeauseHeight(); this.tableProcess!.addEventListener('column-click', (evt) => { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); }); + this.tableProcess!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.count !== 0) { + this.perfProcessLevelClickEvent(data, val); + } + }); + } + perfProcessLevelClickEvent(it: any, val: any) { + this.clearData(); + this.back!.style.visibility = 'visible'; + this.tableProcess!.style.display = 'none'; + this.perfTableThread!.style.display = 'grid'; + this.tableProcess!.setAttribute('hideDownload', ''); + this.perfTableThread?.removeAttribute('hideDownload'); + this.getHiperfThread(it, val); + // @ts-ignore + this.shadowRoot!.querySelector('.title')!.textContent = it.tableName; + // @ts-ignore + this.processName = it.tableName; + this.perfAnalysisPie?.hideTip(); } threadPieChart(val: any) { - if (val.perfThread.length > 0 && val.perfProcess.length == 0) { + if (val.perfThread.length > 0 && val.perfProcess.length === 0) { this.back!.style.visibility = 'hidden'; this.shadowRoot!.querySelector('.title')!.textContent = ''; this.perfTableThread!.style.display = 'grid'; @@ -227,19 +236,7 @@ export class TabPanePerfAnalysis extends BaseElement { angleClick: (it) => { // @ts-ignore if (it.tableName != 'other') { - this.clearData(); - this.back!.style.visibility = 'visible'; - this.perfTableThread!.style.display = 'none'; - this.tableSo!.style.display = 'grid'; - this.perfTableThread!.setAttribute('hideDownload', ''); - this.tableSo?.removeAttribute('hideDownload'); - this.getHiperfSo(it, val); - this.shadowRoot!.querySelector('.title')!.textContent = - // @ts-ignore - this.processName + ' / ' + it.tableName; - // @ts-ignore - this.threadName = it.tableName; - this.perfAnalysisPie?.hideTip(); + this.perfThreadLevelClickEvent(it, val); } }, hoverHandler: (data) => { @@ -273,10 +270,31 @@ export class TabPanePerfAnalysis extends BaseElement { this.tabName!.textContent = 'Statistic By Thread Count'; this.threadData.unshift(this.allThreadCount); this.perfTableThread!.recycleDataSource = this.threadData; + this.perfTableThread?.reMeauseHeight(); // @ts-ignore this.threadData.shift(this.allThreadCount); this.currentLevelData = this.threadData; - this.perfTableThread?.reMeauseHeight(); + this.perfTableThread!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.count !== 0) { + this.perfThreadLevelClickEvent(data, val); + } + }); + } + perfThreadLevelClickEvent(it: any, val: any) { + this.clearData(); + this.back!.style.visibility = 'visible'; + this.perfTableThread!.style.display = 'none'; + this.tableSo!.style.display = 'grid'; + this.perfTableThread!.setAttribute('hideDownload', ''); + this.tableSo?.removeAttribute('hideDownload'); + this.getHiperfSo(it, val); + this.shadowRoot!.querySelector('.title')!.textContent = + // @ts-ignore + this.processName + ' / ' + it.tableName; + // @ts-ignore + this.threadName = it.tableName; + this.perfAnalysisPie?.hideTip(); } libraryPieChart(val: any) { this.sumCount = this.allLibCount.allCount; @@ -300,16 +318,7 @@ export class TabPanePerfAnalysis extends BaseElement { angleClick: (it) => { // @ts-ignore if (it.tableName != 'other') { - this.clearData(); - this.tableSo!.style.display = 'none'; - this.tableFunction!.style.display = 'grid'; - this.tableSo!.setAttribute('hideDownload', ''); - this.tableFunction?.removeAttribute('hideDownload'); - this.getHiperfFunction(it, val); - this.shadowRoot!.querySelector('.title')!.textContent = - // @ts-ignore - this.processName + ' / ' + this.threadName + ' / ' + it.tableName; - this.perfAnalysisPie?.hideTip(); + this.perfSoLevelClickEvent(it, val); } }, hoverHandler: (data) => { @@ -340,14 +349,32 @@ export class TabPanePerfAnalysis extends BaseElement { this.tabName!.textContent = 'Statistic By Library Count'; this.soData.unshift(this.allLibCount); this.tableSo!.recycleDataSource = this.soData; + this.tableSo?.reMeauseHeight(); // @ts-ignore this.soData.shift(this.allLibCount); this.currentLevelData = this.soData; - this.tableSo?.reMeauseHeight(); this.tableSo!.addEventListener('column-click', (evt) => { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); }); + this.tableSo!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.count !== 0) { + this.perfSoLevelClickEvent(data, val); + } + }); + } + perfSoLevelClickEvent(it: any, val: any) { + this.clearData(); + this.tableSo!.style.display = 'none'; + this.tableFunction!.style.display = 'grid'; + this.tableSo!.setAttribute('hideDownload', ''); + this.tableFunction?.removeAttribute('hideDownload'); + this.getHiperfFunction(it, val); + this.shadowRoot!.querySelector('.title')!.textContent = + // @ts-ignore + this.processName + ' / ' + this.threadName + ' / ' + it.tableName; + this.perfAnalysisPie?.hideTip(); } sortByColumn(column: string, sort: number) { this.sortColumn = column; @@ -370,7 +397,7 @@ export class TabPanePerfAnalysis extends BaseElement { if (!currentTable) { return; } - if (sort == 0) { + if (sort === 0) { let arr = [...this.currentLevelData]; switch (this.currentLevel) { case 0: @@ -389,12 +416,12 @@ export class TabPanePerfAnalysis extends BaseElement { currentTable!.recycleDataSource = arr; } else { let arr = [...this.currentLevelData]; - if (column == 'tableName') { + if (column === 'tableName') { currentTable!.recycleDataSource = arr.sort((leftA, rightB) => { - if (sort == 1) { + if (sort === 1) { if (leftA.tableName > rightB.tableName) { return 1; - } else if (leftA.tableName == rightB.tableName) { + } else if (leftA.tableName === rightB.tableName) { return 0; } else { return -1; @@ -402,20 +429,16 @@ export class TabPanePerfAnalysis extends BaseElement { } else { if (rightB.tableName > leftA.tableName) { return 1; - } else if (leftA.tableName == rightB.tableName) { + } else if (leftA.tableName === rightB.tableName) { return 0; } else { return -1; } } }); - } else if (column == 'countFormat') { - currentTable!.recycleDataSource = arr.sort((a, b) => { - return sort == 1 ? a.count - b.count : b.count - a.count; - }); - } else if (column == 'percent') { + } else if (column === 'countFormat' || column === 'percent') { currentTable!.recycleDataSource = arr.sort((a, b) => { - return sort == 1 ? a.count - b.count : b.count - a.count; + return sort === 1 ? a.count - b.count : b.count - a.count; }); } switch (this.currentLevel) { @@ -437,9 +460,9 @@ export class TabPanePerfAnalysis extends BaseElement { } async getHiperfProcess(val: any) { this.progressEL!.loading = true; - if (!this.processData || this.processData.length == 0) { + if (!this.processData || this.processData.length === 0) { this.progressEL!.loading = false; - if (val.perfThread.length > 0 && val.perfProcess.length == 0) { + if (val.perfThread.length > 0 && val.perfProcess.length === 0) { this.threadData = []; this.allThreadCount = []; this.tableProcess!.style.display = 'none'; @@ -453,7 +476,7 @@ export class TabPanePerfAnalysis extends BaseElement { } let allCount = 0; let pidMap = new Map>(); - if (val.perfThread.length > 0 && val.perfProcess.length == 0) { + if (val.perfThread.length > 0 && val.perfProcess.length === 0) { this.tableProcess!.style.display = 'none'; this.getHiperfThread(this.processData[0], val); } else { @@ -470,7 +493,7 @@ export class TabPanePerfAnalysis extends BaseElement { this.pidData = []; pidMap.forEach((arr: Array, pid: number) => { let count = 0; - for(let item of arr){ + for (let item of arr) { count += item.count; } let pName = arr[0].processName + '(' + pid + ')'; @@ -495,7 +518,7 @@ export class TabPanePerfAnalysis extends BaseElement { let threadMap = new Map>(); let pid = item.pid; let allCount = 0; - if (!this.processData || this.processData.length == 0) { + if (!this.processData || this.processData.length === 0) { return; } for (let itemData of this.processData) { @@ -541,7 +564,7 @@ export class TabPanePerfAnalysis extends BaseElement { let pid = item.pid; let allCount = 0; let libMap = new Map>(); - if (!this.processData || this.processData.length == 0) { + if (!this.processData || this.processData.length === 0) { return; } for (let itemData of this.processData) { @@ -558,10 +581,10 @@ export class TabPanePerfAnalysis extends BaseElement { } } this.soData = []; - libMap.forEach((arr :Array, libId: number) => { + libMap.forEach((arr: Array, libId: number) => { let libCount = 0; let libName = arr[0].libName; - for(let item of arr){ + for (let item of arr) { libCount += item.count; } const libData = { @@ -590,7 +613,7 @@ export class TabPanePerfAnalysis extends BaseElement { let libId = item.libId; let allCount = 0; let symbolMap = new Map>(); - if (!this.processData || this.processData.length == 0) { + if (!this.processData || this.processData.length === 0) { return; } for (let itemData of this.processData) { @@ -609,7 +632,7 @@ export class TabPanePerfAnalysis extends BaseElement { this.functionData = []; symbolMap.forEach((arr, symbolId) => { let symbolCount = 0; - for(let item of arr){ + for (let item of arr) { symbolCount += item.count; } let symbolName = arr[0].symbolName; @@ -670,10 +693,10 @@ export class TabPanePerfAnalysis extends BaseElement { }); this.functionData.unshift(this.allSymbolCount); this.tableFunction!.recycleDataSource = this.functionData; + this.tableFunction?.reMeauseHeight(); // @ts-ignore this.functionData.shift(this.allSymbolCount); this.currentLevelData = this.functionData; - this.tableFunction?.reMeauseHeight(); this.tableFunction!.addEventListener('column-click', (evt) => { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); diff --git a/ide/src/trace/component/trace/sheet/native-memory/TabPaneNMCallTree.ts b/ide/src/trace/component/trace/sheet/native-memory/TabPaneNMCallTree.ts index ecf31594599df22a590451abe9dedc435f7a4ae7..fe0776476edd51a82da3de65e7a32d75fbe3c451 100644 --- a/ide/src/trace/component/trace/sheet/native-memory/TabPaneNMCallTree.ts +++ b/ide/src/trace/component/trace/sheet/native-memory/TabPaneNMCallTree.ts @@ -23,6 +23,7 @@ import { ChartMode } from '../../../../bean/FrameChartStruct.js'; import { FilterData, TabPaneFilter } from '../TabPaneFilter.js'; import { procedurePool } from '../../../../database/Procedure.js'; import { FileMerageBean } from '../../../../database/logic-worker/ProcedureLogicWorkerFileSystem.js'; +import { queryNativeHookSubType } from '../../../../database/SqlLite.js'; @element('tabpane-nm-calltree') export class TabpaneNMCalltree extends BaseElement { @@ -51,6 +52,7 @@ export class TabpaneNMCalltree extends BaseElement { private filterResponseType: number = -1; private filterResponseSelect: string = '0'; private responseTypes: any[] = []; + private subTypeArr: number[] = []; set data(nmCallTreeParam: SelectionParam | any) { if (nmCallTreeParam == this.currentSelection) { @@ -194,8 +196,15 @@ export class TabpaneNMCalltree extends BaseElement { } } - initFilterTypes() { + async initFilterTypes() { let currentNMCallTreeFilter = this.shadowRoot?.querySelector('#nm-call-tree-filter'); + let subTypeList = await queryNativeHookSubType(this.currentSelection!.leftNs,this.currentSelection!.rightNs); + let secondFilterList = ['All Heap & Anonymous VM', 'All Heap', 'All Anonymous VM']; + this.subTypeArr = []; + for (let subType of subTypeList) { + secondFilterList.push(subType.data); + this.subTypeArr.push(subType.subTypeId); + } if (this.currentSelection!.nativeMemory.length > 0) { procedurePool.submitWithName('logic1', 'native-memory-get-responseType', {}, undefined, (res: any) => { this.responseTypes = res; @@ -207,7 +216,7 @@ export class TabpaneNMCalltree extends BaseElement { } currentNMCallTreeFilter!.setSelectList( null, - null, + secondFilterList, 'Allocation Lifespan', 'Allocation Type', this.responseTypes.map((item: any) => { @@ -226,7 +235,7 @@ export class TabpaneNMCalltree extends BaseElement { this.filterResponseType = -1; }); } else { - currentNMCallTreeFilter!.setSelectList(null, null, 'Allocation Lifespan', 'Allocation Type', undefined); + currentNMCallTreeFilter!.setSelectList(null, secondFilterList, 'Allocation Lifespan', 'Allocation Type', undefined); currentNMCallTreeFilter!.setFilterModuleSelect('#first-select', 'width', '150px'); currentNMCallTreeFilter!.setFilterModuleSelect('#second-select', 'width', '150px'); currentNMCallTreeFilter!.firstSelect = '0'; @@ -561,6 +570,15 @@ export class TabpaneNMCalltree extends BaseElement { groupArgs.set('filterResponseType', this.filterResponseType); groupArgs.set('leftNs', this.currentSelection?.leftNs || 0); groupArgs.set('rightNs', this.currentSelection?.rightNs || 0); + let selections: Array = []; + if (this.subTypeArr.length > 0) { + this.subTypeArr.map((memory) => { + selections.push({ + memoryTap: memory, + }); + }); + } + groupArgs.set('statisticsSelection', selections); groupArgs.set( 'nativeHookType', this.currentSelection!.nativeMemory.length > 0 ? 'native-hook' : 'native-hook-statistic' diff --git a/ide/src/trace/component/trace/sheet/native-memory/TabPaneNMStatisticAnalysis.ts b/ide/src/trace/component/trace/sheet/native-memory/TabPaneNMStatisticAnalysis.ts index 39ed85417720f7faddff52616bbad4bafd24d242..8433119d3b4f03825300dc7f447cfd81825dfc27 100644 --- a/ide/src/trace/component/trace/sheet/native-memory/TabPaneNMStatisticAnalysis.ts +++ b/ide/src/trace/component/trace/sheet/native-memory/TabPaneNMStatisticAnalysis.ts @@ -115,7 +115,7 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { private functionStatisticsData!: {}; set data(statisticAnalysisParam: SelectionParam | any) { - if (statisticAnalysisParam == this.currentSelection) { + if (statisticAnalysisParam === this.currentSelection) { this.eventTypeData.unshift(this.typeStatisticsData); this.tableType!.recycleDataSource = this.eventTypeData; // @ts-ignore @@ -123,9 +123,11 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { return; } // @ts-ignore - this.soUsageTbl?.shadowRoot.querySelector('.table').style.height = this.parentElement.clientHeight - 20 - 31 + 'px'; + this.tableType?.shadowRoot?.querySelector('.table').style.height = this.parentElement.clientHeight + 'px'; // @ts-ignore - this.functionUsageTbl?.shadowRoot.querySelector('.table').style.height = this.parentElement.clientHeight - 20 - 31 + 'px'; + this.soUsageTbl?.shadowRoot?.querySelector('.table').style.height = this.parentElement.clientHeight + 'px'; + // @ts-ignore + this.functionUsageTbl?.shadowRoot?.querySelector('.table').style.height = this.parentElement.clientHeight + 'px'; this.clearData(); this.currentSelection = statisticAnalysisParam; this.tableType!.style.display = 'grid'; @@ -134,7 +136,9 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { this.functionUsageTbl!.style.display = 'none'; this.back!.style.visibility = 'hidden'; this.range!.textContent = - 'Selected range: ' + parseFloat(((statisticAnalysisParam.rightNs - statisticAnalysisParam.leftNs) / 1000000.0).toFixed(5)) + ' ms'; + 'Selected range: ' + + parseFloat(((statisticAnalysisParam.rightNs - statisticAnalysisParam.leftNs) / 1000000.0).toFixed(5)) + + ' ms'; this.isStatistic = statisticAnalysisParam.nativeMemory.length === 0; this.getNMEventTypeSize(statisticAnalysisParam); @@ -183,7 +187,7 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { typePieChart(val: any) { this.pie!.config = { appendPadding: 0, - data: this.eventTypeData, + data: this.getPieChartData(this.eventTypeData), angleField: 'existSize', colorField: 'tableName', radius: 1, @@ -202,18 +206,9 @@ export class TabPaneNMStatisticAnalysis extends BaseElement {
    `; }, angleClick: (it: any) => { - this.clearData(); - this.back!.style.visibility = 'visible'; - this.tableType!.style.display = 'none'; - this.soUsageTbl!.style.display = 'grid'; - this.tableType!.setAttribute('hideDownload', ''); - this.soUsageTbl?.removeAttribute('hideDownload'); - this.getLibSize(it, val); - // @ts-ignore - this.shadowRoot!.querySelector('.title')!.textContent = it.typeName; - // @ts-ignore - this.type = it.typeName; - this.pie?.hideTip(); + if (it.tableName != 'other') { + this.nativeProcessLevelClickEvent(it, val); + } }, hoverHandler: (data) => { if (data) { @@ -243,10 +238,22 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { this.tabName!.textContent = 'Statistic By Event Type Existing'; this.eventTypeData.unshift(this.typeStatisticsData); this.tableType!.recycleDataSource = this.eventTypeData; + this.tableType?.reMeauseHeight(); // @ts-ignore this.eventTypeData.shift(this.typeStatisticsData); this.currentLevelData = this.eventTypeData; - this.tableType?.reMeauseHeight(); + } + nativeProcessLevelClickEvent(it: any, val: any) { + this.clearData(); + this.back!.style.visibility = 'visible'; + this.tableType!.style.display = 'none'; + this.soUsageTbl!.style.display = 'grid'; + this.tableType!.setAttribute('hideDownload', ''); + this.soUsageTbl?.removeAttribute('hideDownload'); + this.getLibSize(it, val); + this.shadowRoot!.querySelector('.title')!.textContent = it.typeName; + this.type = it.typeName; + this.pie?.hideTip(); } threadPieChart(val: any) { this.pie!.config = { @@ -336,15 +343,7 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { angleClick: (it: any) => { // @ts-ignore if (it.tableName != 'other') { - this.clearData(); - this.soUsageTbl!.style.display = 'none'; - this.functionUsageTbl!.style.display = 'grid'; - this.soUsageTbl!.setAttribute('hideDownload', ''); - this.functionUsageTbl?.removeAttribute('hideDownload'); - this.getNMFunctionSize(it, val); - // @ts-ignore - this.shadowRoot!.querySelector('.title')!.textContent = this.type + ' / ' + it.libName; - this.pie?.hideTip(); + this.nativeSoLevelClickEvent(it, val); } }, hoverHandler: (data) => { @@ -376,15 +375,30 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { this.soData.unshift(this.libStatisticsData); this.soUsageTbl!.recycleDataSource = this.soData; // @ts-ignore - this.soData.shift(this.libStatisticsData) + this.soData.shift(this.libStatisticsData); this.currentLevelData = this.soData; this.soUsageTbl?.reMeauseHeight(); this.soUsageTbl!.addEventListener('column-click', (evt) => { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); }); + this.soUsageTbl!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.existSize !== 0) { + this.nativeSoLevelClickEvent(data, val); + } + }); + } + nativeSoLevelClickEvent(it: any, val: any) { + this.clearData(); + this.soUsageTbl!.style.display = 'none'; + this.functionUsageTbl!.style.display = 'grid'; + this.soUsageTbl!.setAttribute('hideDownload', ''); + this.functionUsageTbl?.removeAttribute('hideDownload'); + this.getNMFunctionSize(it, val); + this.shadowRoot!.querySelector('.title')!.textContent = this.type + ' / ' + it.libName; + this.pie?.hideTip(); } - functionPieChart(val: any) { this.pie!.config = { appendPadding: 0, @@ -460,7 +474,7 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { if (!currentTable) { return; } - if (sort == 0) { + if (sort === 0) { let arr = [...this.currentLevelData]; switch (this.currentLevel) { case 0: @@ -472,79 +486,80 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { case 2: arr.unshift(this.functionStatisticsData); break; - } - currentTable!.recycleDataSource = arr; - + } + currentTable!.recycleDataSource = arr; } else { let arr = [...this.currentLevelData]; - if (column == 'tableName') { - currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { - if (sort == 1) { - if (statisticAnalysisLeftData.tableName > statisticAnalysisRightData.tableName) { - return 1; - } else if (statisticAnalysisLeftData.tableName == statisticAnalysisRightData.tableName) { - return 0; - } else { - return -1; - } - } else { - if (statisticAnalysisRightData.tableName > statisticAnalysisLeftData.tableName) { - return 1; - } else if (statisticAnalysisLeftData.tableName == statisticAnalysisRightData.tableName) { - return 0; + switch (column) { + case 'tableName': + currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { + if (sort === 1) { + if (statisticAnalysisLeftData.tableName > statisticAnalysisRightData.tableName) { + return 1; + } else if (statisticAnalysisLeftData.tableName === statisticAnalysisRightData.tableName) { + return 0; + } else { + return -1; + } } else { - return -1; + if (statisticAnalysisRightData.tableName > statisticAnalysisLeftData.tableName) { + return 1; + } else if (statisticAnalysisLeftData.tableName === statisticAnalysisRightData.tableName) { + return 0; + } else { + return -1; + } } - } - }); - } else if (column == 'existSizeFormat') { - currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { - return sort == 1 ? statisticAnalysisLeftData.existSize - statisticAnalysisRightData.existSize : statisticAnalysisRightData.existSize - statisticAnalysisLeftData.existSize; - }); - } else if (column == 'existSizePercent') { - currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { - return sort == 1 ? statisticAnalysisLeftData.existSize - statisticAnalysisRightData.existSize : statisticAnalysisRightData.existSize - statisticAnalysisLeftData.existSize; - }); - } else if (column == 'existCount') { - currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { - return sort == 1 ? statisticAnalysisLeftData.existCount - statisticAnalysisRightData.existCount : statisticAnalysisRightData.existCount - statisticAnalysisLeftData.existCount; - }); - } else if (column == 'existCountPercent') { - currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { - return sort == 1 ? statisticAnalysisLeftData.existCount - statisticAnalysisRightData.existCount : statisticAnalysisRightData.existCount - statisticAnalysisLeftData.existCount; - }); - } else if (column == 'releaseSizeFormat') { - currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { - return sort == 1 ? statisticAnalysisLeftData.releaseSize - statisticAnalysisRightData.releaseSize : statisticAnalysisRightData.releaseSize - statisticAnalysisLeftData.releaseSize; - }); - }else if (column == 'releaseSizePercent') { - currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { - return sort == 1 ? statisticAnalysisLeftData.releaseSize - statisticAnalysisRightData.releaseSize : statisticAnalysisRightData.releaseSize - statisticAnalysisLeftData.releaseSize; - }); - }else if (column == 'releaseCount') { - currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { - return sort == 1 ? statisticAnalysisLeftData.releaseCount - statisticAnalysisRightData.releaseCount : statisticAnalysisRightData.releaseCount - statisticAnalysisLeftData.releaseCount; - }); - }else if (column == 'releaseCountPercent') { - currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { - return sort == 1 ? statisticAnalysisLeftData.releaseCount - statisticAnalysisRightData.releaseCount : statisticAnalysisRightData.releaseCount - statisticAnalysisLeftData.releaseCount; - }); - }else if (column == 'applySizeFormat') { - currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { - return sort == 1 ? statisticAnalysisLeftData.applySize - statisticAnalysisRightData.applySize : statisticAnalysisRightData.applySize - statisticAnalysisLeftData.applySize; - }); - }else if (column == 'applySizePercent') { - currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { - return sort == 1 ? statisticAnalysisLeftData.applySize - statisticAnalysisRightData.applySize : statisticAnalysisRightData.applySize - statisticAnalysisLeftData.applySize; - }); - }else if (column == 'applyCount') { - currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { - return sort == 1 ? statisticAnalysisLeftData.applyCount - statisticAnalysisRightData.applyCount : statisticAnalysisRightData.applyCount - statisticAnalysisLeftData.applyCount; - }); - }else if (column == 'applyCountPercent') { - currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { - return sort == 1 ? statisticAnalysisLeftData.applyCount - statisticAnalysisRightData.applyCount : statisticAnalysisRightData.applyCount - statisticAnalysisLeftData.applyCount; - }); + }); + break; + case 'existSizeFormat': + case 'existSizePercent': + currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { + return sort === 1 + ? statisticAnalysisLeftData.existSize - statisticAnalysisRightData.existSize + : statisticAnalysisRightData.existSize - statisticAnalysisLeftData.existSize; + }); + break; + case 'existCount': + case 'existCountPercent': + currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { + return sort === 1 + ? statisticAnalysisLeftData.existCount - statisticAnalysisRightData.existCount + : statisticAnalysisRightData.existCount - statisticAnalysisLeftData.existCount; + }); + break; + case 'releaseSizeFormat': + case 'releaseSizePercent': + currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { + return sort === 1 + ? statisticAnalysisLeftData.releaseSize - statisticAnalysisRightData.releaseSize + : statisticAnalysisRightData.releaseSize - statisticAnalysisLeftData.releaseSize; + }); + break; + case 'releaseCount': + case 'releaseCountPercent': + currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { + return sort === 1 + ? statisticAnalysisLeftData.releaseCount - statisticAnalysisRightData.releaseCount + : statisticAnalysisRightData.releaseCount - statisticAnalysisLeftData.releaseCount; + }); + break; + case 'applySizeFormat': + case 'applySizePercent': + currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { + return sort === 1 + ? statisticAnalysisLeftData.applySize - statisticAnalysisRightData.applySize + : statisticAnalysisRightData.applySize - statisticAnalysisLeftData.applySize; + }); + break; + case 'applyCount': + case 'applyCountPercent': + currentTable!.recycleDataSource = arr.sort((statisticAnalysisLeftData, statisticAnalysisRightData) => { + return sort === 1 + ? statisticAnalysisLeftData.applyCount - statisticAnalysisRightData.applyCount + : statisticAnalysisRightData.applyCount - statisticAnalysisLeftData.applyCount; + }); + break; } switch (this.currentLevel) { case 0: @@ -595,6 +610,26 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { // @ts-ignore this.sortByColumn(evt.detail.key, evt.detail.sort); }); + this.tableType!.addEventListener('row-click', (evt: any) => { + let data = evt.detail.data; + if (data.tableName !== '' && data.existSize !== 0) { + this.nativeProcessLevelClickEvent(data, val); + } + }); + new ResizeObserver(() => { + if (this.parentElement?.clientHeight != 0) { + // @ts-ignore + this.tableType?.shadowRoot?.querySelector('.table').style.height = this.parentElement.clientHeight + 'px'; + this.tableType?.reMeauseHeight(); + // @ts-ignore + this.soUsageTbl?.shadowRoot?.querySelector('.table').style.height = this.parentElement.clientHeight + 'px'; + this.soUsageTbl?.reMeauseHeight(); + // @ts-ignore + this.functionUsageTbl?.shadowRoot?.querySelector('.table').style.height = + this.parentElement!.clientHeight + 'px'; + this.functionUsageTbl?.reMeauseHeight(); + } + }).observe(this.parentElement!); } private calTypeSize(val: any, result: any) { @@ -612,13 +647,35 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { } } if (this.typeMap.has(TYPE_MAP)) { - let mapType = this.setTypeMap(this.typeMap, TYPE_MAP, TYPE_MAP_STRING); - if (mapType) { - this.calPercent(mapType); - this.eventTypeData.push(mapType); + let subTypeMap = new Map>(); + for (let item of this.typeMap.get(TYPE_MAP)!) { + if (item.subType) { + if (subTypeMap.has(item.subType)) { + subTypeMap.get(item.subType)?.push(item); + } else { + let dataArray = new Array(); + dataArray.push(item); + subTypeMap.set(item.subType, dataArray); + } + } else { + if (subTypeMap.has(TYPE_MAP_STRING)) { + subTypeMap.get(TYPE_MAP_STRING)?.push(item); + } else { + let dataArray = new Array(); + dataArray.push(item); + subTypeMap.set(TYPE_MAP_STRING, dataArray); + } + } } + subTypeMap.forEach((arr: Array, subType: any) => { + let mapType = this.setTypeMap(this.typeMap, TYPE_MAP, subType); + if (mapType) { + this.calPercent(mapType); + this.eventTypeData.push(mapType); + } + }); } - this.eventTypeData.sort((a, b) => b.existSize - a.existCount); + this.eventTypeData.sort((a, b) => b.existSize - a.existSize); this.typeStatisticsData = this.totalData(this.typeStatisticsData); this.progressEL!.loading = false; this.currentLevel = 0; @@ -632,7 +689,6 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { this.resetCurrentLevelData(item); for (let itemData of this.processData) { - // @ts-ignore if (!types.includes(itemData.type)) { continue; } @@ -677,9 +733,26 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { this.soData = []; if (!this.processData) return; for (let itemData of this.processData) { - // @ts-ignore - if (!types.includes(itemData.type)) { - continue; + if (typeName === TYPE_ALLOC_STRING) { + if (!types.includes(itemData.type)) { + continue; + } + } else if (typeName === TYPE_MAP_STRING) { + if (!itemData.subType) { + if (!types.includes(itemData.type)) { + continue; + } + } else { + continue; + } + } else { + if (itemData.subType) { + if (!types.includes(itemData.subType) || !types.includes(itemData.type)) { + continue; + } + } else { + continue; + } } let libId = itemData.libId; @@ -730,9 +803,26 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { return; } for (let data of this.processData) { - // @ts-ignore - if (!types.includes(data.type) || data.libId !== libId) { - continue; + if (typeName === TYPE_ALLOC_STRING) { + if (!types.includes(data.type) || data.libId !== libId) { + continue; + } + } else if (typeName === TYPE_MAP_STRING) { + if (!data.subType) { + if (!types.includes(data.type) || data.libId !== libId) { + continue; + } + } else { + continue; + } + } else { + if (data.subType) { + if (!types.includes(data.subType) || !types.includes(data.type) || data.libId !== libId) { + continue; + } + } else { + continue; + } } if (symbolMap.has(data.symbolId)) { symbolMap.get(data.symbolId)?.push(data); @@ -805,27 +895,48 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { let releaseSize = 0; let applyCount = 0; let releaseCount = 0; - let releaseTypeId = tyeId === TYPE_ALLOC ? TYPE_FREE : TYPE_UN_MAP; let currentType = typeMap.get(tyeId); if (!currentType) { return null; } - if (!this.isStatistic) { - if (typeMap.has(releaseTypeId)) { - for (let freeSample of typeMap.get(releaseTypeId)!) { - releaseSize += freeSample.size; - releaseCount += freeSample.count; - } - } - } - for (let applySample of typeMap.get(tyeId)!) { - applySize += applySample.size; - applyCount += applySample.count; - if (this.isStatistic) { - releaseSize += applySample.releaseSize; - releaseCount += applySample.releaseCount; + if (tyeId === TYPE_ALLOC) { + applySize += applySample.size; + applyCount += applySample.count; + if (this.isStatistic) { + releaseSize += applySample.releaseSize; + releaseCount += applySample.releaseCount; + } else { + if (applySample.isRelease) { + releaseSize += applySample.size; + releaseCount += applySample.count; + } + } + } else { + if (this.isStatistic) { + releaseSize += applySample.releaseSize; + releaseCount += applySample.releaseCount; + } + if (applySample.subType) { + if (applySample.subType === typeName) { + applySize += applySample.size; + applyCount += applySample.count; + if (applySample.isRelease) { + releaseSize += applySample.size; + releaseCount += applySample.count; + } + } + } else { + if (typeName === TYPE_MAP_STRING) { + applySize += applySample.size; + applyCount += applySample.count; + if (applySample.isRelease) { + releaseSize += applySample.size; + releaseCount += applySample.count; + } + } + } } } let typeItem = new AnalysisObj(applySize, applyCount, releaseSize, releaseCount); @@ -835,25 +946,6 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { return typeItem; } - calSize(sizeObj: SizeObj, itemData: any): any { - switch (itemData.type) { - case TYPE_ALLOC: - case TYPE_MAP: - sizeObj.applySize += itemData.size; - sizeObj.applyCount += itemData.count; - if (this.isStatistic) { - sizeObj.releaseSize += itemData.releaseSize; - sizeObj.releaseCount += itemData.releaseCount; - } - break; - case TYPE_FREE: - case TYPE_UN_MAP: - sizeObj.releaseSize += itemData.size; - sizeObj.releaseCount += itemData.count; - break; - } - } - private calPercent(item: AnalysisObj) { item.applySizePercent = ((item.applySize / this.currentLevelApplySize) * 100).toFixed(2); item.applyCountPercent = ((item.applyCount / this.currentLevelApplyCount) * 100).toFixed(2); @@ -883,19 +975,29 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { private typeSizeGroup(dbArray: Array): Map> { let typeMap = new Map>(); - if (!dbArray || dbArray.length == 0) { + if (!dbArray || dbArray.length === 0) { return typeMap; } + let that = this; + function setSize(item: any) { + that.currentLevelApplySize += item.size; + that.currentLevelApplyCount += item.count; + if (that.isStatistic) { + that.currentLevelReleaseSize += item.releaseSize; + that.currentLevelReleaseCount += item.releaseCount; + } else { + if (item.isRelease) { + that.currentLevelReleaseSize += item.size; + that.currentLevelReleaseCount += item.count; + } + } + } + for (let itemData of dbArray) { switch (itemData.type) { case TYPE_ALLOC: - this.currentLevelApplySize += itemData.size; - this.currentLevelApplyCount += itemData.count; - if (this.isStatistic) { - this.currentLevelReleaseSize += itemData.releaseSize; - this.currentLevelReleaseCount += itemData.releaseCount; - } + setSize(itemData); if (typeMap.has(TYPE_ALLOC)) { typeMap.get(TYPE_ALLOC)?.push(itemData); } else { @@ -905,12 +1007,7 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { } break; case TYPE_MAP: - this.currentLevelApplySize += itemData.size; - this.currentLevelApplyCount += itemData.count; - if (this.isStatistic) { - this.currentLevelReleaseSize += itemData.releaseSize; - this.currentLevelReleaseCount += itemData.releaseCount; - } + setSize(itemData); if (typeMap.has(TYPE_MAP)) { typeMap.get(TYPE_MAP)?.push(itemData); } else { @@ -919,31 +1016,8 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { typeMap.set(TYPE_MAP, itemArray); } break; - case TYPE_FREE: - this.currentLevelReleaseSize += itemData.size; - this.currentLevelReleaseCount += itemData.count; - if (typeMap.has(TYPE_FREE)) { - typeMap.get(TYPE_FREE)?.push(itemData); - } else { - let itemArray = new Array(); - itemArray.push(itemData); - typeMap.set(TYPE_FREE, itemArray); - } - break; - case TYPE_UN_MAP: - this.currentLevelReleaseSize += itemData.size; - this.currentLevelReleaseCount += itemData.count; - if (typeMap.has(TYPE_UN_MAP)) { - typeMap.get(TYPE_UN_MAP)?.push(itemData); - } else { - let itemArray = new Array(); - itemArray.push(itemData); - typeMap.set(TYPE_UN_MAP, itemArray); - } - break; } } - return typeMap; } @@ -954,13 +1028,13 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { existCount: this.currentLevelExistCount, existCountPercent: ((this.currentLevelExistCount / this.currentLevelExistCount) * 100).toFixed(2), releaseSizeFormat: Utils.getBinaryByteWithUnit(this.currentLevelReleaseSize), - releaseSizePercent:((this.currentLevelReleaseSize / this.currentLevelReleaseSize) * 100).toFixed(2), - releaseCount:this.currentLevelReleaseCount, - releaseCountPercent:((this.currentLevelReleaseCount / this.currentLevelReleaseCount) * 100).toFixed(2), - applySizeFormat:Utils.getBinaryByteWithUnit(this.currentLevelApplySize), - applySizePercent:((this.currentLevelApplySize / this.currentLevelApplySize) * 100).toFixed(2), - applyCount:this.currentLevelApplyCount, - applyCountPercent:((this.currentLevelApplyCount / this.currentLevelApplyCount) * 100).toFixed(2), + releaseSizePercent: ((this.currentLevelReleaseSize / this.currentLevelReleaseSize) * 100).toFixed(2), + releaseCount: this.currentLevelReleaseCount, + releaseCountPercent: ((this.currentLevelReleaseCount / this.currentLevelReleaseCount) * 100).toFixed(2), + applySizeFormat: Utils.getBinaryByteWithUnit(this.currentLevelApplySize), + applySizePercent: ((this.currentLevelApplySize / this.currentLevelApplySize) * 100).toFixed(2), + applyCount: this.currentLevelApplyCount, + applyCountPercent: ((this.currentLevelApplyCount / this.currentLevelApplyCount) * 100).toFixed(2), existSize: 0, tableName: '', libName: '', @@ -978,11 +1052,10 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { sizeObj.releaseCount += item.releaseCount; sizeObj.releaseSize += item.releaseSize; } else { - // @ts-ignore - if ([TYPE_ALLOC, TYPE_MAP].includes(item.type)) { - sizeObj.applyCount += item.count; - sizeObj.applySize += item.size; - } else { + // @ts-ignore + sizeObj.applyCount += item.count; + sizeObj.applySize += item.size; + if (item.isRelease) { sizeObj.releaseCount += item.count; sizeObj.releaseSize += item.size; } @@ -992,8 +1065,9 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { } getTypes(parent: AnalysisObj) { - let types = new Array(); + let types = new Array(); types.push(parent.typeId!); + types.push(parent.typeName!); if (!this.isStatistic) { let releaseType; if (parent.typeId === TYPE_ALLOC) { @@ -1019,6 +1093,7 @@ export class TabPaneNMStatisticAnalysis extends BaseElement { } ); } + getDataByWorkerQuery(args: any, handler: Function) { this.progressEL!.loading = true; procedurePool.submitWithName('logic1', 'native-memory-queryAnalysis', args, undefined, (results: any) => { @@ -1089,7 +1164,7 @@ export class TabPaneNMStatisticAnalysis extends BaseElement {
    - + @@ -1119,7 +1194,7 @@ export class TabPaneNMStatisticAnalysis extends BaseElement {