Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
demo/ | 07-Sep-2024 | - | 1,256 | 1,018 | ||
etc/ | 07-Sep-2024 | - | 49 | 49 | ||
figures/ | 07-Sep-2024 | - | ||||
include/ | 07-Sep-2024 | - | 7,858 | 5,897 | ||
interfaces/ | 07-Sep-2024 | - | 2,186 | 1,471 | ||
proto/ | 07-Sep-2024 | - | 131 | 91 | ||
script/ | 07-Sep-2024 | - | 12,046 | 10,937 | ||
src/ | 07-Sep-2024 | - | 16,693 | 13,953 | ||
test/ | 07-Sep-2024 | - | 19,764 | 13,547 | ||
.clang-format | D | 07-Sep-2024 | 4.5 KiB | 169 | 164 | |
.gitignore | D | 07-Sep-2024 | 116 | 11 | 10 | |
BUILD.gn | D | 07-Sep-2024 | 13.5 KiB | 582 | 497 | |
LICENSE | D | 07-Sep-2024 | 11.3 KiB | 203 | 169 | |
OAT.xml | D | 07-Sep-2024 | 14 KiB | 131 | 76 | |
README.md | D | 07-Sep-2024 | 12.1 KiB | 387 | 264 | |
README_zh.md | D | 07-Sep-2024 | 11.8 KiB | 402 | 275 | |
bundle.json | D | 07-Sep-2024 | 1.4 KiB | 60 | 58 | |
clang_format_all.bat | D | 07-Sep-2024 | 839 | 21 | 18 | |
clang_format_all.sh | D | 07-Sep-2024 | 754 | 19 | 3 | |
hiperf.gni | D | 07-Sep-2024 | 1.9 KiB | 66 | 57 |
README.md
1# hiperf 2 3 4## Introduction 5 6hiperf is a command-line debugging tool provided by OpenHarmony for developers. It can capture performance data of a specific program or the entire system, like the kernel's perf tool. hiperf can run on Windows, Linux, and macOS. 7 8### Architecture 9 10 11 12## Directory Structure 13 14``` 15/developtools/hiperf 16├── demo # Demo program 17│ ├── cpp # C++ demo program, which demonstrates how to call APIs to simulate sampling scenarios. 18│ └── js # JS demo program, which demonstrates how to call APIs. 19├── include # Project header files. 20│ └── nonlinux # Header file for cross compilation (non-Linux platform) 21├── interfaces # APIs 22│ ├── innerkits # C++ APIs. 23│ └── kits # JS APIs 24├── proto # Definition of the data structure exported to proto by the report command 25├── script # Host scripts, including HTML 26│ └── test # Unit test of the script 27├── src # Source code 28└── test # Unit test of the source code 29 30``` 31 32## Constraints 33 34hiperf must be used with Python 3.7.0 or later. 35 36| Dependency | Version | 37| -------- | ----- | 38| Python | 3.7.0 | 39| | | 40 41 42 43## Building 44 45#### Basic Settings 46 47- Ensure that the hiperf component name is in the JSON file of the Product Definition. 48 - [Product Definition](https://gitee.com/openharmony/productdefine_common) 49 - Add `"developtools:hiperf":{}`. 50 51 52#### Build Commands 53 54|Description |Parameter | 55| -------------------------------------- | ----------------------------------- | 56| Build only the binary executable files of the current device platform. | --build-target hiperf_target | 57| Build all components (including unit tests) of all platforms. | --build-target hiperf_all | 58| Build the tool for x86_64 Linux. | --gn-args "hiperf_target_host=true" | 59| Build the unit test. | --build-target hiperf_unittest | 60| Build the unit test interface (command line). | --build-target hiperf_interfacetest | 61 62 63#### Output #### 64 65| Build Target | Running Platform | File Location | File Name | 66| ----------------- | -------- | ----------------------------------------------------- | -------------------- | 67| Dev command-line program | arm | out\ohos-arm-release\developtools\hiperf\hiperf | hiperf | 68| | linux | out\ohos-arm-release\clang_x64\developtools\hiperf | hiperf | 69| Host command-line program | Linux | out\ohos-arm-release\clang_x64\developtools\hiperf | hiperf_host | 70| | Windows | out\ohos-arm-release\mingw_x86_64\developtools\hiperf | hiperf_host.exe | 71| Dynamic library of the host | Linux | out\ohos-arm-release\clang_x64\developtools\hiperf | libhiperf_report.so | 72| | Windows | out\ohos-arm-release\mingw_x86_64\developtools\hiperf | libhiperf_report.dll | 73 74You can also run **developtools/hiperf/script/package.sh** after the build to package the files to the **out** folder. 75 76``` 77host/ 78└── developtools 79 ├── hiperf 80 │ ├── bin # All binary files 81 │ │ ├── linux # Linux platform 82 │ │ │ └── x86_64 83 │ │ │ ├── hiperf_host # Executable program run by the PC. The Report and Dump commands are supported. 84 │ │ │ └── libhiperf_report.so # Lib file run by the PC. It is used by the Python script. 85 │ │ ├── ohos 86 │ │ │ └── arm # Arm platform 87 │ │ │ └── hiperf # Executable program run by the board 88 │ │ └── windows # Windows 89 │ │ └── x86_64 90 │ │ ├── hiperf_host.exe # Executable program run by the PC 91 │ │ └── libhiperf_report.dll # Lib file run by the PC 92 │ │ 93 │ │ # Python files run by the PC 94 │ ├── command_script.py # Script of the hiperf commands, used to generate sampling data 95 │ ├── hiperf_utils.py # Utility class of hiperf 96 │ ├── loadlib_test.py # Lib test script 97 │ ├── make_diff.py # Script used to generate Diff data 98 │ ├── make_report.py # Script used to generate a report from the sampled data 99 │ ├── recv_binary_cache.py # Script used to collect the symbol table 100 │ └── report.html # Template of the HTML display page 101 └── hiperf.tar.gz # Package of the preceding files 102 103``` 104 105 106 107#### hiperf with Debug Symbols 108 109Find **exe.unstripped** and **lib.unstripped** in the **out** directory. For example: 110 111out\ohos-arm-release\clang_x64\exe.unstripped\clang_x64\developtools\hiperf 112 113 114 115## Usage 116 117### Test Code 118 119Test code is provided in **hiperf_example_cmd.cpp** to verify sampling functions of thread scheduling, memory allocation, and CPU load. 120 121The code is located in: 122 123``` 124hiperf\demo\cpp\hiperf_example_cmd.cpp 125``` 126 127Help information about the test command: 128 129``` 130 ./hiperf_example_cmd --help 131this is a demo test command 132 Use the following commands to simulate different scenarios 133 --help 134 this page 135 --thread <number> 136 setup the thread number, default is 5 second 137 --time <time> 138 setup run sec, default is 10 second 139 --stack <level> 140 setup stack level, default is 5 141 --nowait 142 setup skip the start, default wait the start 143 --dynamic 144 will run some code in each stack level 145 --mmap 146 will run mmap code in the loop 147``` 148 149 150 151### Main Command Format 152 153``` 154hiperf [options] COMMAND [args for command] 155``` 156 157 158 159- [options] 160 - Optional parameter. 161 - Debugging commands, such as enabling the logging function. 162- COMMAND 163 - Mandatory parameter. 164 - Name of a sub-function, for example, **record** or **report**. 165- [args for command] 166 - Parameters of the sub-function 167 168### help 169 170You can run the **--help** command to view help information. 171 172``` 173--help [command] 174 175[command] --help 176``` 177 178Both formats are supported. 179 180### Parameters 181 182| Parameter | Description | 183| ------------------------------- | -------------------------------- | 184| --help [command] | Displays the help information about the specified function. | 185| --debug | Enables the debug logs of the DEBUG level. | 186| --verbose | Enables the debug logs of the VERBOSE level. | 187| --much | Enables the debug logs of the MUCH level. | 188| --mixlog | Displays mixed debug logs to the screen (stdout).| 189| --logtag <tagA [,tagB] [,tagC]> | Enables the debug logs of the MUCH level for the specified module.| 190| --hilog | Prints logs to Hilog. | 191| --logpath | Specifies the log path. | 192| --nodebug | Stops printing any logs. | 193 194### list 195 196The **list** command lists all the perf events supported by the performance monitoring unit (PMU). 197 198The event names are used for the **-e** and **-g** parameters of the **stat** and **record** commands. 199 200``` 201Usage: hiperf list [event type name] 202``` 203 204List the hardware events supported by the PMU. The command also lists the events that are not supported by the PMU. 205 206``` 207hiperf list hw 208``` 209 210### stat 211 212The **stat** command monitors the specified application and periodically prints the values of performance counters. 213 214``` 215Usage: hiperf stat [options] [command [command-args]] 216 Collect performance counter information of running [command]. 217``` 218 219Monitor the performance counter of the process on CPU 0 for 3 seconds. 220 221``` 222hiperf stat -a -d 3 -c 0 223``` 224 225### record 226 227The **record** command samples the specified application and saves the sampling data to a file (**perf.data** by default). 228 229``` 230Usage: hiperf record [options] [command [command-args]] 231 Collect performance sampling information of running [command]. 232``` 233 234Sample all processes in the system for 3 seconds and display detailed log information. 235 236``` 237hiperf record -d 3 -a --verbose 238``` 239 240### dump 241 242The **dump** command reads the **perf.data** file without processing it. 243 244You can verify the correctness of the raw sampling data. 245 246``` 247Usage:hiperf dump [option] \<filename\> 248 Dump specific parts of specified file. 249``` 250 251### report 252 253The **report** command displays the sampling data (read from **perf.data**) and converts it to the required format (for example, JSON or ProtoBuf). 254 255``` 256Usage: hiperf report [option] \<filename\> 257 Displays the sampling data. 258``` 259 260Output a common report, with the minimum display percentage of 1%. 261 262``` 263hiperf report --limit-percent 1 264``` 265 266### Scripts 267 268Run scripts to perform sampling operations (which can easily generate HTML reports). 269 270##### Sampling 271 272Run **command_script.py** to sample data. This script is the packaging script of the **report** command. 273 274``` 275Usage: command_script.py [-h] 276 (-app PACKAGE_NAME | -lp LOCAL_PROGRAM | -cmd CMD | -p [PID [PID ...]] | -t [TID [TID ...]] | -sw) 277 [-a ABILITY] [-r RECORD_OPTIONS] [-lib LOCAL_LIB_DIR] 278 [-o OUTPUT_PERF_DATA] [--not_hdc_root] 279 280Collect performance sampling information of running [command]. 281``` 282 283Sample the **com.ohos.launch** package. 284 285``` 286python command_script.py -app com.ohos.launch 287``` 288 289Sample the hdcd process. 290 291``` 292python command_script.py -lp hdcd 293``` 294 295##### Collecting Symbol Tables 296 297Run **recv_binary_cache.py** to collect symbol tables. The tool searches for the ELF in the specified paths based on the related files and libraries recorded in **perf.data** and their **buildid**s. 298 299``` 300Usage: recv_binary_cache.py [-h] [-i PERF_DATA] 301 [-l LOCAL_LIB_DIR [LOCAL_LIB_DIR ...]] 302 303Recv binaries needed by perf.data from device to binary_cache directory. 304``` 305 306The following specifies two symbol table paths. 307 308``` 309python recv_binary_cache.py -l Z:\OHOS_MASTER\out\ohos-arm-release\lib.unstripped Z:\OHOS_MASTER\out\ohos-arm-release\exe.unstripped 310``` 311 312The symbol table files will be copied to the **binary_cache** folder. 313 314The tool preferentially searches for the specified symbol table paths. If no path is specified, the tool copies the files in the device. 315 316##### Displaying Sampled Data 317 318Run **make_report.py** to display the sampled data in an HTML page. 319 320``` 321Usage: make_report.py [-h] [-i PERF_DATA] [-r REPORT_HTML] 322 323To make a report, you need to enter the data source and the path of the 324report. 325``` 326 327An HTML file is generated. The default file name is **hiperf_report.html**. 328 329``` 330python make_report.py 331``` 332 333- Displaying the home page 334 335 336 337- Displaying the flame graph. 338 339 340 341## Troubleshooting 342 343#### Can't find hdc_std in PATH environment. 344 345``` 346python command_script.py -lp ps 347['../..\\..\\platform-tools\\hdc', 'version'] 348['hdc', 'version'] 349Traceback (most recent call last): 350 File "command_script.py", line 367, in <module> 351 main(parser_add_argument()) 352 File "command_script.py", line 361, in main 353 profiler = PerformanceProfile(args) 354 File "command_script.py", line 143, in __init__ 355 self.hdc = HdcInterface(root_authority=not args.not_hdc_root) 356 File "Z:\OHOS_MASTER\out\host\developtools\hiperf\hiperf_utils.py", line 173, in __init__ 357 raise Exception("Can't find hdc in PATH environment.") 358Exception: Can't find hdc_std in PATH environment. 359``` 360 361Check whether the **PATH** environment variable contains the hdc executable file. 362 363Run the following commands: 364 365``` 366where hdc_std 367Z:\OHOS_MASTER\developtools\hdc_standard\prebuilt\windows\hdc_std.exe 368Z:\OHOS_STD_2.0\developtools\hdc_standard\prebuilt\windows\hdc_std.exe 369``` 370 371 372 373 374## Repositories Involved 375 376Development Toolchain Subsystem 377 378[**developtools\hiperf**](https://gitee.com/openharmony/developtools_hiperf) 379 380[developtools\developtools_profiler](https://gitee.com/openharmony/developtools_profiler) 381 382[developtools\developtools_bytrace](https://gitee.com/openharmony/developtools_bytrace) 383 384[third_party\libunwind](https://gitee.com/openharmony/third_party_libunwind) 385 386[third_party\protobuf](https://gitee.com/openharmony/third_party_protobuf) 387
README_zh.md
1# hiperf 应用性能优化剖析组件 2 3- [简介](#简介) 4 - [架构](#架构) 5 6- [约束](#约束) 7- [编译构建](编译构建) 8- [目录](#目录) 9 - [使用说明](#使用说明) 10 - [接口说明](#接口说明) 11- [相关仓](相关仓) 12 13## 简介 14 15hiperf 是 OpenHarmony 为开发人员提供的用于调试的命令行工具,用于抓取特定程序或者系统的性能数据,类似内核的 perf 工具,该工具支持在 Windows/Linux/Mac 等操作系统上运行。 16 17### 架构 18 19 20 21## 目录 22 23``` 24/developtools/hiperf 25├── demo # demo 程序 26│ ├── cpp # C++ demo 程序,示范了如何调用API和模拟的采样场景 27│ └── js # JS demo 程序,示范了如何调用API 28├── include # 工程的头文件 29│ └── nonlinux # 交叉编译的头文件(非linux平台) 30├── interfaces # 接口忘记 31│ ├── innerkits # C++ API 接口 32│ └── kits # JS API 接口 33├── proto # report 命令导出到proto的数据结构定义 34├── script # Host 脚本,包括 HTML 35│ └── test # 脚本的单元测试 36├── src # 源代码文件夹 37└── test # 源代码的单元测试 38 39``` 40 41## 约束 42 43运行环境条件约束如下 44 45| 依赖组件 | 版本 | 46| -------- | ----- | 47| Python | 3.7.0 | 48| | | 49 50 51 52## 编译构建 53 54#### 基础配置 55 56- 确保组件名在于产品形态配置的 json 中 57 - [产品形态配置](https://gitee.com/openharmony/productdefine_common) 58 - 加入 `"developtools:hiperf":{}` 即可 59 60 61#### 编译命令 62 63| 编译说明 | 编译参数 | 64| -------------------------------------- | ----------------------------------- | 65| 只编译当前设备平台的二进制执行文件 | --build-target hiperf_target | 66| 编译所有的平台的所有组件(包括单元测试) | --build-target hiperf_all | 67| 编译目标为 x86_64 Linux 平台的工具 | --gn-args "hiperf_target_host=true" | 68| 编译单元测试 | --build-target hiperf_unittest | 69| 编译单元测试的接口部分(命令行部分) | --build-target hiperf_interfacetest | 70 71 72#### 编译输出 #### 73 74| 编译目标 | 运行平台 | 文件位置 | 文件名 | 75| ----------------- | -------- | ----------------------------------------------------- | -------------------- | 76| Dev 端命令行程序 | arm | out\ohos-arm-release\developtools\hiperf\hiperf | hiperf | 77| | linux | out\ohos-arm-release\clang_x64\developtools\hiperf | hiperf | 78| Host 端命令行程序 | linux | out\ohos-arm-release\clang_x64\developtools\hiperf | hiperf_host | 79| | windows | out\ohos-arm-release\mingw_x86_64\developtools\hiperf | hiperf_host.exe | 80| Host 端动态库 | linux | out\ohos-arm-release\clang_x64\developtools\hiperf | libhiperf_report.so | 81| | windows | out\ohos-arm-release\mingw_x86_64\developtools\hiperf | libhiperf_report.dll | 82 83也可以在编译完成后 84 85运行 developtools/hiperf/script/package.sh 打包到out文件夹中 86 87``` 88host/ 89└── developtools 90 ├── hiperf 91 │ ├── bin # 所有的二进制文件 92 │ │ ├── linux # linux 平台 93 │ │ │ └── x86_64 94 │ │ │ ├── hiperf_host # PC运行的执行程序,支持Report和Dump命令 95 │ │ │ └── libhiperf_report.so # PC运行的LIB文件,供python脚本使用 96 │ │ ├── ohos 97 │ │ │ └── arm # arm 平台 98 │ │ │ └── hiperf # 板端执行程序 99 │ │ └── windows # windows 平台 100 │ │ └── x86_64 101 │ │ ├── hiperf_host.exe # PC运行的执行程序 102 │ │ └── libhiperf_report.dll # PC运行的LIB文件 103 │ │ 104 │ │ # 下面都是python文件,在PC侧执行 105 │ ├── command_script.py # hiperf 命令行的包装脚本,产生采样数据 106 │ ├── hiperf_utils.py # 脚本自己的工具类 107 │ ├── loadlib_test.py # lib 测试脚本 108 │ ├── make_diff.py # 产生Diff数据的脚本 109 │ ├── make_report.py # 从采样数据产生报告的脚本 110 │ ├── recv_binary_cache.py # 收集符号表的脚本 111 │ └── report.html # HTML 展示页面的模板 112 └── hiperf.tar.gz # 上述文件的打包文件 113 114``` 115 116 117 118#### 带调试符号的版本 119 120- 在对应的平台out里面找 exe.unstripped 和 lib.unstripped,例如: 121 122 - out\ohos-arm-release\clang_x64\exe.unstripped\clang_x64\developtools\hiperf 123 124 125 126## 使用说明 127 128### 测试代码 129 130我们在 hiperf_example_cmd.cpp 里面提供了一些测试代码, 131 132用来验证一些采样功能,比如线程调度,内存申请,CPU 负荷等等。 133 134代码位于 135 136``` 137hiperf\demo\cpp\hiperf_example_cmd.cpp 138``` 139 140测试命令帮助 141 142``` 143 ./hiperf_example_cmd --help 144this is a demo test command 145 Use the following commands to simulate different scenarios 146 --help 147 this page 148 --thread <number> 149 setup the thread number, default is 5 second 150 --time <time> 151 setup run sec, default is 10 second 152 --stack <level> 153 setup stack level, default is 5 154 --nowait 155 setup skip the start, default wait the start 156 --dynamic 157 will run some code in each stack level 158 --mmap 159 will run mmap code in the loop 160``` 161 162 163 164### 主要的命令格式 165 166``` 167hiperf [options] COMMAND [args for command] 168``` 169 170 171 172- [options] 173 - 可选的参数 174 - 主要是一些调试命令,如打开log等 175- COMMAND 176 - 必选参数 177 - 子功能的名字,如recrod,report 等等 178- [args for command] 179 - 子功能的参数 180 181### 帮助命令 182 183可以用 --help 查看帮助 184 185``` 186--help [command] 187 188[command] --help 189``` 190 191以上两种格式都是可以的 192 193### 主命令参数 194 195| 参数 | 功能说明 | 196| ------------------------------- | -------------------------------- | 197| --help [command] | 显示指定功能的帮助信息 | 198| --debug | 打开 DEBUG 级别的调试日志 | 199| --verbose | 打开 VERBOSE 级别的调试日志 | 200| --much | 打开 MUCH 级别的调试日志 | 201| --mixlog | 混合调试日志输出到屏幕上(stdout) | 202| --logtag <tagA [,tagB] [,tagC]> | 打开指定模块的MUCH级别的调试日志 | 203| --hilog | 日志打印到Hilog中 | 204| --logpath | 指定日志保存的路径 | 205| --nodebug | 停止打印任何日志 | 206 207### list 命令 208 209列出设备上支持的所有事件名称 210 211事件名称用于 stat 和 record 的 -e 和 -g 参数 212 213``` 214Usage: hiperf list [event type name] 215``` 216 217下面列出了设备支持的HW事件,并且会提示哪些事件此设备不支持 218 219``` 220hiperf list hw 221``` 222 223### stat 命令 224 225监听指定目标程序,周期性打印性能计数器的值 226 227``` 228Usage: hiperf stat [options] [command [command-args]] 229 Collect performance counter information of running [command]. 230``` 231 232下面展示了一个 stats 监听本进程 在 CPU 0 上 3 秒的性能计数器命令 233 234``` 235hiperf stat -a -d 3 -c 0 236``` 237 238### record 命令 239 240采样指定目标程序,并且将采样数据保存到指定的文件中(默认为perf.data) 241 242``` 243Usage: hiperf record [options] [command [command-args]] 244 Collect performance sampling information of running [command]. 245``` 246 247对全系统所有进程采样3秒,并且显示详细的信息 248 249``` 250hiperf record -d 3 -a --verbose 251``` 252 253### dump 命令 254 255此命令主要用于以不加以处理的方式直接读取perf.data的数据 256 257开发和测试人员可以核对其中的原始采样数据的正确性。 258 259``` 260Usage: hiperf dump [option] \<filename\> 261 Dump specific parts of specified file. 262``` 263 264### report 命令 265 266此命令主要用于展示相关采样数据(从perf.data中读取) 267 268并且转换为用户需要的格式(比如Json或者ProtoBuf) 269 270``` 271Usage: hiperf report [option] \<filename\> 272 Displays the sampling data. 273``` 274 275范例输出普通报告的命令,限制为占比不超过1% 276 277``` 278hiperf report --limit-percent 1 279``` 280 281### 脚本 282 283一般用户用脚本执行采样操作(因为可以简单的产生HTML报告) 284 285##### 采样 286 287由 command_script.py 完成,他是 report 命令的包装脚本 288 289``` 290usage: command_script.py [-h] 291 (-app PACKAGE_NAME | -lp LOCAL_PROGRAM | -cmd CMD | -p [PID [PID ...]] | -t [TID [TID ...]] | -sw) 292 [-a ABILITY] [-r RECORD_OPTIONS] [-lib LOCAL_LIB_DIR] 293 [-o OUTPUT_PERF_DATA] [--not_hdc_root] 294 295Collect performance sampling information of running [command]. 296``` 297 298对指定包名采样,包名是 com.ohos.launch 299 300``` 301python command_script.py -app com.ohos.launch 302``` 303 304对特定进程采样,进程名称是 hdcd 305 306``` 307python command_script.py -lp hdcd 308``` 309 310##### 收集符号表 311 312由 recv_binary_cache.py 完成,他主要根据 perf.data 里面记录的相关文件和库,以及它们的 buildid 在用户指定的路径中去寻找对应的 ELF 作为符号表文件用于回栈或者打印函数名等。 313 314``` 315usage: recv_binary_cache.py [-h] [-i PERF_DATA] 316 [-l LOCAL_LIB_DIR [LOCAL_LIB_DIR ...]] 317 318Recv binaries needed by perf.data from device to binary_cache directory. 319``` 320 321指定了2个符号表路径的位置 322 323``` 324python recv_binary_cache.py -l Z:\OHOS_MASTER\out\ohos-arm-release\lib.unstripped Z:\OHOS_MASTER\out\ohos-arm-release\exe.unstripped 325``` 326 327对应的符号表文件会复制到 binary_cache 文件夹里面 328 329优先检查用户给出的符号表位置,如果没有则复制设备中的文件 330 331##### 展示 332 333由 make_report.py 完成,将采样后的数据导出为HTML展示页面 334 335``` 336usage: make_report.py [-h] [-i PERF_DATA] [-r REPORT_HTML] 337 338To make a report, you need to enter the data source and the path of the 339report. 340``` 341 342产生HTML文件,默认的文件名是 hiperf_report.html 343 344``` 345python make_report.py 346``` 347 348- 展示页面首页 349 350 351 352- 展示页面火焰图 353 354 355 356## 常见故障说明 357 358#### Can't find hdc_std in PATH environment. 359 360``` 361python command_script.py -lp ps 362['../..\\..\\platform-tools\\hdc', 'version'] 363['hdc', 'version'] 364Traceback (most recent call last): 365 File "command_script.py", line 367, in <module> 366 main(parser_add_argument()) 367 File "command_script.py", line 361, in main 368 profiler = PerformanceProfile(args) 369 File "command_script.py", line 143, in __init__ 370 self.hdc = HdcInterface(root_authority=not args.not_hdc_root) 371 File "Z:\OHOS_MASTER\out\host\developtools\hiperf\hiperf_utils.py", line 173, in __init__ 372 raise Exception("Can't find hdc in PATH environment.") 373Exception: Can't find hdc_std in PATH environment. 374``` 375 376请确认 PATH 环境变量中有 hdc 的执行文件 377 378确认方法 379 380``` 381where hdc_std 382Z:\OHOS_MASTER\developtools\hdc_standard\prebuilt\windows\hdc_std.exe 383Z:\OHOS_STD_2.0\developtools\hdc_standard\prebuilt\windows\hdc_std.exe 384``` 385 386 387 388 389## 相关仓 390 391研发工具链子系统 392 393[**developtools\hiperf**](https://gitee.com/openharmony/developtools_hiperf) 394 395[developtools\developtools_profiler](https://gitee.com/openharmony/developtools_profiler) 396 397[developtools\developtools_bytrace](https://gitee.com/openharmony/developtools_bytrace) 398 399[third_party\libunwind](https://gitee.com/openharmony/third_party_libunwind) 400 401[third_party\protobuf](https://gitee.com/openharmony/third_party_protobuf) 402