1# SmartPerf User Guide 2 3## Introduction 4 5SmartPerf Device is a reliable, easy-to-use performance and power consumption test tool. In this tool, you can monitor the performance and power consumption of your application and device with quantitative indicators, such as FPS, CPU, GPU, RAM, and Temp. 6 7<!--Del-->Targeted at devices with or without screens, SmartPerf Device provides two modes: Device-hap and Device-daemon. Device-hap is applicable to devices with screens and provides a visualized, intuitive UI that simplifies your operations. <!--DelEnd-->You can start and pause a test with a floating window, view performance data in real time, and save the test results for further analysis. Device-daemon is applicable to devices with and without screens and works with shell commands. 8 9### Indicators 10 11- CPU: The tool reads the frequencies and usage of CPU cores on the test device on a per second basis to measure the CPU usage of the target application. Sustained high CPU may lead to overheating. 12- GPU: The tool reads the GPU frequency and load information of the test device on a per second basis to measure the GPU usage of the target application. High GPU usage can lead to performance drops and application slowdowns. 13- FPS: The tool reads the frame rate, in frames per second (FPS), of the target application to measure the smoothness of the application image. A higher FPS generally means smoother visuals. 14- TEMP: The tool reads the temperature information of the test device on a per second basis, including the GPU temperature and system chip temperature. 15- RAM: The tool reads the RAM usage of the target application on a per second basis. 16- snapshot: The tool takes a screenshot of the application UI every 2 seconds. 17 18## Principles 19 20The figure below demonstrates the main functions of SmartPerf Device. Set data collection items and parameters on Device-hap, start the application, and then send data requests for KPIs (such as FPS, RAM, and Trace) from Device-hap to Device-daemon through messages. Device-daemon collects, persists, and analyzes data as requested<!--Del-->, and then sends the data to Device-hap for display<!--DelEnd-->. 21 22 23 24## Constraints 25 261. Device-daemon and <!--Del-->Device-hap <!--DelEnd-->are pre-installed since API version 9. 27 282. Device-daemon must be connected to a hardware device<!--Del-->, and Device-hap can only be used on devices with a screen<!--DelEnd-->. 29 303. Before using Device-Daemon, configure the [hdc environment](https://gitee.com/openharmony/developtools_hdc). 31 32<!--Del--> 33## SmartPerf Device-hap 34 35The RK3568 development board is used as an example below. 36 37### Obtaining the Application List 38 39Start SmartPerf Device-hap. On the home screen, click **Select an app**. 40 41 42 43 44 45### Setting Collection Parameters 46 47After the target application is selected, return to the start page and set the test indicators. You can also change the test name (which includes the name of the target application and the test time and will be displayed in the report), and specify whether to capture traces and whether to enable the screenshot feature. When you are done, click the **Start** button at the bottom. 48 49### Using the Floating Window to Manage Data Collection 50 51To start collection, touch **Start** in the floating window. To pause, touch the timer in the floating window. To resume, touch the timer again. To view the collected data in real time, double-touch the timer. To stop, touch and hold the timer.<br>You can drag the floating window to anywhere you like. 52 53 54 55 56### Viewing the Report 57 58Click **Report** to access the report list. Touch a report to view its details. 59 60 61 62<!--DelEnd--> 63 64<!--RP1--> 65## SmartPerf Device-daemon 66<!--RP1End--> 67 68### Collection Prerequisites 69 70#### Switching to Shell 71 72 ``` 73 C:\Users\issusser>hdc shell 74 # 75 ``` 76 77#### Starting and Viewing the daemon Process 78 79 ``` 80 C:\Users\issusser>hdc shell 81 // Start the daemon process. 82 # SP_daemon 83 // Check whether the daemon process is running. 84 # ps -ef | grep SP_daemon 85 root 1584 1 0 21:50:05 ? 00:00:00 SP_daemon 86 root 1595 1574 3 21:51:02 pts/0 00:00:00 grep SP_daemon 87 # 88 ``` 89 90#### Viewing the Help Information 91 92<!--RP3--> 93 94 ``` 95 # SP_daemon --help 96 OpenHarmony performance testing tool SmartPerf command-line version 97 Usage: SP_daemon [options] [arguments] 98 99 options: 100 -N set the collection times(default value is 0) range[1,2147483647], for example: -N 10 101 -PKG set package name, must add, for example: -PKG ohos.samples.ecg 102 -c get device CPU frequency and CPU usage, process CPU usage and CPU load .. 103 -g get device GPU frequency and GPU load 104 -f get app refresh fps(frames per second) and fps jitters and refreshrate 105 -profilerfps get refresh fps and timestamp 106 -sections set collection time period(using with profilerfps) 107 -t get remaining battery power and temperature.. 108 -p get battery power consumption and voltage(Not supported by some devices) 109 -r get process memory and total memory 110 -snapshot get screen capture 111 -net get uplink and downlink traffic 112 -start collection start command 113 -stop collection stop command 114 -VIEW set layler, for example: -VIEW DisplayNode 115 -OUT set csv output path. 116 -d get device DDR information 117 -screen get screen resolution 118 -deviceinfo get device information 119 -server start a process to listen to the socket message of the start and stop commands 120 -clear clear the process ID 121 -ohtestfps used by the validator to obtain the fps, the collection times can be set 122 -editorServer start a process to listen to the socket message of the editor 123 -recordcapacity get the battery level difference 124 --version get version 125 --help get help 126 -editor scenario-based collection identifier, parameter configuration items can be added later 127 responseTime get the page response delay after an application is operated 128 completeTime get the page completion delay after an application is operated 129 fpsohtest used by the validator to obtain the fps 130 example1: 131 SP_daemon -N 20 -c -g -t -p -r -net -snapshot -d 132 SP_daemon -N 20 -PKG ohos.samples.ecg -c -g -t -p -f -r -net -snapshot -d 133 SP_daemon -start -c 134 SP_daemon -stop 135 example2: These parameters need to be used separately 136 SP_daemon -screen 137 SP_daemon -deviceinfo 138 SP_daemon -server 139 SP_daemon -clear 140 SP_daemon -ohtestfps 10 141 SP_daemon -editorServer 142 SP_daemon -recordcapacity 143 example3: These parameters need to be used separately 144 SP_daemon -editor responseTime ohos.samples.ecg app name 145 SP_daemon -editor completeTime ohos.samples.ecg app name 146 SP_daemon -editor fpsohtest 147 148 149 150 command exec finished! 151 # 152 ``` 153<!--RP3End--> 154 155### Basic Collection 156 157#### Run the **-N** command to enable the collection 158 159| Command |Mandatory| Description | 160| :-----| :-----| :--------------------- | 161| -N |Yes| Sets the number of collection times (once per second). | 162| -PKG |No| Sets the bundle name. | 163| -c |No| Collects the CPU frequency and usage.<br>When the application bundle name is set, the system and application CPU information is collected.<br>Otherwise, only the system CPU information is collected. | 164| -g |No| Collects the GPU frequency and load information. | 165| -f |No| Collects the screen refresh rate and frame rate of the target application. The application bundle name must be specified. | 166| -t |No| Collects the temperature of GPU and system chip. | 167| -r |No| Collects the memory.<br>When the application bundle name is set, the system and application memory information is obtained.<br>Otherwise, only the system memory information is obtained. | 168| -snapshot |No| Takes a screenshot. | 169| -net |No| Collects the network speed. | 170| -VIEW |No| Sets the view layer. You must obtain the layer name first. | 171| -d |No| Collects the DDR data. | 172| -sections|No| Sets segment-based collection. | 173<!--RP2--><!--RP2End--> 174 175##### Samples 176 177- Collect twice the frequency and usage of CPU cores. 178 179 ``` 180 # SP_daemon -N 2 -c 181 182 order:0 timestamp=1501839064260 183 order:1 TotalcpuUsage=0.502513 184 order:2 TotalcpuidleUsage=99.497487 185 order:3 TotalcpuioWaitUsage=0.000000 186 order:4 TotalcpuirqUsage=0.000000 187 order:5 TotalcpuniceUsage=0.000000 188 order:6 TotalcpusoftIrqUsage=0.000000 189 order:7 TotalcpusystemUsage=0.251256 190 order:8 TotalcpuuserUsage=0.251256 191 order:9 cpu0Frequency=1992000 192 order:10 cpu0Usage=1.000000 193 order:11 cpu0idleUsage=99.000000 194 order:12 cpu0ioWaitUsage=0.000000 195 order:13 cpu0irqUsage=0.000000 196 order:14 cpu0niceUsage=0.000000 197 order:15 cpu0softIrqUsage=0.000000 198 order:16 cpu0systemUsage=0.000000 199 order:17 cpu0userUsage=1.000000 200 order:18 cpu1Frequency=1992000 201 order:19 cpu1Usage=0.000000 202 order:20 cpu1idleUsage=100.000000 203 order:21 cpu1ioWaitUsage=0.000000 204 order:22 cpu1irqUsage=0.000000 205 order:23 cpu1niceUsage=0.000000 206 order:24 cpu1softIrqUsage=0.000000 207 order:25 cpu1systemUsage=0.000000 208 order:26 cpu1userUsage=0.000000 209 order:27 cpu2Frequency=1992000 210 order:28 cpu2Usage=1.000000 211 order:29 cpu2idleUsage=99.000000 212 order:30 cpu2ioWaitUsage=0.000000 213 order:31 cpu2irqUsage=0.000000 214 order:32 cpu2niceUsage=0.000000 215 order:33 cpu2softIrqUsage=0.000000 216 order:34 cpu2systemUsage=1.000000 217 order:35 cpu2userUsage=0.000000 218 order:36 cpu3Frequency=1992000 219 order:37 cpu3Usage=0.000000 220 order:38 cpu3idleUsage=100.000000 221 order:39 cpu3ioWaitUsage=0.000000 222 order:40 cpu3irqUsage=0.000000 223 order:41 cpu3niceUsage=0.000000 224 order:42 cpu3softIrqUsage=0.000000 225 order:43 cpu3systemUsage=0.000000 226 order:44 cpu3userUsage=0.000000 227 228 ... 229 230 command exec finished! 231 # 232 ``` 233 234- Collect twice the frequency and usage of CPU cores and CPU usage and load of processes. 235 236 ``` 237 # SP_daemon -N 2 -PKG ohos.samples.ecg -c 238 239 order:0 timestamp=1501839151499 240 order:1 ProcAppName=ohos.samples.ecg 241 order:2 ProcCpuLoad=0.000000 242 order:3 ProcCpuUsage=36.177645 243 order:4 ProcId=2111 244 order:5 ProcSCpuUsage=8.982036 245 order:6 ProcUCpuUsage=27.195609 246 order:7 TotalcpuUsage=62.500000 247 order:8 TotalcpuidleUsage=37.500000 248 order:9 TotalcpuioWaitUsage=0.000000 249 order:10 TotalcpuirqUsage=0.000000 250 order:11 TotalcpuniceUsage=0.000000 251 order:12 TotalcpusoftIrqUsage=0.000000 252 order:13 TotalcpusystemUsage=21.614583 253 order:14 TotalcpuuserUsage=40.885417 254 order:15 cpu0Frequency=1992000 255 order:16 cpu0Usage=77.083333 256 order:17 cpu0idleUsage=22.916667 257 order:18 cpu0ioWaitUsage=0.000000 258 order:19 cpu0irqUsage=0.000000 259 order:20 cpu0niceUsage=0.000000 260 order:21 cpu0softIrqUsage=0.000000 261 order:22 cpu0systemUsage=21.875000 262 order:23 cpu0userUsage=55.208333 263 order:24 cpu1Frequency=1992000 264 order:25 cpu1Usage=57.731959 265 order:26 cpu1idleUsage=42.268041 266 order:27 cpu1ioWaitUsage=0.000000 267 order:28 cpu1irqUsage=0.000000 268 order:29 cpu1niceUsage=0.000000 269 order:30 cpu1softIrqUsage=0.000000 270 order:31 cpu1systemUsage=21.649485 271 order:32 cpu1userUsage=36.082474 272 order:33 cpu2Frequency=1992000 273 order:34 cpu2Usage=59.793814 274 order:35 cpu2idleUsage=40.206186 275 order:36 cpu2ioWaitUsage=0.000000 276 order:37 cpu2irqUsage=0.000000 277 order:38 cpu2niceUsage=0.000000 278 order:39 cpu2softIrqUsage=0.000000 279 order:40 cpu2systemUsage=19.587629 280 order:41 cpu2userUsage=40.206186 281 order:42 cpu3Frequency=1992000 282 order:43 cpu3Usage=55.789474 283 order:44 cpu3idleUsage=44.210526 284 order:45 cpu3ioWaitUsage=0.000000 285 order:46 cpu3irqUsage=0.000000 286 order:47 cpu3niceUsage=0.000000 287 order:48 cpu3softIrqUsage=0.000000 288 order:49 cpu3systemUsage=23.157895 289 order:50 cpu3userUsage=32.631579 290 291 ... 292 293 command exec finished! 294 # 295 ``` 296 297 >**NOTE** 298 > 299 >- Make sure you are on the application screen when running this command. 300 301- Collect once the GPU frequency and load of the system. 302 303 ``` 304 # SP_daemon -N 1 -g 305 306 order:0 timestamp=1503078740268 307 order:1 gpuFrequency=200000000 308 order:2 gpuLoad=38.000000 309 310 command exec finished! 311 # 312 ``` 313 314- Collect twice the system temperature. 315 316 ``` 317 # SP_daemon -N 2 -t 318 319 order:0 timestamp=1502720711191 320 order:1 gpu-thermal=42500.000000 321 order:2 soc-thermal=43.125000 322 323 order:0 timestamp=1502720712191 324 order:1 gpu-thermal=41875.000000 325 order:2 soc-thermal=42.500000 326 327 command exec finished! 328 # 329 ``` 330 331- Collect twice the memory information of the system. 332 333 ``` 334 # SP_daemon -N 2 -r 335 order:0 timestamp=1705041562521 336 order:1 memAvailable=7339224 337 order:2 memFree=7164708 338 order:3 memTotal=11641840 339 340 order:0 timestamp=1705041563527 341 order:1 memAvailable=7339136 342 order:2 memFree=7164684 343 order:3 memTotal=11641840 344 345 command exec finished! 346 # 347 ``` 348 349- Collect the memory information of the system and a specified application once. 350 351 ``` 352 # SP_daemon -N 1 -PKG ohos.samples.ecg -r 353 354 order:0 timestamp=1720427095197 355 order:1 arktsHeapPss=17555 356 order:2 gpuPss=7021 357 order:3 graphicPss=163320 358 order:4 heapAlloc=120344 359 order:5 heapFree=14362 360 order:6 heapSize=133436 361 order:7 memAvailable=2757504 362 order:8 memFree=190852 363 order:9 memTotal=11742716 364 order:10 nativeHeapPss=49102 365 order:11 privateClean=1100020 366 order:12 privateDirty=175169 367 order:13 pss=422172 368 order:14 sharedClean=89348 369 order:15 sharedDirty=19084 370 order:16 stackPss=1588 371 order:17 swap=122076 372 order:18 swapPss=122076 373 374 command exec finished! 375 # 376 ``` 377 >**NOTE** 378 > 379 >- Make sure you are on the application screen when running this command. 380 >- This command integrates the **-m** command of earlier version, which obtains data such as **arktsHeapPss**, **gpuPss**, **graphicPss**. 381 382- Take two screenshots. 383 384 ``` 385 # SP_daemon -N 2 -snapshot 386 387 order:0 timestamp=1501837609657 388 order:1 capture=data/local/tmp/capture/screenCap_1501837609657.png 389 390 order:0 timestamp=1501837610657 391 order:1 capture=NA 392 393 command exec finished! 394 # 395 ``` 396 >**NOTE** 397 > 398 >- Screenshots are collected every 2 seconds. 399 > 400 >- When the collection is complete, you can view the screenshots in **data/local/tmp/capture**. 401 > 402 >- To export the screenshots to drive D, open a new CLI and run the **hdc file recv data/local/tmp/capture/screenCap_1700725192774.png D:\\** command. 403 404- Collect the network speeds twice. 405 406 ``` 407 # SP_daemon -N 2 -net 408 409 order:0 timestamp=1705041904832 410 order:1 networkDown=0 411 order:2 networkUp=0 412 413 order:0 timestamp=1705041905870 414 order:1 networkDown=22931 415 order:2 networkUp=2004 416 417 command exec finished! 418 # 419 ``` 420 421- Collect the frame rate of the target application five times. 422 423 ``` 424 # SP_daemon -N 5 -PKG ohos.samples.ecg -f 425 426 order:0 timestamp=1705306472232 427 order:1 fps=43 428 order:2 fpsJitters=602261688;;8352083;;8267708;;8305209;;8298437;;8308854;;8313542;;8569271;;8061458;;8300521;;8308333;;8309896;;8429167;;8241667;;8258333;;8318229;;8312500;;8304167;;41760937;;16418750;;8298959;;8319270;;8308334;;8313541;;8302605;;8320312;;8298958;;8326042;;8321354;;8301042;;8310417;;8309895;;8308855;;8331250;;8286458;;8343229;;8278125;;8311458;;8306250;;8312500;;8320834;;8346875;;8283333 429 order:3 refreshrate=69 430 431 order:0 timestamp=1705306473234 432 order:1 fps=40 433 order:2 fpsJitters=674427313;;8191145;;8310417;;8319271;;8301562;;8318750;;8302084;;8314062;;8333334;;8283854;;8307812;;8311979;;8310417;;8307813;;8309375;;8323958;;8306250;;8308333;;8317709;;8296875;;8721875;;7895833;;8320833;;8340625;;8276563;;8409896;;8216145;;8310938;;8301042;;8362500;;8252604;;8317708;;8376042;;8256250;;8292187;;8303125;;8313542;;8310417;;8520312 434 order:3 refreshrate=69 435 ... 436 437 command exec finished! 438 # 439 ``` 440 >**NOTE** 441 > 442 >- When running this command, make sure you are on the application screen, and then swipe on the screen or switch between screens. 443 >- When dynamic refresh rate (DRR) is enabled, the refresh rate changes in real time (multiple changes may occur within one second). The value of **refreshrate** is obtained at a timestamp. 444 445 446- Collect the frame rate of the specified view layer for 10 times. 447 448 ``` 449 # SP_daemon -N 10 -VIEW DisplayNode -f 450 order:0 timestamp=1705306822850 451 order:1 fps=15 452 order:2 fpsJitters=876291843;;8314062;;8308334;;8314583;;8310417;;8308333;;8326042;;8314583;;8292708;;8492709;;8143750;;8340104;;8294271;;8302604;;8297396 453 order:3 refreshrate=69 454 455 order:0 timestamp=1705306823852 456 order:1 fps=12 457 order:2 fpsJitters=906667363;;8279167;;8311458;;8315625;;8291146;;8313021;;8323438;;8293750;;8303125;;8313541;;8301563;;8317708 458 order:3 refreshrate=69 459 ... 460 461 command exec finished! 462 # 463 ``` 464 >**NOTE** 465 > 466 >- **DisplayNode** indicates the name of the specified layer. 467 > 468 >- When using this command to collect data, you need to operate the page on the specified layer. 469 > 470 >- This command cannot be used together with the commands used to collect frame rate of a specified application, such as the **SP_daemon -N 20 -PKG ohos.samples.ecg -f** or **SP_daemon -N 20 -VIEW DisplayNode -f** commands. 471 472- Collect DDR information once. 473 474 ``` 475 # SP_daemon -N 1 -d 476 477 order:0 timestamp=1710916175201 478 order:1 ddrFrequency=1531000000 479 480 command exec finished! 481 # 482 ``` 483<!--RP4--><!--RP4End--> 484 485- Collect the full information of the system, including the CPU, GPU, temperature, memory, DDR, network speed, and screenshot information. 486 487 ``` 488 # SP_daemon -N 10 -c -g -t -r -d -net -snapshot 489 490 order:0 timestamp=1501837838664 491 order:1 TotalcpuUsage=0.751880 492 order:2 TotalcpuidleUsage=99.248120 493 order:3 TotalcpuioWaitUsage=0.000000 494 order:4 TotalcpuirqUsage=0.000000 495 order:5 TotalcpuniceUsage=0.000000 496 order:6 TotalcpusoftIrqUsage=0.000000 497 order:7 TotalcpusystemUsage=0.501253 498 order:8 TotalcpuuserUsage=0.250627 499 order:9 cpu0Frequency=1992000 500 order:10 cpu0Usage=0.000000 501 order:11 cpu0idleUsage=100.000000 502 order:12 cpu0ioWaitUsage=0.000000 503 order:13 cpu0irqUsage=0.000000 504 order:14 cpu0niceUsage=0.000000 505 order:15 cpu0softIrqUsage=0.000000 506 order:16 cpu0systemUsage=0.000000 507 order:17 cpu0userUsage=0.000000 508 order:18 cpu1Frequency=1992000 509 order:19 cpu1Usage=0.000000 510 order:20 cpu1idleUsage=100.000000 511 order:21 cpu1ioWaitUsage=0.000000 512 order:22 cpu1irqUsage=0.000000 513 order:23 cpu1niceUsage=0.000000 514 order:24 cpu1softIrqUsage=0.000000 515 order:25 cpu1systemUsage=0.000000 516 order:26 cpu1userUsage=0.000000 517 order:27 cpu2Frequency=1992000 518 order:28 cpu2Usage=1.000000 519 order:29 cpu2idleUsage=99.000000 520 order:30 cpu2ioWaitUsage=0.000000 521 order:31 cpu2irqUsage=0.000000 522 order:32 cpu2niceUsage=0.000000 523 order:33 cpu2softIrqUsage=0.000000 524 order:34 cpu2systemUsage=1.000000 525 order:35 cpu2userUsage=0.000000 526 order:36 cpu3Frequency=1992000 527 order:37 cpu3Usage=0.000000 528 order:38 cpu3idleUsage=100.000000 529 order:39 cpu3ioWaitUsage=0.000000 530 order:40 cpu3irqUsage=0.000000 531 order:41 cpu3niceUsage=0.000000 532 order:42 cpu3softIrqUsage=0.000000 533 order:43 cpu3systemUsage=0.000000 534 order:44 cpu3userUsage=0.000000 535 order:45 gpuFrequency=200000000 536 order:46 gpuLoad=0.000000 537 order:47 gpu-thermal=40000.000000 538 order:48 soc-thermal=40.625000 539 order:49 memAvailable=1142820 540 order:50 memFree=687988 541 order:51 memTotal=1935948 542 order:52 ddrFrequency=800000000 543 order:53 networkDown=0 544 order:54 networkUp=0 545 order:55 capture=data/local/tmp/capture/screenCap_1501837838669.png 546 547 ... 548 549 command exec finished! 550 # 551 ``` 552 553- Collect the full information of the specified application, including the CPU, GPU, temperature, frame rate, memory, DDR, network speed, and screenshot information. 554 555 <!--RP5--> 556 ``` 557 # SP_daemon -N 10 -PKG ohos.samples.ecg -c -g -t -f -r -d -net -snapshot 558 559 order:0 timestamp=1501837949706 560 order:1 ProcAppName=ohos.samples.ecg 561 order:2 ProcCpuLoad=0.000000 562 order:3 ProcCpuUsage=38.775000 563 order:4 ProcId=1960 564 order:5 ProcSCpuUsage=8.875000 565 order:6 ProcUCpuUsage=29.900000 566 order:7 TotalcpuUsage=85.416667 567 order:8 TotalcpuidleUsage=14.583333 568 order:9 TotalcpuioWaitUsage=0.000000 569 order:10 TotalcpuirqUsage=0.000000 570 order:11 TotalcpuniceUsage=0.000000 571 order:12 TotalcpusoftIrqUsage=0.000000 572 order:13 TotalcpusystemUsage=33.072917 573 order:14 TotalcpuuserUsage=52.343750 574 order:15 cpu0Frequency=1992000 575 order:16 cpu0Usage=92.929293 576 order:17 cpu0idleUsage=7.070707 577 order:18 cpu0ioWaitUsage=0.000000 578 order:19 cpu0irqUsage=0.000000 579 order:20 cpu0niceUsage=0.000000 580 order:21 cpu0softIrqUsage=0.000000 581 order:22 cpu0systemUsage=40.404040 582 order:23 cpu0userUsage=52.525253 583 order:24 cpu1Frequency=1992000 584 order:25 cpu1Usage=82.291667 585 order:26 cpu1idleUsage=17.708333 586 order:27 cpu1ioWaitUsage=0.000000 587 order:28 cpu1irqUsage=0.000000 588 order:29 cpu1niceUsage=0.000000 589 order:30 cpu1softIrqUsage=0.000000 590 order:31 cpu1systemUsage=29.166667 591 order:32 cpu1userUsage=53.125000 592 order:33 cpu2Frequency=1992000 593 order:34 cpu2Usage=81.111111 594 order:35 cpu2idleUsage=18.888889 595 order:36 cpu2ioWaitUsage=0.000000 596 order:37 cpu2irqUsage=0.000000 597 order:38 cpu2niceUsage=0.000000 598 order:39 cpu2softIrqUsage=0.000000 599 order:40 cpu2systemUsage=31.111111 600 order:41 cpu2userUsage=50.000000 601 order:42 cpu3Frequency=1992000 602 order:43 cpu3Usage=85.858586 603 order:44 cpu3idleUsage=14.141414 604 order:45 cpu3ioWaitUsage=0.000000 605 order:46 cpu3irqUsage=0.000000 606 order:47 cpu3niceUsage=0.000000 607 order:48 cpu3softIrqUsage=0.000000 608 order:49 cpu3systemUsage=32.323232 609 order:50 cpu3userUsage=53.535354 610 order:51 gpuFrequency=200000000 611 order:52 gpuLoad=29.000000 612 order:53 gpu-thermal=41875.000000 613 order:54 soc-thermal=45.000000 614 order:55 fps=40 615 order:56 fpsJitters=14482127;;28966003;;28971836;;14484751;;28952878;;28970962;;14480959;;28968337;;14476001;;28967461;;28968045;;14477751;;28966878;;28975337;;14475126;;28962795;;28967461;;14496710;;28953169;;28966003;;14483002;;28963961;;28965711;;28964836;;28966295;;14550085;;28898628;;28964544;;28975628;;14497293;;28938878;;43454546;;28966003;;28973295;;28959878;;28964252;;14476585;;28965128;;28970670;;14478626 616 order:57 refreshrate=69 617 order:58 arktsHeapPss=10970 618 order:59 gpuPss=0 619 order:60 graphicPss=10800 620 order:61 heapAlloc=0 621 order:62 heapFree=0 622 order:63 heapSize=0 623 order:64 memAvailable=1137784 624 order:65 memFree=682592 625 order:66 memTotal=1935948 626 order:67 nativeHeapPss=21398 627 order:68 privateClean=24816 628 order:69 privateDirty=44932 629 order:70 pss=91587 630 order:71 sharedClean=100512 631 order:72 sharedDirty=36832 632 order:73 stackPss=1444 633 order:74 swap=0 634 order:75 swapPss=0 635 order:76 ddrFrequency=800000000 636 order:77 networkDown=0 637 order:78 networkUp=0 638 order:79 capture=data/local/tmp/capture/screenCap_1501837950216.png 639 640 ... 641 642 command exec finished! 643 # 644 ``` 645 <!--RP5End--> 646 647 >**NOTE** 648 > 649 >- Make sure you are on the application screen when running this command. 650 651 652#### Run the **-start** command to start the collection 653 654Run the **start** command to start collection, operate the device or application, and then run the **stop** command to stop collection. 655 656| Command |Mandatory| Description | 657| :-----|:-----| :--------------------- | 658| -start |Yes| Starts collection. You can add a basic collection command after this command parameter. The collection is performed every second. | 659| -stop |Yes| Stops collection. A report is generated when collection is complete. | 660 661##### Samples 662 663 ``` 664 Start data collection. 665 # SP_daemon -start -c 666 SP_daemon Collection begins 667 668 669 command exec finished! 670 # 671 672 Stop data collection. 673 # SP_daemon -stop 674 SP_daemon Collection ended 675 Output Path: data/local/tmp/smartperf/1/t_index_info.csv 676 677 678 command exec finished! 679 # 680 ``` 681 >**NOTE** 682 > 683 >- To start collecting the system data, run the **SP_daemon -start -c -g -t -r -d -net -snapshot** command. 684 > 685 >- To start collecting the system and process data, run the **SP_daemon -start -PKG ohos.samples.ecg -c -g -t -f -r -d -net -snapshot** command. 686 > 687 >- The service start and stop file is stored in **data/local/tmp/smartperf/1/t_index_info.csv**. You can run the **hdc file recv** command to export the report. For details, see [Viewing Collection Result in the CSV File](#viewing-collection-result-in-the-csv-file). 688 689#### Viewing Collection Result in the CSV File 690 691If the collection result is saved in a CSV file, perform the following steps to export and view the result: 692 693 - By default, the collection results are saved to **/data/local/tmp/data.csv**. 694 695 - To check the path to the test result file: 696 697 ``` 698 C:\Users\issusser>hdc shell 699 # cd data/local/tmp 700 # ls 701 data.csv 702 # 703 ``` 704 705 - To export the test result file: 706 ``` 707 C:\Users\issusser>hdc file recv data/local/tmp/data.csv D:\ 708 [I][2023-11-08 16:16:41] HdcFile::TransferSummary success 709 FileTransfer finish, Size:429, File count = 1, time:6ms rate:71.50kB/s 710 711 C:\Users\issusser> 712 ``` 713 714 - Open the **data.csv** file to view the collected data. 715 716 The table below describes the data fields in the **data.csv** file. 717 718 | Data Field | Description |Remarks| 719 | :-----| :--------------------- |:-----| 720 | cpuFrequency | CPU core frequency. |Unit: Hz| 721 | cpuUasge | CPU core usage. |%| 722 | cpuidleUsage | CPU usage in idle state. |%| 723 | cpuioWaitUsage | CPU usage of I/O wait. |%| 724 | cpuirqUsage | CPU usage of hardware interrupts. |%| 725 | cpuniceUsage | CPU usage of user level processes with lower scheduling priority. |%| 726 | cpusoftIrqUsage | CPU usage of software interrupts. |%| 727 | cpusystemUsage | CPU usage in kernel mode. |%| 728 | cpuuserUsage | CPU usage in user mode. |%| 729 | ProcId | Process ID. |-| 730 | ProcAppName | Application bundle name. |-| 731 | ProcCpuLoad | Process CPU load. |%| 732 | ProcCpuUsage | CPU usage of the process. |%| 733 | ProcUCpuUsage | CPU usage of the process in user mode. |%| 734 | ProcSCpuUsage | CPU usage of the process in kernel mode. |%| 735 | gpuFrequ | GPU frequency of the system. |%| 736 | gpuLoad | GPU load of the system. |%| 737 | currentNow | Current value. |Unit: mA| 738 | voltageNow | Voltage value. |Unit: μV| 739 | fps | Number of frames per second. |Unit: FPS| 740 | fpsJitters | Frame interval. |Unit: ns| 741 | refreshrate | Screen refresh rate. |Unit: Hz| 742 | networkDown | Downstream rate. |Unit: byte/s| 743 | networkUp | Uplink rate. |Unit: byte/s| 744 | ddrFrequency | DDR frequency. |Unit: Hz| 745 | gpu-thermal | GPU temperature. |Unit: °C| 746 | soc-thermal | SoC temperature. |Unit: °C| 747 | memAvailable | Available memory of the system. |Unit: KB| 748 | memFree | Free memory of the system. |Unit: KB| 749 | memTotal | Total memory of the system. |Unit: KB| 750 | pss | Proportional set size (PSS) of the process. |Unit: KB| 751 | sharedClean | Shared unwritten pages. |Unit: KB| 752 | sharedDirty | Shared rewritten pages. |Unit: KB| 753 | priviateClean | Private unwritten pages. |Unit: KB| 754 | privateDirty | Private rewritten pages. |Unit: KB| 755 | swapTotal | Total swap memory. |Unit: KB| 756 | swapPss | Swapped PSS. |Unit: KB| 757 | HeapSize | Heap size. |Unit: KB| 758 | HeapAlloc | Heap size that can be allocated. |Unit: KB| 759 | HeapFree | Remaining heap size. |Unit: KB| 760 | gpuPss | Used GPU size. |Unit: KB| 761 | graphicPss | Used graphics memory size. |Unit: KB| 762 | arktsHeapPss | Used ArkTS memory size. |Unit: KB| 763 | nativeHeapPss | Used native memory size. |Unit: KB| 764 | stackPss | Used stack memory size. |Unit: KB| 765 | timeStamp | Timestamp. |Collection time.| 766 <!--RP6--><!--RP6End--> 767 768### Scenario Collection 769 770<!--RP7--> 771 772In addition to basic collection, the response and completion delay can be collected. The scenario collection result is displayed in the CLI instead of being written into the **data.csv** file. 773 774| Command |Mandatory| Description | 775| :-----|:-----| :--------------------- | 776| -editor|Yes| Identifies scenario collection. Parameter options can be added after. | 777| -responseTime|No| Collects the response latency. | 778| -completeTime|No| Collects the completion delay. | 779| -fpsohtest|No| A validator used to collect the frame rate every second. The frame rate is collected 10 times by default. | 780 781#### Samples 782 783- Collect the application response latency. (This command supports only the RK3568 device.) 784 785 ``` 786 # SP_daemon -editor responseTime ohos.samples.ecg ohtest 787 time:544ms 788 789 command exec finished! 790 ``` 791 >**NOTE** 792 > 793 >- Open the application before collection, press **Enter** in the CLI, switch to the application page, and wait for the collection result to be printed. 794 795- Collect the application completion latency. (This command supports only the RK3568 device.) 796 797 ``` 798 # SP_daemon -editor completeTime ohos.samples.ecg ohtest 799 time:677ms 800 801 command exec finished! 802 ``` 803 >**NOTE** 804 > 805 >- Open the application before collection, press **Enter** in the CLI, switch to the application page, and wait for the collection result to be printed. 806 807- Use the validator to obtain the application page frame rate. 808 809 ``` 810 # SP_daemon -editor fpsohtest 811 set num:10 successfps:0|1726909713442fps:97|1726909714442fps:113|1726909715442fps:116|1726909716442fps:116|1726909717442fps:118|1726909718442fps:114|1726909719442fps:114|1726909720442fps:115|1726909721442fps:118|1726909722442SP_daemon exec finished! 812 ``` 813 >**NOTE** 814 > 815 >- You need to swipe or switch the current page after running the command, and the collection result will be printed after 10s. 816 817<!--RP7End--> 818 819### Other Collection 820 821The power collection result of the current device can be written into the **data.csv** file. Other data is collected separately and the collection result is displayed only in the command box. 822 823| Command |Mandatory| Description | 824| :-----|:-----| :--------------------- | 825| -screen |No| Collects the screen resolution and refresh rate. | 826| -deviceinfo|No| Obtains device information. | 827| -server|No| Starts a daemon process by starting or stopping collection. | 828| -clear|No| Clears all the SP_daemon processes. | 829| -ohtestfps|No| Obtains the frame rate. You can set the number of collection times (collection is performed every second). | 830| -editorServer|No| Starts a daemon process by using an editor. | 831| -recordcapacity|No| Obtains the battery level of the current device. | 832| -profilerfps |No| Collects the frame rate of the current page. | 833 834#### Samples 835 836- Obtain the screen resolution. 837 838 ``` 839 # SP_daemon -screen 840 activeMode: 720x1280, refreshrate=69 841 842 843 command exec finished! 844 # 845 ``` 846 >**NOTE** 847 > 848 >- **activeMode** indicates the current screen resolution, and **refreshrate** indicates the screen refresh rate. 849 850- Obtain the device information. 851 852 ``` 853 # SP_daemon -deviceinfo 854 abilist: default 855 activeMode: 720x1280 856 board: hw 857 brand: default 858 cpu_c1_cluster: 0 1 2 3 859 cpu_c1_max: 1992000 860 cpu_c1_min: 408000 861 cpu_cluster_name: policy0 862 daemonPerfVersion: 1.0.5 863 deviceTypeName: rk3568 864 fullname: OpenHarmony-5.1.0.46 865 gpu_max_freq: 800000000 866 gpu_min_freq: 200000000 867 model: ohos 868 name: OpenHarmony 3.2 869 sn: 150100424a5444345209d941bec6b900 870 version: OpenHarmony 5.1.0.46 871 872 command exec finished! 873 # 874 ``` 875 876- Start a process to listen for the socket messages of the **start** and **stop** commands. 877 878 ``` 879 # SP_daemon -server 880 # 881 # pidof SP_daemon 882 7024 883 # 884 ``` 885 >**NOTE** 886 > 887 >- You can run the **pidof SP_daemon** command to view the process ID. 888 889- Clear the SP_daemon process ID. 890 891 ``` 892 # pidof SP_daemon 893 2725 894 # SP_daemon -clear 895 896 897 command exec finished! 898 # 899 # pidof SP_daemon 900 # 901 ``` 902 >**NOTE** 903 > 904 >- You can run the **pidof SP_daemon** command to view the process ID. 905 906- Obtain the frame rate of the current page using a validator. 907 908 ``` 909 # SP_daemon -ohtestfps 10 910 set num:10 success 911 fps:1|1501926684532 912 fps:18|1501926685532 913 fps:37|1501926686532 914 fps:41|1501926687532 915 fps:42|1501926688532 916 fps:16|1501926689532 917 fps:40|1501926690532 918 fps:40|1501926691532 919 fps:42|1501926692532 920 fps:41|1501926693532 921 SP_daemon exec finished! 922 # 923 ``` 924 >**NOTE** 925 > 926 >- In this command, **10** indicates the number of collection times (collection is performed every second). You can set it to a positive integer. 927 928 929- Start a process to listen for the socket messages of the editor tool. 930 931 ``` 932 # SP_daemon -editorServer 933 934 935 command exec finished! 936 ``` 937 938 939- Obtain the battery level. 940 941 ``` 942 # SP_daemon -recordcapacity 943 recordTime: 1726903063 944 recordPower: 5502 945 ``` 946 >**NOTE** 947 > 948 >- **recordTime** indicates the timestamp, and **recordPower** indicates the current battery level. 949 > 950 >- This command needs to be executed separately. The collection result is written into the **/data/local/tmp/powerLeftRecord.csv** file and can be exported to the local PC by running the **hdc file recv** command. For details, see [Viewing Collection Result in the CSV File](#viewing-collection-result-in-the-csv-file). 951 952- Collect the frame rate of the current page. 953 954 ``` 955 # SP_daemon -profilerfps 10 956 set num:10 success 957 fps:0|1711692357278 958 fps:0|1711692358278 959 fps:1|1711692359278 960 fps:0|1711692360278 961 fps:0|1711692361278 962 fps:0|1711692362278 963 fps:0|1711692363278 964 fps:0|1711692364278 965 fps:26|1711692365278 966 fps:53|1711692366278 967 SP_daemon exec finished! 968 # 969 ``` 970 >**NOTE** 971 > 972 >- In this command, **100** indicates the number of collection times (collection is performed every second). You can set it to a positive integer. 973 974- Collect the frame rate by time segment. 975 976 ``` 977 # SP_daemon -profilerfps 100 -sections 10 978 set num:100 success 979 fps:0|1711692393278 980 fps:0|1711692394278 981 fps:0|1711692395278 982 fps:44|1711692396278 983 sectionsFps:0|1711692396278 984 sectionsFps:0|1711692396378 985 sectionsFps:40|1711692396478 986 sectionsFps:60|1711692396578 987 sectionsFps:60|1711692396678 988 sectionsFps:60|1711692396778 989 sectionsFps:60|1711692396878 990 sectionsFps:40|1711692396978 991 sectionsFps:60|1711692397078 992 sectionsFps:60|1711692397178 993 fps:51|1711692397278 994 995 ... 996 997 SP_daemon exec finished! 998 # 999 ``` 1000 >**NOTE** 1001 > 1002 >- In this command, **100** indicates the number of collection times (collection is performed every second) and can be set to a positive integer. **10** indicates collection by segment. Currently, the number of collection segments can be set to a positive integer ranging from 1 to 10. 1003