1/* 2* Copyright (C) 2022 Huawei Device Co., Ltd. 3* Licensed under the Apache License, Version 2.0 (the "License"); 4* you may not use this file except in compliance with the License. 5* You may obtain a copy of the License at 6* 7* http://www.apache.org/licenses/LICENSE-2.0 8* 9* Unless required by applicable law or agreed to in writing, software 10* distributed under the License is distributed on an "AS IS" BASIS, 11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12* See the License for the specific language governing permissions and 13* limitations under the License. 14*/ 15 16/** 17 * @file 18 * @kit PerformanceAnalysisKit 19 */ 20 21/** 22 * Provide interfaces related to debugger access and obtaining CPU, 23 * memory and other virtual machine information during runtime for JS programs 24 * 25 * @namespace hidebug 26 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 27 * @since 8 28 */ 29 30/** 31 * Provide interfaces related to debugger access and obtaining CPU, 32 * memory and other virtual machine information during runtime for JS programs 33 * 34 * @namespace hidebug 35 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 36 * @atomicservice 37 * @since 12 38 */ 39 40declare namespace hidebug { 41 /** 42 * Get total native heap memory size 43 * 44 * @returns { bigint } Returns total native heap memory size. 45 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 46 * @since 8 47 */ 48 function getNativeHeapSize(): bigint; 49 50 /** 51 * Get Native heap memory allocation size. 52 * @returns { bigint } Returns native heap memory allocation size. 53 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 54 * @since 8 55 */ 56 function getNativeHeapAllocatedSize(): bigint; 57 58 /** 59 * Get Native heap memory free size 60 * 61 * @returns { bigint } Returns native heap memory free size. 62 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 63 * @since 8 64 */ 65 function getNativeHeapFreeSize(): bigint; 66 67 /** 68 * Get the virtual set size memory of the application process 69 * 70 * @returns { bigint } Returns application process virtual set size memory information. 71 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 72 * @since 11 73 */ 74 function getVss(): bigint; 75 76 /** 77 * Get application process proportional set size memory information 78 * 79 * @returns { bigint } Returns application process proportional set size memory information. 80 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 81 * @since 8 82 */ 83 function getPss(): bigint; 84 85 /** 86 * Obtains the size of the shared dirty memory of a process. 87 * 88 * @returns { bigint } Returns the size of the shared dirty memory. 89 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 90 * @since 8 91 */ 92 function getSharedDirty(): bigint; 93 94 /** 95 * Obtains the size of the private dirty memory of a process. 96 * @returns { bigint } Returns the size of the private dirty memory. 97 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 98 * @since 9 99 */ 100 function getPrivateDirty(): bigint; 101 102 /** 103 * Obtains the cpu usage percent of a process. 104 * 105 * @returns { number } Returns the cpu usage of a process. 106 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 107 * @since 9 108 */ 109 function getCpuUsage(): number; 110 111 /** 112 * Start CPU Profiling. 113 * The input parameter is a user-defined file name, excluding the file suffix. 114 * The generated file is in the files folder under the application directory. 115 * Such as "/data/accounts/account_0/appdata/[package name]/files/cpuprofiler-xxx.json" 116 * 117 * @param { string } filename - Indicates the user-defined file name, excluding the file suffix. 118 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 119 * @since 8 120 * @deprecated since 9 121 * @useinstead ohos.hidebug/hidebug.startJsCpuProfiling 122 */ 123 function startProfiling(filename: string): void; 124 125 /** 126 * Stop CPU Profiling. 127 * It takes effect only when the CPU profiler is turned on 128 * 129 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 130 * @since 8 131 * @deprecated since 9 132 * @useinstead ohos.hidebug/hidebug.stopJsCpuProfiling 133 */ 134 function stopProfiling(): void; 135 136 /** 137 * Dump JS Virtual Machine Heap Snapshot. 138 * The input parameter is a user-defined file name, excluding the file suffix. 139 * The generated file is in the files folder under the application directory. 140 * Such as "/data/accounts/account_0/appdata/[package name]/files/xxx.heapsnapshot" 141 * 142 * @param { string } filename - Indicates the user-defined file name, excluding the file suffix. 143 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 144 * @since 8 145 * @deprecated since 9 146 * @useinstead ohos.hidebug/hidebug.dumpJsHeapData 147 */ 148 function dumpHeapData(filename: string): void; 149 150 /** 151 * Start CPU Profiling. 152 * The input parameter is a user-defined file name, excluding the file suffix. 153 * The generated file is in the files folder under the application directory. 154 * 155 * @param { string } filename - Indicates the user-defined file name, excluding the file suffix. 156 * @throws {BusinessError} 401 - the parameter check failed, Parameter type error 157 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 158 * @since 9 159 */ 160 function startJsCpuProfiling(filename: string): void; 161 162 /** 163 * Stop CPU Profiling. 164 * It takes effect only when the CPU profiler is turned on 165 * 166 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 167 * @since 9 168 */ 169 function stopJsCpuProfiling(): void; 170 171 /** 172 * Dump JS Virtual Machine Heap Snapshot. 173 * The input parameter is a user-defined file name, excluding the file suffix. 174 * The generated file is in the files folder under the application directory. 175 * 176 * @param { string } filename - Indicates the user-defined file name, excluding the file suffix. 177 * @throws {BusinessError} 401 - the parameter check failed, Parameter type error 178 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 179 * @since 9 180 */ 181 function dumpJsHeapData(filename: string): void; 182 183 /** 184 * Get a debugging dump of a system service by service id. 185 * It need dump permission. 186 * This API can be called only by system application. 187 * 188 * @permission ohos.permission.DUMP 189 * @param { number } serviceid - Indicates the id of the service ability. 190 * @param { number } fd - The file descriptor. 191 * @param { Array<string> } args - The args list of the system ability dump interface. 192 * @throws {BusinessError} 401 - the parameter check failed, Possible causes: 193 * 1.the parameter type error 194 * 2.the args parameter is not string array 195 * @throws {BusinessError} 11400101 - ServiceId invalid. The system ability does not exist. 196 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 197 * @since 9 198 */ 199 function getServiceDump(serviceid: number, fd: number, args: Array<string>): void; 200 201 /** 202 * Obtains the cpu usage of system. 203 * 204 * @returns { number } Returns the cpu usage of system. 205 * @throws { BusinessError } 11400104 - The status of the system CPU usage is abnormal. 206 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 207 * @since 12 208 */ 209 function getSystemCpuUsage(): number; 210 211 /** 212 * Application CPU usage of thread. 213 * 214 * @interface ThreadCpuUsage 215 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 216 * @since 12 217 */ 218 interface ThreadCpuUsage { 219 /** 220 * Thread id 221 * 222 * @type { number } 223 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 224 * @since 12 225 */ 226 threadId: number; 227 /** 228 * Cpu usage of thread 229 * 230 * @type { number } 231 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 232 * @since 12 233 */ 234 cpuUsage: number; 235 } 236 237 /** 238 * Get the CPU usage of all threads in the application. 239 * 240 * @returns { ThreadCpuUsage[] } Returns the CPU usage of all threads in the application. 241 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 242 * @since 12 243 */ 244 function getAppThreadCpuUsage(): ThreadCpuUsage[]; 245 246 /** 247 * System memory information 248 * 249 * @interface SystemMemInfo 250 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 251 * @since 12 252 */ 253 interface SystemMemInfo { 254 /** 255 * Total system memory size, in kilobyte 256 * 257 * @type { bigint } 258 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 259 * @since 12 260 */ 261 totalMem: bigint; 262 /** 263 * System free memory size, in kilobyte 264 * 265 * @type { bigint } 266 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 267 * @since 12 268 */ 269 freeMem: bigint; 270 /** 271 * System available memory size, in kilobyte 272 * 273 * @type { bigint } 274 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 275 * @since 12 276 */ 277 availableMem: bigint; 278 } 279 280 /** 281 * Obtains the system memory size. 282 * 283 * @returns { SystemMemInfo } Returns system memory size. 284 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 285 * @since 12 286 */ 287 function getSystemMemInfo(): SystemMemInfo; 288 289 /** 290 * Application process native memory information. 291 * 292 * @interface NativeMemInfo 293 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 294 * @since 12 295 */ 296 interface NativeMemInfo { 297 /** 298 * Process proportional set size memory, in kilobyte 299 * 300 * @type { bigint } 301 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 302 * @since 12 303 */ 304 pss: bigint; 305 /** 306 * Virtual set size memory, in kilobyte 307 * 308 * @type { bigint } 309 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 310 * @since 12 311 */ 312 vss: bigint; 313 /** 314 * Resident set size, in kilobyte 315 * 316 * @type { bigint } 317 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 318 * @since 12 319 */ 320 rss: bigint; 321 /** 322 * The size of the shared dirty memory, in kilobyte 323 * 324 * @type { bigint } 325 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 326 * @since 12 327 */ 328 sharedDirty: bigint; 329 /** 330 * The size of the private dirty memory, in kilobyte 331 * 332 * @type { bigint } 333 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 334 * @since 12 335 */ 336 privateDirty: bigint; 337 /** 338 * The size of the shared clean memory, in kilobyte 339 * 340 * @type { bigint } 341 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 342 * @since 12 343 */ 344 sharedClean: bigint; 345 /** 346 * The size of the private clean memory, in kilobyte 347 * 348 * @type { bigint } 349 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 350 * @since 12 351 */ 352 privateClean: bigint; 353 } 354 355 /** 356 * Obtains the memory information of application process. 357 * 358 * @returns { NativeMemInfo } Returns the native memory of a process. 359 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 360 * @since 12 361 */ 362 function getAppNativeMemInfo(): NativeMemInfo; 363 364 /** 365 * Application process memory limit 366 * 367 * @interface MemoryLimit 368 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 369 * @since 12 370 */ 371 interface MemoryLimit { 372 /** 373 * The limit of the application process's resident set, in kilobyte 374 * 375 * @type { bigint } 376 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 377 * @since 12 378 */ 379 rssLimit: bigint; 380 /** 381 * The limit of the application process's virtual memory, in kilobyte 382 * 383 * @type { bigint } 384 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 385 * @since 12 386 */ 387 vssLimit: bigint; 388 /** 389 * The limit of the js vm heap size of current virtual machine, in kilobyte 390 * 391 * @type { bigint } 392 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 393 * @since 12 394 */ 395 vmHeapLimit: bigint; 396 /** 397 * The limit of the total js vm heap size of process, in kilobyte 398 * 399 * @type { bigint } 400 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 401 * @since 12 402 */ 403 vmTotalHeapSize: bigint; 404 } 405 406 /** 407 * Obtains the memory limit of application process. 408 * 409 * @returns { MemoryLimit } Returns memory limit of application. 410 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 411 * @since 12 412 */ 413 function getAppMemoryLimit(): MemoryLimit; 414 415 /** 416 * The memory information of application virtual machine. 417 * 418 * @interface VMMemoryInfo 419 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 420 * @since 12 421 */ 422 interface VMMemoryInfo { 423 /** 424 * Total size of current virtual machine Heap, in kilobyte 425 * 426 * @type { bigint } 427 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 428 * @since 12 429 */ 430 totalHeap: bigint; 431 /** 432 * Used size of current virtual machine Heap, in kilobyte 433 * 434 * @type { bigint } 435 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 436 * @since 12 437 */ 438 heapUsed: bigint; 439 /** 440 * All array object size of current virtual machine, in kilobyte 441 * 442 * @type { bigint } 443 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 444 * @since 12 445 */ 446 allArraySize: bigint; 447 } 448 449 /** 450 * Obtains the memory information of application virtual machine. 451 * 452 * @returns { VMMemoryInfo } Returns memory information of application virtual machine. 453 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 454 * @since 12 455 */ 456 function getAppVMMemoryInfo(): VMMemoryInfo; 457 458 /** 459 * Enum for trace flag 460 * 461 * @enum { number } 462 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 463 * @since 12 464 */ 465 enum TraceFlag { 466 /** 467 * Only capture main thread trace 468 * 469 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 470 * @since 12 471 */ 472 MAIN_THREAD = 1, 473 /** 474 * Capture all thread trace 475 * 476 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 477 * @since 12 478 */ 479 ALL_THREADS = 2 480 } 481 482 /** 483 * Provide trace tags 484 * 485 * @namespace tags 486 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 487 * @since 12 488 */ 489 namespace tags { 490 /** 491 * Ability Manager tag. 492 * 493 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 494 * @since 12 495 */ 496 const ABILITY_MANAGER: number; 497 /** 498 * ARKUI development framework tag. 499 * 500 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 501 * @since 12 502 */ 503 const ARKUI: number; 504 /** 505 * ARK tag. 506 * 507 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 508 * @since 12 509 */ 510 const ARK: number; 511 /** 512 * Bluetooth tag. 513 * 514 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 515 * @since 12 516 */ 517 const BLUETOOTH: number; 518 /** 519 * Common library subsystem tag. 520 * 521 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 522 * @since 12 523 */ 524 const COMMON_LIBRARY: number; 525 /** 526 * Distributed hardware device manager tag. 527 * 528 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 529 * @since 12 530 */ 531 const DISTRIBUTED_HARDWARE_DEVICE_MANAGER: number; 532 /** 533 * Distributed audio tag. 534 * 535 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 536 * @since 12 537 */ 538 const DISTRIBUTED_AUDIO: number; 539 /** 540 * Distributed camera tag. 541 * 542 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 543 * @since 12 544 */ 545 const DISTRIBUTED_CAMERA: number; 546 /** 547 * Distributed data manager module tag. 548 * 549 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 550 * @since 12 551 */ 552 const DISTRIBUTED_DATA: number; 553 /** 554 * Distributed hardware framework tag. 555 * 556 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 557 * @since 12 558 */ 559 const DISTRIBUTED_HARDWARE_FRAMEWORK: number; 560 /** 561 * Distributed input tag. 562 * 563 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 564 * @since 12 565 */ 566 const DISTRIBUTED_INPUT: number; 567 /** 568 * Distributed screen tag. 569 * 570 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 571 * @since 12 572 */ 573 const DISTRIBUTED_SCREEN: number; 574 /** 575 * Distributed scheduler tag. 576 * 577 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 578 * @since 12 579 */ 580 const DISTRIBUTED_SCHEDULER: number; 581 /** 582 * FFRT tasks. 583 * 584 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 585 * @since 12 586 */ 587 const FFRT: number; 588 /** 589 * File management tag. 590 * 591 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 592 * @since 12 593 */ 594 const FILE_MANAGEMENT: number; 595 /** 596 * Global resource manager tag. 597 * 598 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 599 * @since 12 600 */ 601 const GLOBAL_RESOURCE_MANAGER: number; 602 /** 603 * Graphics module tag. 604 * 605 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 606 * @since 12 607 */ 608 const GRAPHICS: number; 609 /** 610 * HDF subsystem tag. 611 * 612 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 613 * @since 12 614 */ 615 const HDF: number; 616 /** 617 * MISC module tag. 618 * 619 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 620 * @since 12 621 */ 622 const MISC: number; 623 /** 624 * Multimodal input module tag. 625 * 626 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 627 * @since 12 628 */ 629 const MULTIMODAL_INPUT: number; 630 /** 631 * Net tag. 632 * 633 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 634 * @since 12 635 */ 636 const NET: number; 637 /** 638 * Notification module tag. 639 * 640 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 641 * @since 12 642 */ 643 const NOTIFICATION: number; 644 /** 645 * NWeb tag. 646 * 647 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 648 * @since 12 649 */ 650 const NWEB: number; 651 /** 652 * OHOS generic tag. 653 * 654 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 655 * @since 12 656 */ 657 const OHOS: number; 658 /** 659 * Power manager tag. 660 * 661 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 662 * @since 12 663 */ 664 const POWER_MANAGER: number; 665 /** 666 * RPC tag. 667 * 668 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 669 * @since 12 670 */ 671 const RPC: number; 672 /** 673 * SA tag. 674 * 675 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 676 * @since 12 677 */ 678 const SAMGR: number; 679 /** 680 * Window manager tag. 681 * 682 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 683 * @since 12 684 */ 685 const WINDOW_MANAGER: number; 686 /** 687 * Audio module tag. 688 * 689 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 690 * @since 12 691 */ 692 const AUDIO: number; 693 /** 694 * Camera module tag. 695 * 696 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 697 * @since 12 698 */ 699 const CAMERA: number; 700 /** 701 * Image module tag. 702 * 703 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 704 * @since 12 705 */ 706 const IMAGE: number; 707 /** 708 * Media module tag. 709 * 710 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 711 * @since 12 712 */ 713 const MEDIA: number; 714 } 715 716 /** 717 * Start capture application trace. 718 * 719 * @param { number[] } tags - Tag of trace. 720 * @param { TraceFlag } flag - Trace flag. 721 * @param { number } limitSize - Max size of trace file, in bytes, the max is 500MB. 722 * @returns { string } Returns absolute path of the trace file. 723 * @throws { BusinessError } 401 - Invalid argument, Possible causes: 724 * 1.The limit parameter is too small 725 * 2.The parameter is not within the enumeration type 726 * 3.The parameter type error or parameter order error 727 * @throws { BusinessError } 11400102 - Capture trace already enabled. 728 * @throws { BusinessError } 11400103 - No write permission on the file. 729 * @throws { BusinessError } 11400104 - Abnormal trace status. 730 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 731 * @since 12 732 */ 733 function startAppTraceCapture(tags: number[], flag: TraceFlag, limitSize: number): string; 734 735 /** 736 * Stop capture application trace. 737 * 738 * @throws { BusinessError } 11400104 - The status of the trace is abnormal 739 * @throws { BusinessError } 11400105 - No capture trace running 740 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 741 * @since 12 742 */ 743 function stopAppTraceCapture(): void; 744 745 /** 746 * Collection statistics. 747 * 748 * @typedef { Record<string, number> } GcStats 749 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 750 * @since 12 751 */ 752 type GcStats = Record<string, number>; 753 754 /** 755 * Get the garbage collection statistics. 756 * 757 * @returns { GcStats } Returns garbage collection statistics. 758 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 759 * @since 12 760 */ 761 function getVMRuntimeStats(): GcStats; 762 763 /** 764 * Get the garbage collection statistics by statistical item. 765 * 766 * @param { string } item - statistical item. 767 * @returns { number } Returns garbage collection statistics. 768 * @throws { BusinessError } 401 - Possible causes: 769 * 1. Invalid parameter, a string parameter required. 770 * 2. Invalid parameter, unknown property. 771 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 772 * @since 12 773 */ 774 function getVMRuntimeStat(item: string): number; 775 776 /** 777 * Set the resource limitation of application.Please note that this function is only valid 778 * when the developer options switch of setting is turned on. 779 * 780 * @param { string } type - resource type. It could be pss_memory、js_heap、fd、or thread. 781 * @param { number } value - For different resource type, values could have different meaning: 782 * 1.For pss_memory, it means the baseline PSS memory size for the application, 783 * system memory control will be triggered if exceed the value too much. 784 * 2.For js_heap, it means the percentage of the used JS heap memory to the maximum limit exceed 785 * which heap dump will be triggered if enableDebugLog set as true, it can be set between 85 and 95. 786 * 3.For fd, it means the maximum fd number can be opened. 787 * 4.For thread, it means the maximum thread number can be created. 788 * @param { boolean } enableDebugLog - Whether to enable external debug log. Default is false, pls make sure set 789 * it as true only in gray release because collecting debug log will cost too much cpu or memory. 790 * @throws { BusinessError } 401 - Invalid argument, Possible causes: 791 * 1.The limit parameter is too small 792 * 2.The parameter is not in the specified type 793 * 3.The parameter type error or parameter order error 794 * @throws { BusinessError } 11400104 - Set limit failed due to remote exception 795 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 796 * @atomicservice 797 * @since 12 798 */ 799 function setAppResourceLimit(type: string, value: number, enableDebugLog: boolean): void; 800 801 /** 802 * Judge if the application is in debugged state, including either in arkui layer or native layer debugged state. 803 * 804 * @returns { boolean } true if the application is debugged. 805 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 806 * @since 12 807 */ 808 function isDebugState(): boolean; 809 810 /** 811 * Get the graphics memory of application 812 * 813 * @returns { Promise<number> } Returns the graphics memory of application, in kilobyte. 814 * @throws { BusinessError } 11400104 - Failed to get the application memory due to a remote exception. 815 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 816 * @atomicservice 817 * @since 14 818 */ 819 function getGraphicsMemory(): Promise<number>; 820 821 /** 822 * Get the graphics memory of application 823 * 824 * @returns { number } Returns the graphics memory of application, in kilobyte. 825 * @throws { BusinessError } 11400104 - Failed to get the application memory due to a remote exception. 826 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 827 * @atomicservice 828 * @since 14 829 */ 830 function getGraphicsMemorySync(): number; 831 832 /** 833 * Dump the raw heap snapshot of the JavaScript Virtual Machine for the current thread. 834 * 835 * The generated file will be stored in a folder within the application directory. However, since this file is usually 836 * large, the system imposes restrictions on the frequency and number of calls to this function. Consequently, you 837 * might fail to obtain the dump file due to quota limitations. These failures will persist until the quota is 838 * regularly refreshed by the system. Therefore, it is advisable to delete the file immediately after you have 839 * finished processing it. Moreover, it is recommended that you use this function in the gray - release version. 840 * 841 * @param { boolean } needGC - Whether do GC before dump, default is true. 842 * @returns { Promise<string> } Returns the full path of raw heap snapshot file. 843 * @throws { BusinessError } 11400106 - Quota exceeded. 844 * @throws { BusinessError } 11400107 - Fork operation failed. 845 * @throws { BusinessError } 11400108 - Failed to wait for the child process to finish. 846 * @throws { BusinessError } 11400109 - Timeout while waiting for the child process to finish. 847 * @throws { BusinessError } 11400110 - Disk remaining space too low. 848 * @throws { BusinessError } 11400111 - Napi interface call exception. 849 * @throws { BusinessError } 11400112 - Repeated data dump. 850 * @throws { BusinessError } 11400113 - Failed to create dump file. 851 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 852 * @atomicservice 853 * @since 18 854 */ 855 function dumpJsRawHeapData(needGC?: boolean): Promise<string>; 856} 857export default hidebug; 858