161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci* Copyright (C) 2022 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci* Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci* you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci* You may obtain a copy of the License at
661847f8eSopenharmony_ci*
761847f8eSopenharmony_ci*     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci*
961847f8eSopenharmony_ci* Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci* distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci* See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci* limitations under the License.
1461847f8eSopenharmony_ci*/
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit PerformanceAnalysisKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ci/**
2261847f8eSopenharmony_ci * Provide interfaces related to debugger access and obtaining CPU,
2361847f8eSopenharmony_ci * memory and other virtual machine information during runtime for JS programs
2461847f8eSopenharmony_ci *
2561847f8eSopenharmony_ci * @namespace hidebug
2661847f8eSopenharmony_ci * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
2761847f8eSopenharmony_ci * @since 8
2861847f8eSopenharmony_ci */
2961847f8eSopenharmony_ci
3061847f8eSopenharmony_ci/**
3161847f8eSopenharmony_ci * Provide interfaces related to debugger access and obtaining CPU,
3261847f8eSopenharmony_ci * memory and other virtual machine information during runtime for JS programs
3361847f8eSopenharmony_ci *
3461847f8eSopenharmony_ci * @namespace hidebug
3561847f8eSopenharmony_ci * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
3661847f8eSopenharmony_ci * @atomicservice
3761847f8eSopenharmony_ci * @since 12
3861847f8eSopenharmony_ci */
3961847f8eSopenharmony_ci
4061847f8eSopenharmony_cideclare namespace hidebug {
4161847f8eSopenharmony_ci  /**
4261847f8eSopenharmony_ci   * Get total native heap memory size
4361847f8eSopenharmony_ci   *
4461847f8eSopenharmony_ci   * @returns { bigint } Returns total native heap memory size.
4561847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
4661847f8eSopenharmony_ci   * @since 8
4761847f8eSopenharmony_ci   */
4861847f8eSopenharmony_ci  function getNativeHeapSize(): bigint;
4961847f8eSopenharmony_ci
5061847f8eSopenharmony_ci  /**
5161847f8eSopenharmony_ci   * Get Native heap memory allocation size.
5261847f8eSopenharmony_ci   * @returns { bigint } Returns native heap memory allocation size.
5361847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
5461847f8eSopenharmony_ci   * @since 8
5561847f8eSopenharmony_ci   */
5661847f8eSopenharmony_ci  function getNativeHeapAllocatedSize(): bigint;
5761847f8eSopenharmony_ci
5861847f8eSopenharmony_ci  /**
5961847f8eSopenharmony_ci   * Get Native heap memory free size
6061847f8eSopenharmony_ci   *
6161847f8eSopenharmony_ci   * @returns { bigint } Returns native heap memory free size.
6261847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
6361847f8eSopenharmony_ci   * @since 8
6461847f8eSopenharmony_ci   */
6561847f8eSopenharmony_ci  function getNativeHeapFreeSize(): bigint;
6661847f8eSopenharmony_ci
6761847f8eSopenharmony_ci  /**
6861847f8eSopenharmony_ci   * Get the virtual set size memory of the application process
6961847f8eSopenharmony_ci   *
7061847f8eSopenharmony_ci   * @returns { bigint } Returns application process virtual set size memory information.
7161847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
7261847f8eSopenharmony_ci   * @since 11
7361847f8eSopenharmony_ci   */
7461847f8eSopenharmony_ci  function getVss(): bigint;
7561847f8eSopenharmony_ci
7661847f8eSopenharmony_ci  /**
7761847f8eSopenharmony_ci   * Get application process proportional set size memory information
7861847f8eSopenharmony_ci   *
7961847f8eSopenharmony_ci   * @returns { bigint } Returns application process proportional set size memory information.
8061847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
8161847f8eSopenharmony_ci   * @since 8
8261847f8eSopenharmony_ci   */
8361847f8eSopenharmony_ci  function getPss(): bigint;
8461847f8eSopenharmony_ci
8561847f8eSopenharmony_ci  /**
8661847f8eSopenharmony_ci   * Obtains the size of the shared dirty memory of a process.
8761847f8eSopenharmony_ci   *
8861847f8eSopenharmony_ci   * @returns { bigint } Returns the size of the shared dirty memory.
8961847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
9061847f8eSopenharmony_ci   * @since 8
9161847f8eSopenharmony_ci   */
9261847f8eSopenharmony_ci  function getSharedDirty(): bigint;
9361847f8eSopenharmony_ci
9461847f8eSopenharmony_ci  /**
9561847f8eSopenharmony_ci   * Obtains the size of the private dirty memory of a process.
9661847f8eSopenharmony_ci   * @returns { bigint } Returns the size of the private dirty memory.
9761847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
9861847f8eSopenharmony_ci   * @since 9
9961847f8eSopenharmony_ci   */
10061847f8eSopenharmony_ci  function getPrivateDirty(): bigint;
10161847f8eSopenharmony_ci
10261847f8eSopenharmony_ci  /**
10361847f8eSopenharmony_ci   * Obtains the cpu usage percent of a process.
10461847f8eSopenharmony_ci   *
10561847f8eSopenharmony_ci   * @returns { number } Returns the cpu usage of a process.
10661847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
10761847f8eSopenharmony_ci   * @since 9
10861847f8eSopenharmony_ci   */
10961847f8eSopenharmony_ci  function getCpuUsage(): number;
11061847f8eSopenharmony_ci
11161847f8eSopenharmony_ci  /**
11261847f8eSopenharmony_ci   * Start CPU Profiling.
11361847f8eSopenharmony_ci   * The input parameter is a user-defined file name, excluding the file suffix.
11461847f8eSopenharmony_ci   * The generated file is in the files folder under the application directory.
11561847f8eSopenharmony_ci   * Such as "/data/accounts/account_0/appdata/[package name]/files/cpuprofiler-xxx.json"
11661847f8eSopenharmony_ci   *
11761847f8eSopenharmony_ci   * @param { string } filename - Indicates the user-defined file name,  excluding the file suffix.
11861847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
11961847f8eSopenharmony_ci   * @since 8
12061847f8eSopenharmony_ci   * @deprecated since 9
12161847f8eSopenharmony_ci   * @useinstead ohos.hidebug/hidebug.startJsCpuProfiling
12261847f8eSopenharmony_ci   */
12361847f8eSopenharmony_ci  function startProfiling(filename: string): void;
12461847f8eSopenharmony_ci
12561847f8eSopenharmony_ci  /**
12661847f8eSopenharmony_ci   * Stop CPU Profiling.
12761847f8eSopenharmony_ci   * It takes effect only when the CPU profiler is turned on
12861847f8eSopenharmony_ci   *
12961847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
13061847f8eSopenharmony_ci   * @since 8
13161847f8eSopenharmony_ci   * @deprecated since 9
13261847f8eSopenharmony_ci   * @useinstead ohos.hidebug/hidebug.stopJsCpuProfiling
13361847f8eSopenharmony_ci   */
13461847f8eSopenharmony_ci  function stopProfiling(): void;
13561847f8eSopenharmony_ci
13661847f8eSopenharmony_ci  /**
13761847f8eSopenharmony_ci   * Dump JS Virtual Machine Heap Snapshot.
13861847f8eSopenharmony_ci   * The input parameter is a user-defined file name, excluding the file suffix.
13961847f8eSopenharmony_ci   * The generated file is in the files folder under the application directory.
14061847f8eSopenharmony_ci   * Such as "/data/accounts/account_0/appdata/[package name]/files/xxx.heapsnapshot"
14161847f8eSopenharmony_ci   *
14261847f8eSopenharmony_ci   * @param { string } filename - Indicates the user-defined file name, excluding the file suffix.
14361847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
14461847f8eSopenharmony_ci   * @since 8
14561847f8eSopenharmony_ci   * @deprecated since 9
14661847f8eSopenharmony_ci   * @useinstead ohos.hidebug/hidebug.dumpJsHeapData
14761847f8eSopenharmony_ci   */
14861847f8eSopenharmony_ci  function dumpHeapData(filename: string): void;
14961847f8eSopenharmony_ci
15061847f8eSopenharmony_ci  /**
15161847f8eSopenharmony_ci   * Start CPU Profiling.
15261847f8eSopenharmony_ci   * The input parameter is a user-defined file name, excluding the file suffix.
15361847f8eSopenharmony_ci   * The generated file is in the files folder under the application directory.
15461847f8eSopenharmony_ci   *
15561847f8eSopenharmony_ci   * @param { string } filename - Indicates the user-defined file name,  excluding the file suffix.
15661847f8eSopenharmony_ci   * @throws {BusinessError} 401 - the parameter check failed, Parameter type error
15761847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
15861847f8eSopenharmony_ci   * @since 9
15961847f8eSopenharmony_ci   */
16061847f8eSopenharmony_ci  function startJsCpuProfiling(filename: string): void;
16161847f8eSopenharmony_ci
16261847f8eSopenharmony_ci  /**
16361847f8eSopenharmony_ci   * Stop CPU Profiling.
16461847f8eSopenharmony_ci   * It takes effect only when the CPU profiler is turned on
16561847f8eSopenharmony_ci   *
16661847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
16761847f8eSopenharmony_ci   * @since 9
16861847f8eSopenharmony_ci   */
16961847f8eSopenharmony_ci  function stopJsCpuProfiling(): void;
17061847f8eSopenharmony_ci
17161847f8eSopenharmony_ci  /**
17261847f8eSopenharmony_ci   * Dump JS Virtual Machine Heap Snapshot.
17361847f8eSopenharmony_ci   * The input parameter is a user-defined file name, excluding the file suffix.
17461847f8eSopenharmony_ci   * The generated file is in the files folder under the application directory.
17561847f8eSopenharmony_ci   *
17661847f8eSopenharmony_ci   * @param { string } filename - Indicates the user-defined file name, excluding the file suffix.
17761847f8eSopenharmony_ci   * @throws {BusinessError} 401 - the parameter check failed, Parameter type error
17861847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
17961847f8eSopenharmony_ci   * @since 9
18061847f8eSopenharmony_ci   */
18161847f8eSopenharmony_ci  function dumpJsHeapData(filename: string): void;
18261847f8eSopenharmony_ci
18361847f8eSopenharmony_ci  /**
18461847f8eSopenharmony_ci   * Get a debugging dump of a system service by service id.
18561847f8eSopenharmony_ci   * It need dump permission.
18661847f8eSopenharmony_ci   * This API can be called only by system application.
18761847f8eSopenharmony_ci   *
18861847f8eSopenharmony_ci   * @permission ohos.permission.DUMP
18961847f8eSopenharmony_ci   * @param { number } serviceid - Indicates the id of the service ability.
19061847f8eSopenharmony_ci   * @param { number } fd - The file descriptor.
19161847f8eSopenharmony_ci   * @param { Array<string> } args - The args list of the system ability dump interface.
19261847f8eSopenharmony_ci   * @throws {BusinessError} 401 - the parameter check failed, Possible causes:
19361847f8eSopenharmony_ci   *                               1.the parameter type error
19461847f8eSopenharmony_ci   *                               2.the args parameter is not string array
19561847f8eSopenharmony_ci   * @throws {BusinessError} 11400101 - ServiceId invalid. The system ability does not exist.
19661847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
19761847f8eSopenharmony_ci   * @since 9
19861847f8eSopenharmony_ci   */
19961847f8eSopenharmony_ci  function getServiceDump(serviceid: number, fd: number, args: Array<string>): void;
20061847f8eSopenharmony_ci
20161847f8eSopenharmony_ci  /**
20261847f8eSopenharmony_ci   * Obtains the cpu usage of system.
20361847f8eSopenharmony_ci   *
20461847f8eSopenharmony_ci   * @returns { number } Returns the cpu usage of system.
20561847f8eSopenharmony_ci   * @throws { BusinessError } 11400104 - The status of the system CPU usage is abnormal.
20661847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
20761847f8eSopenharmony_ci   * @since 12
20861847f8eSopenharmony_ci   */
20961847f8eSopenharmony_ci  function getSystemCpuUsage(): number;
21061847f8eSopenharmony_ci
21161847f8eSopenharmony_ci  /**
21261847f8eSopenharmony_ci   * Application CPU usage of thread.
21361847f8eSopenharmony_ci   *
21461847f8eSopenharmony_ci   * @interface ThreadCpuUsage
21561847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
21661847f8eSopenharmony_ci   * @since 12
21761847f8eSopenharmony_ci   */
21861847f8eSopenharmony_ci  interface ThreadCpuUsage {
21961847f8eSopenharmony_ci    /**
22061847f8eSopenharmony_ci     * Thread id
22161847f8eSopenharmony_ci     *
22261847f8eSopenharmony_ci     * @type { number }
22361847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
22461847f8eSopenharmony_ci     * @since 12
22561847f8eSopenharmony_ci     */
22661847f8eSopenharmony_ci    threadId: number;
22761847f8eSopenharmony_ci    /**
22861847f8eSopenharmony_ci     * Cpu usage of thread
22961847f8eSopenharmony_ci     *
23061847f8eSopenharmony_ci     * @type { number }
23161847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
23261847f8eSopenharmony_ci     * @since 12
23361847f8eSopenharmony_ci     */
23461847f8eSopenharmony_ci    cpuUsage: number;
23561847f8eSopenharmony_ci  }
23661847f8eSopenharmony_ci
23761847f8eSopenharmony_ci  /**
23861847f8eSopenharmony_ci   * Get the CPU usage of all threads in the application.
23961847f8eSopenharmony_ci   *
24061847f8eSopenharmony_ci   * @returns { ThreadCpuUsage[] } Returns the CPU usage of all threads in the application.
24161847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
24261847f8eSopenharmony_ci   * @since 12
24361847f8eSopenharmony_ci   */
24461847f8eSopenharmony_ci  function getAppThreadCpuUsage(): ThreadCpuUsage[];
24561847f8eSopenharmony_ci
24661847f8eSopenharmony_ci  /**
24761847f8eSopenharmony_ci   * System memory information
24861847f8eSopenharmony_ci   *
24961847f8eSopenharmony_ci   * @interface SystemMemInfo
25061847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
25161847f8eSopenharmony_ci   * @since 12
25261847f8eSopenharmony_ci   */
25361847f8eSopenharmony_ci  interface SystemMemInfo {
25461847f8eSopenharmony_ci    /**
25561847f8eSopenharmony_ci     * Total system memory size, in kilobyte
25661847f8eSopenharmony_ci     *
25761847f8eSopenharmony_ci     * @type { bigint }
25861847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
25961847f8eSopenharmony_ci     * @since 12
26061847f8eSopenharmony_ci     */
26161847f8eSopenharmony_ci    totalMem: bigint;
26261847f8eSopenharmony_ci    /**
26361847f8eSopenharmony_ci     * System free memory size, in kilobyte
26461847f8eSopenharmony_ci     *
26561847f8eSopenharmony_ci     * @type { bigint }
26661847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
26761847f8eSopenharmony_ci     * @since 12
26861847f8eSopenharmony_ci     */
26961847f8eSopenharmony_ci    freeMem: bigint;
27061847f8eSopenharmony_ci    /**
27161847f8eSopenharmony_ci     * System available memory size, in kilobyte
27261847f8eSopenharmony_ci     *
27361847f8eSopenharmony_ci     * @type { bigint }
27461847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
27561847f8eSopenharmony_ci     * @since 12
27661847f8eSopenharmony_ci     */
27761847f8eSopenharmony_ci    availableMem: bigint;
27861847f8eSopenharmony_ci  }
27961847f8eSopenharmony_ci
28061847f8eSopenharmony_ci  /**
28161847f8eSopenharmony_ci   * Obtains the system memory size.
28261847f8eSopenharmony_ci   *
28361847f8eSopenharmony_ci   * @returns { SystemMemInfo } Returns system memory size.
28461847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
28561847f8eSopenharmony_ci   * @since 12
28661847f8eSopenharmony_ci   */
28761847f8eSopenharmony_ci  function getSystemMemInfo(): SystemMemInfo;
28861847f8eSopenharmony_ci
28961847f8eSopenharmony_ci  /**
29061847f8eSopenharmony_ci   * Application process native memory information.
29161847f8eSopenharmony_ci   *
29261847f8eSopenharmony_ci   * @interface NativeMemInfo
29361847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
29461847f8eSopenharmony_ci   * @since 12
29561847f8eSopenharmony_ci   */
29661847f8eSopenharmony_ci  interface NativeMemInfo {
29761847f8eSopenharmony_ci    /**
29861847f8eSopenharmony_ci     * Process proportional set size memory, in kilobyte
29961847f8eSopenharmony_ci     *
30061847f8eSopenharmony_ci     * @type { bigint }
30161847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
30261847f8eSopenharmony_ci     * @since 12
30361847f8eSopenharmony_ci     */
30461847f8eSopenharmony_ci    pss: bigint;
30561847f8eSopenharmony_ci    /**
30661847f8eSopenharmony_ci     * Virtual set size memory, in kilobyte
30761847f8eSopenharmony_ci     *
30861847f8eSopenharmony_ci     * @type { bigint }
30961847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
31061847f8eSopenharmony_ci     * @since 12
31161847f8eSopenharmony_ci     */
31261847f8eSopenharmony_ci    vss: bigint;
31361847f8eSopenharmony_ci    /**
31461847f8eSopenharmony_ci     * Resident set size, in kilobyte
31561847f8eSopenharmony_ci     *
31661847f8eSopenharmony_ci     * @type { bigint }
31761847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
31861847f8eSopenharmony_ci     * @since 12
31961847f8eSopenharmony_ci     */
32061847f8eSopenharmony_ci    rss: bigint;
32161847f8eSopenharmony_ci    /**
32261847f8eSopenharmony_ci     * The size of the shared dirty memory, in kilobyte
32361847f8eSopenharmony_ci     *
32461847f8eSopenharmony_ci     * @type { bigint }
32561847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
32661847f8eSopenharmony_ci     * @since 12
32761847f8eSopenharmony_ci     */
32861847f8eSopenharmony_ci    sharedDirty: bigint;
32961847f8eSopenharmony_ci    /**
33061847f8eSopenharmony_ci     * The size of the private dirty memory, in kilobyte
33161847f8eSopenharmony_ci     *
33261847f8eSopenharmony_ci     * @type { bigint }
33361847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
33461847f8eSopenharmony_ci     * @since 12
33561847f8eSopenharmony_ci     */
33661847f8eSopenharmony_ci    privateDirty: bigint;
33761847f8eSopenharmony_ci    /**
33861847f8eSopenharmony_ci     * The size of the shared clean memory, in kilobyte
33961847f8eSopenharmony_ci     *
34061847f8eSopenharmony_ci     * @type { bigint }
34161847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
34261847f8eSopenharmony_ci     * @since 12
34361847f8eSopenharmony_ci     */
34461847f8eSopenharmony_ci    sharedClean: bigint;
34561847f8eSopenharmony_ci    /**
34661847f8eSopenharmony_ci     * The size of the private clean memory, in kilobyte
34761847f8eSopenharmony_ci     *
34861847f8eSopenharmony_ci     * @type { bigint }
34961847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
35061847f8eSopenharmony_ci     * @since 12
35161847f8eSopenharmony_ci     */
35261847f8eSopenharmony_ci    privateClean: bigint;
35361847f8eSopenharmony_ci  }
35461847f8eSopenharmony_ci
35561847f8eSopenharmony_ci  /**
35661847f8eSopenharmony_ci   * Obtains the memory information of application process.
35761847f8eSopenharmony_ci   *
35861847f8eSopenharmony_ci   * @returns { NativeMemInfo } Returns the native memory of a process.
35961847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
36061847f8eSopenharmony_ci   * @since 12
36161847f8eSopenharmony_ci   */
36261847f8eSopenharmony_ci  function getAppNativeMemInfo(): NativeMemInfo;
36361847f8eSopenharmony_ci
36461847f8eSopenharmony_ci  /**
36561847f8eSopenharmony_ci   * Application process memory limit
36661847f8eSopenharmony_ci   *
36761847f8eSopenharmony_ci   * @interface MemoryLimit
36861847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
36961847f8eSopenharmony_ci   * @since 12
37061847f8eSopenharmony_ci   */
37161847f8eSopenharmony_ci  interface MemoryLimit {
37261847f8eSopenharmony_ci    /**
37361847f8eSopenharmony_ci     * The limit of the application process's resident set, in kilobyte
37461847f8eSopenharmony_ci     *
37561847f8eSopenharmony_ci     * @type { bigint }
37661847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
37761847f8eSopenharmony_ci     * @since 12
37861847f8eSopenharmony_ci     */
37961847f8eSopenharmony_ci    rssLimit: bigint;
38061847f8eSopenharmony_ci    /**
38161847f8eSopenharmony_ci     * The limit of the application process's virtual memory, in kilobyte
38261847f8eSopenharmony_ci     *
38361847f8eSopenharmony_ci     * @type { bigint }
38461847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
38561847f8eSopenharmony_ci     * @since 12
38661847f8eSopenharmony_ci     */
38761847f8eSopenharmony_ci    vssLimit: bigint;
38861847f8eSopenharmony_ci    /**
38961847f8eSopenharmony_ci     * The limit of the js vm heap size of current virtual machine, in kilobyte
39061847f8eSopenharmony_ci     *
39161847f8eSopenharmony_ci     * @type { bigint }
39261847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
39361847f8eSopenharmony_ci     * @since 12
39461847f8eSopenharmony_ci     */
39561847f8eSopenharmony_ci    vmHeapLimit: bigint;
39661847f8eSopenharmony_ci    /**
39761847f8eSopenharmony_ci     * The limit of the total js vm heap size of process, in kilobyte
39861847f8eSopenharmony_ci     *
39961847f8eSopenharmony_ci     * @type { bigint }
40061847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
40161847f8eSopenharmony_ci     * @since 12
40261847f8eSopenharmony_ci     */
40361847f8eSopenharmony_ci    vmTotalHeapSize: bigint;
40461847f8eSopenharmony_ci  }
40561847f8eSopenharmony_ci
40661847f8eSopenharmony_ci  /**
40761847f8eSopenharmony_ci   * Obtains the memory limit of application process.
40861847f8eSopenharmony_ci   *
40961847f8eSopenharmony_ci   * @returns { MemoryLimit } Returns memory limit of application.
41061847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
41161847f8eSopenharmony_ci   * @since 12
41261847f8eSopenharmony_ci   */
41361847f8eSopenharmony_ci  function getAppMemoryLimit(): MemoryLimit;
41461847f8eSopenharmony_ci
41561847f8eSopenharmony_ci  /**
41661847f8eSopenharmony_ci   * The memory information of application virtual machine.
41761847f8eSopenharmony_ci   *
41861847f8eSopenharmony_ci   * @interface VMMemoryInfo
41961847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
42061847f8eSopenharmony_ci   * @since 12
42161847f8eSopenharmony_ci   */
42261847f8eSopenharmony_ci  interface VMMemoryInfo {
42361847f8eSopenharmony_ci    /**
42461847f8eSopenharmony_ci     * Total size of current virtual machine Heap, in kilobyte
42561847f8eSopenharmony_ci     *
42661847f8eSopenharmony_ci     * @type { bigint }
42761847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
42861847f8eSopenharmony_ci     * @since 12
42961847f8eSopenharmony_ci     */
43061847f8eSopenharmony_ci    totalHeap: bigint;
43161847f8eSopenharmony_ci    /**
43261847f8eSopenharmony_ci     * Used size of current virtual machine Heap, in kilobyte
43361847f8eSopenharmony_ci     *
43461847f8eSopenharmony_ci     * @type { bigint }
43561847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
43661847f8eSopenharmony_ci     * @since 12
43761847f8eSopenharmony_ci     */
43861847f8eSopenharmony_ci    heapUsed: bigint;
43961847f8eSopenharmony_ci    /**
44061847f8eSopenharmony_ci     * All array object size of current virtual machine, in kilobyte
44161847f8eSopenharmony_ci     *
44261847f8eSopenharmony_ci     * @type { bigint }
44361847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
44461847f8eSopenharmony_ci     * @since 12
44561847f8eSopenharmony_ci     */
44661847f8eSopenharmony_ci    allArraySize: bigint;
44761847f8eSopenharmony_ci  }
44861847f8eSopenharmony_ci
44961847f8eSopenharmony_ci  /**
45061847f8eSopenharmony_ci   * Obtains the memory information of application virtual machine.
45161847f8eSopenharmony_ci   *
45261847f8eSopenharmony_ci   * @returns { VMMemoryInfo } Returns memory information of application virtual machine.
45361847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
45461847f8eSopenharmony_ci   * @since 12
45561847f8eSopenharmony_ci   */
45661847f8eSopenharmony_ci  function getAppVMMemoryInfo(): VMMemoryInfo;
45761847f8eSopenharmony_ci
45861847f8eSopenharmony_ci  /**
45961847f8eSopenharmony_ci   * Enum for trace flag
46061847f8eSopenharmony_ci   *
46161847f8eSopenharmony_ci   * @enum { number }
46261847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
46361847f8eSopenharmony_ci   * @since 12
46461847f8eSopenharmony_ci   */
46561847f8eSopenharmony_ci  enum TraceFlag {
46661847f8eSopenharmony_ci    /**
46761847f8eSopenharmony_ci     * Only capture main thread trace
46861847f8eSopenharmony_ci     *
46961847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
47061847f8eSopenharmony_ci     * @since 12
47161847f8eSopenharmony_ci     */
47261847f8eSopenharmony_ci    MAIN_THREAD = 1,
47361847f8eSopenharmony_ci    /**
47461847f8eSopenharmony_ci     * Capture all thread trace
47561847f8eSopenharmony_ci     *
47661847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
47761847f8eSopenharmony_ci     * @since 12
47861847f8eSopenharmony_ci     */
47961847f8eSopenharmony_ci    ALL_THREADS = 2
48061847f8eSopenharmony_ci  }
48161847f8eSopenharmony_ci
48261847f8eSopenharmony_ci  /**
48361847f8eSopenharmony_ci   * Provide trace tags
48461847f8eSopenharmony_ci   *
48561847f8eSopenharmony_ci   * @namespace tags
48661847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
48761847f8eSopenharmony_ci   * @since 12
48861847f8eSopenharmony_ci   */
48961847f8eSopenharmony_ci  namespace tags {
49061847f8eSopenharmony_ci    /**
49161847f8eSopenharmony_ci     * Ability Manager tag.
49261847f8eSopenharmony_ci     *
49361847f8eSopenharmony_ci     * @constant
49461847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
49561847f8eSopenharmony_ci     * @since 12
49661847f8eSopenharmony_ci     */
49761847f8eSopenharmony_ci    const ABILITY_MANAGER: number;
49861847f8eSopenharmony_ci    /**
49961847f8eSopenharmony_ci     * ARKUI development framework tag.
50061847f8eSopenharmony_ci     *
50161847f8eSopenharmony_ci     * @constant
50261847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
50361847f8eSopenharmony_ci     * @since 12
50461847f8eSopenharmony_ci     */
50561847f8eSopenharmony_ci    const ARKUI: number;
50661847f8eSopenharmony_ci    /**
50761847f8eSopenharmony_ci     * ARK tag.
50861847f8eSopenharmony_ci     *
50961847f8eSopenharmony_ci     * @constant
51061847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
51161847f8eSopenharmony_ci     * @since 12
51261847f8eSopenharmony_ci     */
51361847f8eSopenharmony_ci    const ARK: number;
51461847f8eSopenharmony_ci    /**
51561847f8eSopenharmony_ci     * Bluetooth tag.
51661847f8eSopenharmony_ci     *
51761847f8eSopenharmony_ci     * @constant
51861847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
51961847f8eSopenharmony_ci     * @since 12
52061847f8eSopenharmony_ci     */
52161847f8eSopenharmony_ci    const BLUETOOTH: number;
52261847f8eSopenharmony_ci    /**
52361847f8eSopenharmony_ci     * Common library subsystem tag.
52461847f8eSopenharmony_ci     *
52561847f8eSopenharmony_ci     * @constant
52661847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
52761847f8eSopenharmony_ci     * @since 12
52861847f8eSopenharmony_ci     */
52961847f8eSopenharmony_ci    const COMMON_LIBRARY: number;
53061847f8eSopenharmony_ci    /**
53161847f8eSopenharmony_ci     * Distributed hardware device manager tag.
53261847f8eSopenharmony_ci     *
53361847f8eSopenharmony_ci     * @constant
53461847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
53561847f8eSopenharmony_ci     * @since 12
53661847f8eSopenharmony_ci     */
53761847f8eSopenharmony_ci    const DISTRIBUTED_HARDWARE_DEVICE_MANAGER: number;
53861847f8eSopenharmony_ci    /**
53961847f8eSopenharmony_ci     * Distributed audio tag.
54061847f8eSopenharmony_ci     *
54161847f8eSopenharmony_ci     * @constant
54261847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
54361847f8eSopenharmony_ci     * @since 12
54461847f8eSopenharmony_ci     */
54561847f8eSopenharmony_ci    const DISTRIBUTED_AUDIO: number;
54661847f8eSopenharmony_ci    /**
54761847f8eSopenharmony_ci     * Distributed camera tag.
54861847f8eSopenharmony_ci     *
54961847f8eSopenharmony_ci     * @constant
55061847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
55161847f8eSopenharmony_ci     * @since 12
55261847f8eSopenharmony_ci     */
55361847f8eSopenharmony_ci    const DISTRIBUTED_CAMERA: number;
55461847f8eSopenharmony_ci    /**
55561847f8eSopenharmony_ci     * Distributed data manager module tag.
55661847f8eSopenharmony_ci     *
55761847f8eSopenharmony_ci     * @constant
55861847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
55961847f8eSopenharmony_ci     * @since 12
56061847f8eSopenharmony_ci     */
56161847f8eSopenharmony_ci    const DISTRIBUTED_DATA: number;
56261847f8eSopenharmony_ci    /**
56361847f8eSopenharmony_ci     * Distributed hardware framework tag.
56461847f8eSopenharmony_ci     *
56561847f8eSopenharmony_ci     * @constant
56661847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
56761847f8eSopenharmony_ci     * @since 12
56861847f8eSopenharmony_ci     */
56961847f8eSopenharmony_ci    const DISTRIBUTED_HARDWARE_FRAMEWORK: number;
57061847f8eSopenharmony_ci    /**
57161847f8eSopenharmony_ci     * Distributed input tag.
57261847f8eSopenharmony_ci     *
57361847f8eSopenharmony_ci     * @constant
57461847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
57561847f8eSopenharmony_ci     * @since 12
57661847f8eSopenharmony_ci     */
57761847f8eSopenharmony_ci    const DISTRIBUTED_INPUT: number;
57861847f8eSopenharmony_ci    /**
57961847f8eSopenharmony_ci     * Distributed screen tag.
58061847f8eSopenharmony_ci     *
58161847f8eSopenharmony_ci     * @constant
58261847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
58361847f8eSopenharmony_ci     * @since 12
58461847f8eSopenharmony_ci     */
58561847f8eSopenharmony_ci    const DISTRIBUTED_SCREEN: number;
58661847f8eSopenharmony_ci    /**
58761847f8eSopenharmony_ci     * Distributed scheduler tag.
58861847f8eSopenharmony_ci     *
58961847f8eSopenharmony_ci     * @constant
59061847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
59161847f8eSopenharmony_ci     * @since 12
59261847f8eSopenharmony_ci     */
59361847f8eSopenharmony_ci    const DISTRIBUTED_SCHEDULER: number;
59461847f8eSopenharmony_ci    /**
59561847f8eSopenharmony_ci     * FFRT tasks.
59661847f8eSopenharmony_ci     *
59761847f8eSopenharmony_ci     * @constant
59861847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
59961847f8eSopenharmony_ci     * @since 12
60061847f8eSopenharmony_ci     */
60161847f8eSopenharmony_ci    const FFRT: number;
60261847f8eSopenharmony_ci    /**
60361847f8eSopenharmony_ci     * File management tag.
60461847f8eSopenharmony_ci     *
60561847f8eSopenharmony_ci     * @constant
60661847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
60761847f8eSopenharmony_ci     * @since 12
60861847f8eSopenharmony_ci     */
60961847f8eSopenharmony_ci    const FILE_MANAGEMENT: number;
61061847f8eSopenharmony_ci    /**
61161847f8eSopenharmony_ci     * Global resource manager tag.
61261847f8eSopenharmony_ci     *
61361847f8eSopenharmony_ci     * @constant
61461847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
61561847f8eSopenharmony_ci     * @since 12
61661847f8eSopenharmony_ci     */
61761847f8eSopenharmony_ci    const GLOBAL_RESOURCE_MANAGER: number;
61861847f8eSopenharmony_ci    /**
61961847f8eSopenharmony_ci     * Graphics module tag.
62061847f8eSopenharmony_ci     *
62161847f8eSopenharmony_ci     * @constant
62261847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
62361847f8eSopenharmony_ci     * @since 12
62461847f8eSopenharmony_ci     */
62561847f8eSopenharmony_ci    const GRAPHICS: number;
62661847f8eSopenharmony_ci    /**
62761847f8eSopenharmony_ci     * HDF subsystem tag.
62861847f8eSopenharmony_ci     *
62961847f8eSopenharmony_ci     * @constant
63061847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
63161847f8eSopenharmony_ci     * @since 12
63261847f8eSopenharmony_ci     */
63361847f8eSopenharmony_ci    const HDF: number;
63461847f8eSopenharmony_ci    /**
63561847f8eSopenharmony_ci     * MISC module tag.
63661847f8eSopenharmony_ci     *
63761847f8eSopenharmony_ci     * @constant
63861847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
63961847f8eSopenharmony_ci     * @since 12
64061847f8eSopenharmony_ci     */
64161847f8eSopenharmony_ci    const MISC: number;
64261847f8eSopenharmony_ci    /**
64361847f8eSopenharmony_ci     * Multimodal input module tag.
64461847f8eSopenharmony_ci     *
64561847f8eSopenharmony_ci     * @constant
64661847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
64761847f8eSopenharmony_ci     * @since 12
64861847f8eSopenharmony_ci     */
64961847f8eSopenharmony_ci    const MULTIMODAL_INPUT: number;
65061847f8eSopenharmony_ci    /**
65161847f8eSopenharmony_ci     * Net tag.
65261847f8eSopenharmony_ci     *
65361847f8eSopenharmony_ci     * @constant
65461847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
65561847f8eSopenharmony_ci     * @since 12
65661847f8eSopenharmony_ci     */
65761847f8eSopenharmony_ci    const NET: number;
65861847f8eSopenharmony_ci    /**
65961847f8eSopenharmony_ci     * Notification module tag.
66061847f8eSopenharmony_ci     *
66161847f8eSopenharmony_ci     * @constant
66261847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
66361847f8eSopenharmony_ci     * @since 12
66461847f8eSopenharmony_ci     */
66561847f8eSopenharmony_ci    const NOTIFICATION: number;
66661847f8eSopenharmony_ci    /**
66761847f8eSopenharmony_ci     * NWeb tag.
66861847f8eSopenharmony_ci     *
66961847f8eSopenharmony_ci     * @constant
67061847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
67161847f8eSopenharmony_ci     * @since 12
67261847f8eSopenharmony_ci     */
67361847f8eSopenharmony_ci    const NWEB: number;
67461847f8eSopenharmony_ci    /**
67561847f8eSopenharmony_ci     * OHOS generic tag.
67661847f8eSopenharmony_ci     *
67761847f8eSopenharmony_ci     * @constant
67861847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
67961847f8eSopenharmony_ci     * @since 12
68061847f8eSopenharmony_ci     */
68161847f8eSopenharmony_ci    const OHOS: number;
68261847f8eSopenharmony_ci    /**
68361847f8eSopenharmony_ci     * Power manager tag.
68461847f8eSopenharmony_ci     *
68561847f8eSopenharmony_ci     * @constant
68661847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
68761847f8eSopenharmony_ci     * @since 12
68861847f8eSopenharmony_ci     */
68961847f8eSopenharmony_ci    const POWER_MANAGER: number;
69061847f8eSopenharmony_ci    /**
69161847f8eSopenharmony_ci     * RPC tag.
69261847f8eSopenharmony_ci     *
69361847f8eSopenharmony_ci     * @constant
69461847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
69561847f8eSopenharmony_ci     * @since 12
69661847f8eSopenharmony_ci     */
69761847f8eSopenharmony_ci    const RPC: number;
69861847f8eSopenharmony_ci    /**
69961847f8eSopenharmony_ci     * SA tag.
70061847f8eSopenharmony_ci     *
70161847f8eSopenharmony_ci     * @constant
70261847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
70361847f8eSopenharmony_ci     * @since 12
70461847f8eSopenharmony_ci     */
70561847f8eSopenharmony_ci    const SAMGR: number;
70661847f8eSopenharmony_ci    /**
70761847f8eSopenharmony_ci     * Window manager tag.
70861847f8eSopenharmony_ci     *
70961847f8eSopenharmony_ci     * @constant
71061847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
71161847f8eSopenharmony_ci     * @since 12
71261847f8eSopenharmony_ci     */
71361847f8eSopenharmony_ci    const WINDOW_MANAGER: number;
71461847f8eSopenharmony_ci    /**
71561847f8eSopenharmony_ci     * Audio module tag.
71661847f8eSopenharmony_ci     *
71761847f8eSopenharmony_ci     * @constant
71861847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
71961847f8eSopenharmony_ci     * @since 12
72061847f8eSopenharmony_ci     */
72161847f8eSopenharmony_ci    const AUDIO: number;
72261847f8eSopenharmony_ci    /**
72361847f8eSopenharmony_ci     * Camera module tag.
72461847f8eSopenharmony_ci     *
72561847f8eSopenharmony_ci     * @constant
72661847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
72761847f8eSopenharmony_ci     * @since 12
72861847f8eSopenharmony_ci     */
72961847f8eSopenharmony_ci    const CAMERA: number;
73061847f8eSopenharmony_ci    /**
73161847f8eSopenharmony_ci     * Image module tag.
73261847f8eSopenharmony_ci     *
73361847f8eSopenharmony_ci     * @constant
73461847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
73561847f8eSopenharmony_ci     * @since 12
73661847f8eSopenharmony_ci     */
73761847f8eSopenharmony_ci    const IMAGE: number;
73861847f8eSopenharmony_ci    /**
73961847f8eSopenharmony_ci     * Media module tag.
74061847f8eSopenharmony_ci     *
74161847f8eSopenharmony_ci     * @constant
74261847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
74361847f8eSopenharmony_ci     * @since 12
74461847f8eSopenharmony_ci     */
74561847f8eSopenharmony_ci    const MEDIA: number;
74661847f8eSopenharmony_ci  }
74761847f8eSopenharmony_ci
74861847f8eSopenharmony_ci  /**
74961847f8eSopenharmony_ci   * Start capture application trace.
75061847f8eSopenharmony_ci   *
75161847f8eSopenharmony_ci   * @param { number[] } tags - Tag of trace.
75261847f8eSopenharmony_ci   * @param { TraceFlag } flag - Trace flag.
75361847f8eSopenharmony_ci   * @param { number } limitSize - Max size of trace file, in bytes, the max is 500MB.
75461847f8eSopenharmony_ci   * @returns { string } Returns absolute path of the trace file.
75561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Invalid argument, Possible causes:
75661847f8eSopenharmony_ci   *                           1.The limit parameter is too small
75761847f8eSopenharmony_ci   *                           2.The parameter is not within the enumeration type
75861847f8eSopenharmony_ci   *                           3.The parameter type error or parameter order error
75961847f8eSopenharmony_ci   * @throws { BusinessError } 11400102 - Capture trace already enabled.
76061847f8eSopenharmony_ci   * @throws { BusinessError } 11400103 - No write permission on the file.
76161847f8eSopenharmony_ci   * @throws { BusinessError } 11400104 - Abnormal trace status.
76261847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
76361847f8eSopenharmony_ci   * @since 12
76461847f8eSopenharmony_ci   */
76561847f8eSopenharmony_ci  function startAppTraceCapture(tags: number[], flag: TraceFlag, limitSize: number): string;
76661847f8eSopenharmony_ci
76761847f8eSopenharmony_ci  /**
76861847f8eSopenharmony_ci   * Stop capture application trace.
76961847f8eSopenharmony_ci   *
77061847f8eSopenharmony_ci   * @throws { BusinessError } 11400104 - The status of the trace is abnormal
77161847f8eSopenharmony_ci   * @throws { BusinessError } 11400105 - No capture trace running
77261847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
77361847f8eSopenharmony_ci   * @since 12
77461847f8eSopenharmony_ci   */
77561847f8eSopenharmony_ci  function stopAppTraceCapture(): void;
77661847f8eSopenharmony_ci
77761847f8eSopenharmony_ci  /**
77861847f8eSopenharmony_ci   * Collection statistics.
77961847f8eSopenharmony_ci   *
78061847f8eSopenharmony_ci   * @typedef { Record<string, number> } GcStats
78161847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
78261847f8eSopenharmony_ci   * @since 12
78361847f8eSopenharmony_ci   */
78461847f8eSopenharmony_ci  type GcStats = Record<string, number>;
78561847f8eSopenharmony_ci
78661847f8eSopenharmony_ci  /**
78761847f8eSopenharmony_ci   * Get the garbage collection statistics.
78861847f8eSopenharmony_ci   *
78961847f8eSopenharmony_ci   * @returns { GcStats } Returns garbage collection statistics.
79061847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
79161847f8eSopenharmony_ci   * @since 12
79261847f8eSopenharmony_ci   */
79361847f8eSopenharmony_ci  function getVMRuntimeStats(): GcStats;
79461847f8eSopenharmony_ci
79561847f8eSopenharmony_ci  /**
79661847f8eSopenharmony_ci   * Get the garbage collection statistics by statistical item.
79761847f8eSopenharmony_ci   *
79861847f8eSopenharmony_ci   * @param { string } item - statistical item.
79961847f8eSopenharmony_ci   * @returns { number } Returns garbage collection statistics.
80061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Possible causes:
80161847f8eSopenharmony_ci   *                           1. Invalid parameter, a string parameter required.
80261847f8eSopenharmony_ci   *                           2. Invalid parameter, unknown property.
80361847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
80461847f8eSopenharmony_ci   * @since 12
80561847f8eSopenharmony_ci   */
80661847f8eSopenharmony_ci  function getVMRuntimeStat(item: string): number;
80761847f8eSopenharmony_ci
80861847f8eSopenharmony_ci  /**
80961847f8eSopenharmony_ci   * Set the resource limitation of application.Please note that this function is only valid
81061847f8eSopenharmony_ci   * when the developer options switch of setting is turned on.
81161847f8eSopenharmony_ci   * 
81261847f8eSopenharmony_ci   * @param { string } type - resource type. It could be pss_memory、js_heap、fd、or thread.
81361847f8eSopenharmony_ci   * @param { number } value - For different resource type, values could have different meaning:
81461847f8eSopenharmony_ci   *                           1.For pss_memory, it means the baseline PSS memory size for the application,
81561847f8eSopenharmony_ci   *                             system memory control will be triggered if exceed the value too much.
81661847f8eSopenharmony_ci   *                           2.For js_heap, it means the percentage of the used JS heap memory to the maximum limit exceed
81761847f8eSopenharmony_ci   *                            which heap dump will be triggered if enableDebugLog set as true, it can be set between 85 and 95.
81861847f8eSopenharmony_ci   *                           3.For fd, it means the maximum fd number can be opened.
81961847f8eSopenharmony_ci   *                           4.For thread, it means the maximum thread number can be created.
82061847f8eSopenharmony_ci   * @param { boolean } enableDebugLog - Whether to enable external debug log. Default is false, pls make sure set
82161847f8eSopenharmony_ci   *                                      it as true only in gray release because collecting debug log will cost too much cpu or memory.
82261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Invalid argument, Possible causes:
82361847f8eSopenharmony_ci   *                           1.The limit parameter is too small
82461847f8eSopenharmony_ci   *                           2.The parameter is not in the specified type
82561847f8eSopenharmony_ci   *                           3.The parameter type error or parameter order error
82661847f8eSopenharmony_ci   * @throws { BusinessError } 11400104 - Set limit failed due to remote exception
82761847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
82861847f8eSopenharmony_ci   * @atomicservice
82961847f8eSopenharmony_ci   * @since 12
83061847f8eSopenharmony_ci   */
83161847f8eSopenharmony_ci  function setAppResourceLimit(type: string, value: number, enableDebugLog: boolean): void;
83261847f8eSopenharmony_ci
83361847f8eSopenharmony_ci  /**
83461847f8eSopenharmony_ci   * Judge if the application is in debugged state, including either in arkui layer or native layer debugged state.
83561847f8eSopenharmony_ci   *
83661847f8eSopenharmony_ci   * @returns { boolean } true if the application is debugged.
83761847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
83861847f8eSopenharmony_ci   * @since 12
83961847f8eSopenharmony_ci   */
84061847f8eSopenharmony_ci  function isDebugState(): boolean;
84161847f8eSopenharmony_ci
84261847f8eSopenharmony_ci  /**
84361847f8eSopenharmony_ci   * Get the graphics memory of application
84461847f8eSopenharmony_ci   *
84561847f8eSopenharmony_ci   * @returns { Promise<number> } Returns the graphics memory of application, in kilobyte.
84661847f8eSopenharmony_ci   * @throws { BusinessError } 11400104 - Failed to get the application memory due to a remote exception.
84761847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
84861847f8eSopenharmony_ci   * @atomicservice
84961847f8eSopenharmony_ci   * @since 13
85061847f8eSopenharmony_ci   */
85161847f8eSopenharmony_ci  function getGraphicsMemory(): Promise<number>;
85261847f8eSopenharmony_ci
85361847f8eSopenharmony_ci  /**
85461847f8eSopenharmony_ci   * Get the graphics memory of application
85561847f8eSopenharmony_ci   *
85661847f8eSopenharmony_ci   * @returns { number } Returns the graphics memory of application, in kilobyte.
85761847f8eSopenharmony_ci   * @throws { BusinessError } 11400104 - Failed to get the application memory due to a remote exception.
85861847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
85961847f8eSopenharmony_ci   * @atomicservice
86061847f8eSopenharmony_ci   * @since 13
86161847f8eSopenharmony_ci   */
86261847f8eSopenharmony_ci  function getGraphicsMemorySync(): number;
86361847f8eSopenharmony_ci}
86461847f8eSopenharmony_ciexport default hidebug;
865