Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
figures/ | 12-May-2024 | - | ||||
ide/ | 12-May-2024 | - | 195,498 | 170,603 | ||
patches/ | 12-May-2024 | - | 138 | 130 | ||
trace_streamer/ | 12-May-2024 | - | 101,945 | 83,731 | ||
.gitignore | D | 12-May-2024 | 308 | 19 | 19 | |
BUILD.gn | D | 12-May-2024 | 648 | 16 | 15 | |
LICENSE | D | 12-May-2024 | 11.1 KiB | 202 | 169 | |
OAT.xml | D | 12-May-2024 | 5.6 KiB | 81 | 26 | |
README.md | D | 12-May-2024 | 6.6 KiB | 71 | 67 | |
README_zh.md | D | 12-May-2024 | 6 KiB | 71 | 67 | |
bundle.json | D | 12-May-2024 | 804 | 39 | 39 |
README.md
1# Smartperf_Host 2## Introduction 3Smartperf_Host is an intuitive performance and power optimization tool that offers in-depth data mining and fine-grained data visualization. With this tool, you can gain visibility into a multitude of metrics in terms of CPU scheduling, frequency, process and thread time slices, heap memory, frame rate, and more, in swimlanes. Better yet, you can analyze the collected data intuitively on the GUI. 4## Architecture 5 6 7Smartperf_Host consists of the device end and PC end, which exchange data with each other based on gRPC – a high-performance remote procedure call (RPC) framework. 8 9The device end consists of modules such as Native Hook (application-embedded component), hiprofiler_command (command-line tool), hiprofilerd (performance profiler service), a set of performance profiler plug-ins, and some system tools and kernels. The device end provides the plug-in extension capability by exposing plug-in interfaces for external systems. By drawing on this capability, you can integrate custom plug-ins into the framework. For details about the preset plug-ins, see [Performance Profiler Component](https://gitee.com/openharmony/developtools_profiler). 10 11The PC end is accessible from the Smartperf_Host website. It consists of modules such as Trace Streamer, SQLite, HDC device management, data import, UI drawing, and data analysis. 12## Project Directory 13``` 14/developtools/smartperf_host 15├── figures # Image resources 16├── ide # Smartperf_Host IDE module 17│ └── src # Profiler module 18│ │ ├── base-ui # Basic components 19│ │ └── Trace # Service logic 20├── trace_streamer # Trace Streamer module 21│ ├── base # Basic functionality 22│ ├── cfg # Configuration 23│ ├── filter # Filter 24│ ├── include # Header files 25│ ├── multi_platform # Platform adaptation 26│ ├── parser # Parsing service logic 27│ │ ├── bytrace_parser # byTrace service logic 28│ │ └── htrace_parser # hTrace service logic 29│ ├── table # Table structure 30│ ├── trace_data # Trace structure 31│ ├── trace_streamer # Trace Streamer structure 32│ └── kits # JS APIs and native APIs 33``` 34## Functions 35### Loading Trace Files on Web Pages 36Load local trace files (such as htrace and ftrace) and display the data in swimlanes. For details, see [Loading Trace Files on Web Pages](./ide/src/doc/md/quickstart_systemtrace.md). 37### Capturing Traces Online 38Use Smartperf_Host to capture traces online, with the content, duration, and save path all customizable. For details, see [Capturing Traces on Web Pages](./ide/src/doc/md/quickstart_web_record.md). 39### Capturing Traces on a Device 40Capture traces on the target device, with the content, duration, and save path all customizable. For details, see [Capturing Traces from a Device](./ide/src/doc/md/quickstart_device_record.md). 41### Using Ability Monitor 42With Ability Monitor in Smartperf_Host, you can learn the CPU, memory, disk I/O, and network usage of your application. For details, see [Ability Monitor Usage](./ide/src/doc/md/quickstart_ability_monitor.md). 43### Using Native Memory 44With Native Memory in Smartperf_Host, you can track the allocation and release of your application's native memory (specific to C and C++). For details, see [Native Memory Usage](./ide/src/doc/md/quickstart_native_memory.md). 45### Using Hiperf 46With Hiperf in Smartperf_Host, you can view the CPU usage of your application and the call stack. For details, see [Hiperf Usage](./ide/src/doc/md/quickstart_hiperf.md). 47### Using HiSystemEvent 48With HiSystemEvent in Smartperf_Host, you can inspect the power consumption of each category (CPU, network, and location, and more) of your application, resource application and usage records (WorkScheduler, Runninglock, Alarm, and Location Request), power consumption exceptions, and system states associated with the power consumption (battery level and screen status). For details, see [HiSystemEvent Usage](./ide/src/doc/md/quickstart_hisystemevent.md). 49### Collecting FileSystem Records 50In Smartperf_Host, you can find out the system invoking information and read/write invoking times of all file systems. For details, see [Usage of FileSystem Recording](./ide/src/doc/md/quickstart_filesystem.md). 51### Collecting Page Fault Records 52In Smartperf_Host, you can collect page fault records, covering various aspects such as start time, duration, triggering process, triggering thread, event type, memory address, and memory size of page memory events. For details, see [Usage of Page Fault Recording](./ide/src/doc/md/quickstart_page_fault.md). 53### Collecting BIO Records 54In Smartperf_Host, you can collect I/O operation records, which provide the following information: start time, total latency, process, average latency of every 4 KB data, thread, operation (write data, page swap-in, and metadata), access traffic, path, block number, priority, and backtrace call stack. For details, see [Usage of BIO Latency Recording](./ide/src/doc/md/quickstart_bio.md). 55### Collecting Smaps Records 56In Smartperf_Host, you can collect the smaps data (type, Pss, Rss, Vss, and more) on a process-by-process basis. The data source is **/proc/$pid/smaps**. For details, see [Smaps Usage](./ide/src/doc/md/quickstart_smaps.md). 57### Using SQL Analysis and Metrics 58You can Query (SQL) and Metrics features to quickly locate the trace data. For details, see [SQL Analysis and Metrics Usage](./ide/src/doc/md/quickstart_sql_metrics.md). 59## Compilation Guidance 60Project compilation includes Trace Streamer compilation and Smartperf_Host compilation and deployment. 61### Prerequisites 62- C++ version: 11 or later 63- Node.js version: 16.15.1 or later 64- npm version: 8.13.2 or later 65- TypeScript version: 4.2.3 or later 66- Go version: 1.13.8 or later 67### Compiling Trace Streamer 68To set up the Smartperf_Host website, you need to compile the WASM version of Trace Streamer for the web page to parse the original trace data. For details about the compilation process, see [Compiling Trace Streamer](./trace_streamer/doc/compile_trace_streamer.md). 69### Compiling and Deploying Smartperf_Host 70For details about the compilation and deployment process, see [SmartPerf Compilation and Deployment Guide](./ide/README_zh.md). After successful deployment, you can start to use Smartperf_Host by visiting **https://[*IP address of the device where SmartPerf is deployed*]:9000/application/**. 71
README_zh.md
1# Smartperf_Host 2## 简介 3Smartperf_Host是一款深入挖掘数据、细粒度地展示数据的性能功耗调优工具,旨在为开发者提供一套性能调优平台,支持对CPU调度、频点、进程线程时间片、堆内存、帧率等数据进行采集和展示,展示方式为泳道图,支持GUI(图形用户界面)操作进行详细数据分析。 4## 架构图 5 6 7该组件整体分为设备端和PC端两部分,设备端和PC端基于gRPC(Remote Procedure Call)通信框架进行数据交互。 8 9设备端内部分为应用程序内嵌组件、命令行工具、性能调优服务、性能调优插件集合、部分系统工具及部分系统内核等模块。设备端提供了插件扩展能力,对外提供了插件接口,基于该扩展能力可以按需定义自己的能力,并集成到框架中来,目前基于插件能力已经完成了native内存插件、trace插件等,详细介绍见[性能调优组件](https://gitee.com/openharmony/developtools_profiler)。 10 11PC端以Smartperf_Host网站的形式进行发布,内部分为Trace Streamer数据解析、SQLite数据存储、hdc设备管理、数据导入、UI绘制、数据分析等模块。下文会重点对Smartperf_Host提供的各项能力进行介绍。 12## 项目目录 13``` 14/developtools/smartperf_host 15├── figures # 图片资源 16├── ide # Smartperf_Host IDE 模块目录 17│ └── src # 主机测调优模块代码 18│ │ ├── base-ui # 基础组件目录 19│ │ └── Trace # 业务逻辑目录 20├── trace_streamer # 解析模块代码目录 21│ ├── base # 基础功能 22│ ├── cfg # 配置目录 23│ ├── filter # Filter 功能 24│ ├── include # Include 头文件 25│ ├── multi_platform # 平台适配 26│ ├── parser # 解析业务逻辑 27│ │ ├── bytrace_parser # byTrace 解析业务逻辑 28│ │ └── htrace_parser # hTrace 解析业务逻辑 29│ ├── table # 表结构 30│ ├── trace_data # trace 结构 31│ ├── trace_streamer # traceStreamer 结构 32│ └── kits # js/napi 接口存放目录 33``` 34## 功能介绍 35### 网页加载trace 36使用Smartperf_Host加载保存在本地的trace文件(htrace、ftrace等)并显示数据到泳道图中,trace数据分析详见《[网页加载trace说明](./ide/src/doc/md/quickstart_systemtrace.md)》。 37### 网页抓取trace 38使用Smartperf_Host在线抓取trace,可以自定义抓取内容、抓取时长、trace保存路径,详见《[网页抓取trace说明](./ide/src/doc/md/quickstart_web_record.md)》。 39### 设备抓取trace 40在设备端抓取trace,可以自定义抓取内容、抓取时长、trace保存路径,详见《[设备端抓取trace说明](./ide/src/doc/md/quickstart_device_record.md)》。 41### Ability Monitor抓取 42使用Smartperf_Host抓取应用的CPU、内存、磁盘IO和网络的使用情况,详见《[Ability Monitor抓取和展示说明](./ide/src/doc/md/quickstart_ability_monitor.md)》。 43### Native Memory抓取 44使用Smartperf_Host抓取应用的Native Memory(C和C++部分)的分配和释放情况,详见《[Native Memory抓取和展示说明](./ide/src/doc/md/quickstart_native_memory.md)》。 45### Hiperf抓取 46使用Smartperf_Host抓取应用的cpu使用量、方法的调用栈等,详见《[HiPerf的抓取和展示说明](./ide/src/doc/md/quickstart_hiperf.md)》。 47### HiSystemEvent抓取 48使用Smartperf_Host抓取应用的各个子类别功耗占比(CPU、网络、定位等)、应用的资源申请使用记录(WorkScheduler、Runninglock、Alarm、Location Request)、应用功耗异常事件显示、功耗关联系统状态显示(电池电量、屏幕状态),详见《[HiSystemEvent的抓取和展示说明](./ide/src/doc/md/quickstart_hisystemevent.md)》。 49### FileSystem抓取 50使用Smartperf_Host抓取所有文件系统系统调用信息、读写调用次数等,详见《[FileSystem的抓取和展示说明](./ide/src/doc/md/quickstart_filesystem.md)》。 51### 页内存抓取 52使用Smartperf_Host抓取页内存相关事件的开始时间、持续时间、触发进程、触发线程、事件类型、内存地址、内存大小等,详见《[页内存的抓取和展示说明](./ide/src/doc/md/quickstart_page_fault.md)》。 53### Bio抓取 54使用Smartperf_Host抓取每次IO访问的起始时间、总延迟、进程、每4k数据的平均延迟、线程、操作(写数据、页面换入、Metadata)、访问量、路径等、Block number、优先级、Backtrace调用栈,详见《[Bio的抓取和展示说明](./ide/src/doc/md/quickstart_bio.md)》。 55### 进程Smaps抓取 56使用Smartperf_Host抓取单个进程的smaps数据(类别、Pss、Rss、Vss等),数据源为/proc/$pid/smaps,详见《[进程smaps的抓取和展示说明](./ide/src/doc/md/quickstart_smaps.md)》。 57### Sql分析和Metrics说明 58Smartperf_Host网站trace解析完成后在线数据库使用说明,详见《[Sql分析和Metrics说明](./ide/src/doc/md/quickstart_sql_metrics.md)》。 59## 编译指南 60项目编译主要包括两部分,Trace Streamer编译和Smartperf_Host编译部署。 61### 构建约束 62- C++ 11或以上 63- node 版本 >= 16.15.1 64- npm 版本 >= 8.13.2 65- TypeScript 版本 >= 4.2.3 66- golang 版本 >= 1.13.8 67### Trace Streamer编译 68搭建Smartperf_Host网站需要编译出trace_streamer的wasm版本供网页端进行原始trace数据解析工作,具体的编译过程参考《[如何独立编译Trace Streamer](./trace_streamer/doc/compile_trace_streamer.md)》。 69### Smartperf_Host编译部署 70具体的编译部署过程参考《[SmartPerf 编译部署指导](./ide/README_zh.md)》,部署成功后通过浏览器访问页面 https://[部署机器ip地址]:9000/application/ 即可使用Smartperf_Host的全部功能。 71