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