From e554ea4272dad44cf18a557c94a8390c59ebb268 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Sat, 26 Mar 2022 17:43:01 +0800 Subject: [PATCH] update docs Signed-off-by: shawn_he --- .../reference/apis/js-apis-hiappevent.md | 99 ++++++++++--------- .../reference/apis/js-apis-hidebug.md | 78 ++++++++------- .../reference/apis/js-apis-hilog.md | 85 +++++++++------- .../reference/apis/js-apis-hitracechain.md | 10 +- .../reference/apis/js-apis-hitracemeter.md | 14 +-- 5 files changed, 160 insertions(+), 126 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-hiappevent.md b/en/application-dev/reference/apis/js-apis-hiappevent.md index 0d8534643b..dbeec70a14 100644 --- a/en/application-dev/reference/apis/js-apis-hiappevent.md +++ b/en/application-dev/reference/apis/js-apis-hiappevent.md @@ -11,25 +11,22 @@ import hiAppEvent from '@ohos.hiAppEvent'; ``` -## System Capabilities - -SystemCapability.HiviewDFX.HiAppEvent - - ## hiAppEvent.write write(eventName: string, eventType: EventType, keyValues: object, callback: AsyncCallback<void>): void -Writes event information to the event file of the current day. This function supports JSON parameters and uses an asynchronous callback to return the result. +Writes event information to the event file of the current day. This API supports JSON parameters and uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.HiviewDFX.HiAppEvent **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| eventName | string | Yes| App event name.| -| eventType | [EventType](#eventtype) | Yes| Application event type.| -| keyValues | object | Yes| Array of JSON parameters of the application event. A key must be a string, and a value must be a string, number, boolean, or Array (which can only be a string, number, or boolean).| -| callback | AsyncCallback<void> | No| Callback used to process the received return value.
- The value **0** indicates that the event parameter verification is successful, and the event will be written to the event file asynchronously.
- A value greater than **0** indicates that invalid parameters are present in the event, and the event will be written to the event file asynchronously after the invalid parameters are ignored.
- A value smaller than **0** indicates that the event parameter verification fails, and the event will not be written to the event file asynchronously.| +| Name | Type | Mandatory| Description | +| --------- | ------------------------- | ---- | ------------------------------------------------------------ | +| eventName | string | Yes | App event name.
You need to customize the event name. It can contain a maximum of 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a letter.| +| eventType | [EventType](#eventtype) | Yes | Application event type. | +| keyValues | object | Yes | Parameter key-value pair. For a variable-length parameter, enter each pair of parameter name and value in sequence. For a JSON parameter, enter the parameter name as the key and parameter value as the value.
- A key must be a string, and a value must be a string, number, boolean, or Array (which can only be a string, number, or boolean).
- The number of event parameters must be less than or equal to 32.
- The parameter name can contain a maximum of 16 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a letter and cannot end with an underscore (\_).
- A string value can contain a maximum of 8*1024 characters.
- An array value can contain a maximum of 100 elements. Excess elements will be truncated.| +| callback | AsyncCallback<void> | No | Callback used to process the received return value.
-  Value **0** indicates that the event verification is successful, and the event will be written to the event file asynchronously.
-  A value greater than **0** indicates that invalid parameters are present in the event, and the event will be written to the event file asynchronously after the invalid parameters are ignored.
-  A value smaller than **0** indicates that the event verification fails, and the event will not be written to the event file.| **Example** @@ -51,20 +48,22 @@ hiAppEvent.write("test_event", hiAppEvent.EventType.FAULT, {"int_data":100, "str write(eventName: string, eventType: EventType, keyValues: object): Promise<void> -Writes event information to the event file of the current day. This function supports JSON parameters and uses a promise to return the result. +Writes event information to the event file of the current day. This API supports JSON parameters and uses a promise to return the result. + +**System capability**: SystemCapability.HiviewDFX.HiAppEvent **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| eventName | string | Yes| App event name.| -| eventType | [EventType](#eventtype) | Yes| Application event type.| -| keyValues | object | Yes| Array of JSON parameters of the application event. A key must be a string, and a value must be a string, number, boolean, or Array (which can only be a string, number, or boolean).| +| Name | Type | Mandatory| Description | +| --------- | ----------------------- | ---- | ------------------------------------------------------------ | +| eventName | string | Yes | App event name.
You need to customize the event name. It can contain a maximum of 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a letter.| +| eventType | [EventType](#eventtype) | Yes | Application event type. | +| keyValues | object | Yes | Parameter key-value pair. For a variable-length parameter, enter each pair of parameter name and value in sequence. For a JSON parameter, enter the parameter name as the key and parameter value as the value.
- A key must be a string, and a value must be a string, number, boolean, or Array (which can only be a string, number, or boolean).
- The number of event parameters must be less than or equal to 32.
- The parameter name can contain a maximum of 16 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a letter and cannot end with an underscore (\_).
- A string value can contain a maximum of 8*1024 characters.
- An array value can contain a maximum of 100 elements. Excess elements will be truncated.| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------------------- | ------------------------------------------------------------ | | Promise<void> | Promise used to process the callback in the then() and catch() methods when event writing succeeded or failed.| **Example** @@ -87,16 +86,18 @@ configure(config: ConfigOption): boolean Configures the application event logging function, such as setting the event logging switch and maximum size of the directory that stores the event logging files. +**System capability**: SystemCapability.HiviewDFX.HiAppEvent + **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| config | [ConfigOption](#configoption) | Yes| Configuration items for application event logging.| +| Name| Type | Mandatory| Description | +| ------ | ----------------------------- | ---- | ------------------------ | +| config | [ConfigOption](#configoption) | Yes | Configuration items for application event logging.| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | ----------------------------------------------------------- | | boolean | Returns **true** if the configuration is successful; returns **false** otherwise.| **Example** @@ -117,41 +118,49 @@ hiAppEvent.configure({ Provides the configuration items for application event logging. -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| disable | boolean | No| Application event logging switch. The value true means to disable the application event logging function, and the value false means the opposite.| -| maxStorage | string | No| Maximum size of the event file storage directory. The default value is **10M**. If the specified size is exceeded, the oldest event logging files in the storage directory will be deleted to free up space.| +**System capability**: SystemCapability.HiviewDFX.HiAppEvent + +| Name | Type | Mandatory| Description | +| ---------- | ------- | ---- | ------------------------------------------------------------ | +| disable | boolean | No | Application event logging switch. The value true means to disable the application event logging function, and the value false means the opposite.| +| maxStorage | string | No | Maximum size of the event file storage directory. The default value is **10M**. If the specified size is exceeded, the oldest event logging files in the storage directory will be deleted to free up space.| ## EventType Enumerates event types. -| Name| Default Value| Description| -| -------- | -------- | -------- | -| FAULT | 1 | Fault event| -| STATISTIC | 2 | Statistical event| -| SECURITY | 3 | Security event| -| BEHAVIOR | 4 | Behavior event| +**System capability**: SystemCapability.HiviewDFX.HiAppEvent + +| Name | Default Value| Description | +| --------- | ------ | -------------- | +| FAULT | 1 | Fault event| +| STATISTIC | 2 | Statistical event| +| SECURITY | 3 | Security event| +| BEHAVIOR | 4 | Behavior event| ## Event Provides constants that define the names of all predefined events. -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| USER_LOGIN | string | Yes| No| User login event.| -| USER_LOGOUT | string | Yes| No| User logout event.| -| DISTRIBUTED_SERVICE_START | string | Yes| No| Distributed service startup event.| +**System capability**: SystemCapability.HiviewDFX.HiAppEvent + +| Name | Type| Readable| Writable| Description | +| ------------------------- | -------- | ---- | ---- | -------------------- | +| USER_LOGIN | string | Yes | No | User login event. | +| USER_LOGOUT | string | Yes | No | User logout event. | +| DISTRIBUTED_SERVICE_START | string | Yes | No | Distributed service startup event.| ## Param Provides constants that define the names of all predefined event parameters. -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| USER_ID | string | Yes| No| Custom user ID.| -| DISTRIBUTED_SERVICE_NAME | string | Yes| No| Distributed service name.| -| DISTRIBUTED_SERVICE_INSTANCE_ID | string | Yes| No| Distributed service instance ID.| +**System capability**: SystemCapability.HiviewDFX.HiAppEvent + +| Name | Type| Readable| Writable| Description | +| ------------------------------- | -------- | ---- | ---- | ------------------ | +| USER_ID | string | Yes | No | Custom user ID. | +| DISTRIBUTED_SERVICE_NAME | string | Yes | No | Distributed service name. | +| DISTRIBUTED_SERVICE_INSTANCE_ID | string | Yes | No | Distributed service instance ID.| diff --git a/en/application-dev/reference/apis/js-apis-hidebug.md b/en/application-dev/reference/apis/js-apis-hidebug.md index 7e2473e5f4..c0844b51cb 100644 --- a/en/application-dev/reference/apis/js-apis-hidebug.md +++ b/en/application-dev/reference/apis/js-apis-hidebug.md @@ -12,24 +12,22 @@ import hidebug from '@ohos.hidebug'; ``` -## System Capabilities -SystemCapability.HiviewDFX.HiProfiler.HiDebug - - ## hidebug.getNativeHeapSize getNativeHeapSize(): bigint Obtains the total size of the native heap memory. +**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug -- **Return value** - | Type| Description| - | -------- | -------- | - | bigint | Total size of the native heap memory.| +**Return Value** +| Type | Description | +| ------ | --------------------------- | +| bigint | Total size of the native heap memory.| -- **Example** + +**Example** ``` let nativeHeapSize = hidebug.getNativeHeapSize(); ``` @@ -41,14 +39,16 @@ getNativeHeapAllocatedSize(): bigint Obtains the size of the allocated native heap memory. +**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug -- **Return value** - | Type| Description| - | -------- | -------- | - | bigint | Size of the allocated native heap memory.| +**Return Value** +| Type | Description | +| ------ | --------------------------------- | +| bigint | Size of the allocated native heap memory.| -- **Example** + +**Example** ``` let nativeHeapAllocatedSize = hidebug.getNativeHeapAllocatedSize(); ``` @@ -60,14 +60,16 @@ getNativeHeapFreeSize(): bigint Obtains the size of the free native heap memory. +**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug -- **Return value** - | Type| Description| - | -------- | -------- | - | bigint | Size of the free native heap memory.| +**Return Value** +| Type | Description | +| ------ | ------------------------------- | +| bigint | Size of the free native heap memory.| -- **Example** + +**Example** ``` let nativeHeapFreeSize = hidebug.getNativeHeapFreeSize(); ``` @@ -79,14 +81,16 @@ getPss(): bigint Obtains the PSS of this process. +**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug -- **Return value** - | Type| Description| - | -------- | -------- | - | bigint | PSS of the process.| +**Return Value** +| Type | Description | +| ------ | ------------------------- | +| bigint | PSS of the process.| -- **Example** + +**Example** ``` let pss = hidebug.getPss(); ``` @@ -98,14 +102,16 @@ getSharedDirty(): bigint Obtains the size of the shared dirty memory of this process. +**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug -- **Return value** - | Type| Description| - | -------- | -------- | - | bigint | Size of the shared dirty memory of the process.| +**Return Value** +| Type | Description | +| ------ | -------------------------- | +| bigint | Size of the shared dirty memory of the process.| -- **Example** + +**Example** ``` let sharedDirty = hidebug.getSharedDirty(); ``` @@ -117,11 +123,13 @@ startProfiling(filename : string) : void Starts the profiling method. `startProfiling()` and `stopProfiling()` are called in pairs. `startProfiling()` always occurs before `stopProfiling()`; that is, calling the functions in the following sequences is prohibited: `start->start->stop`, `start->stop->stop`, and `start->start->stop->stop`. +**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------- | ------ | ---- | ------------------------------------------------------------ | -| filename | string | Yes| User-defined profile name. The `filename.json` file is generated in the `files` directory of the application based on the specified `filename`.| +| filename | string | Yes | User-defined profile name. The `filename.json` file is generated in the `files` directory of the application based on the specified `filename`.| **Example** @@ -141,6 +149,8 @@ stopProfiling() : void Stops the profiling method. `stopProfiling()` and `startProfiling()` are called in pairs. `stopProfiling()` always occurs after `startProfiling()`; that is, calling the functions in the following sequences is prohibited: `start->start->stop`, `start->stop->stop`, and `start->start->stop->stop`. +**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug + **Example** ```js @@ -157,11 +167,13 @@ dumpHeapData(filename : string) : void Exports the heap data. +**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------- | ------ | ---- | ------------------------------------------------------------ | -| filename | string | Yes| User-defined heap file name. The `filename.heapsnapshot` file is generated in the `files` directory of the app based on the specified `filename`.| +| filename | string | Yes | User-defined heap file name. The `filename.heapsnapshot` file is generated in the `files` directory of the app based on the specified `filename`.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-hilog.md b/en/application-dev/reference/apis/js-apis-hilog.md index a2a02fd14c..13814a6e63 100644 --- a/en/application-dev/reference/apis/js-apis-hilog.md +++ b/en/application-dev/reference/apis/js-apis-hilog.md @@ -2,7 +2,7 @@ > **Note:** > -> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import @@ -10,9 +10,6 @@ import hilog from '@ohos.hilog'; ``` -## System Capabilities - -SystemCapability.HiviewDFX.HiLog ## hilog.debug @@ -20,14 +17,16 @@ debug(domain: number, tag: string, format: string, ...args: any[]) : void Prints logs of the DEBUG level. +**System capability**: SystemCapability.HiviewDFX.HiLog + **Parameters** -| Name| Type| Mandatory| Description| +| Name| Type | Mandatory| Description | | ------ | -------------- | ---- | ------------------------------------------------------------ | -| domain | number | Yes| Service domain. The value ranges from **0x0** to **0xFFFFF**.| -| tag | string | Yes| String constant used to identify the class or service behavior.| -| format | string | Yes| String constant format, including the parameter type and privacy identifier. A parameter without the privacy identifier is treated as a privacy parameter by default.| -| args | any[] | Yes| Variable-length parameter list corresponding to the parameter type in the format string. The number and type of parameters must map to the identifier in the format string.| +| domain | number | Yes | Service domain. The value ranges from **0x0** to **0xFFFFF**. | +| tag | string | Yes | String constant used to identify the class or service behavior. | +| format | string | Yes | String constant format, including the parameter type and privacy identifier. A parameter without the privacy identifier is treated as a privacy parameter by default.| +| args | any[] | Yes | Variable-length parameter list corresponding to the parameter type in the format string. The number and type of parameters must map to the identifier in the format string.| **Example** @@ -41,20 +40,22 @@ hilog.debug(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3 09-08 12:49:35.941 1547 2452 D FF00/testTag: 1: hello World 3.0 ``` -## **hilog.info** +## hilog.info info(domain: number, tag: string, format: string, ...args: any[]) : void Prints logs of the INFO level. +**System capability**: SystemCapability.HiviewDFX.HiLog + **Parameters** -| Name| Type| Mandatory| Description| +| Name| Type | Mandatory| Description | | ------ | -------------- | ---- | ------------------------------------------------------------ | -| domain | number | Yes| Service domain. The value ranges from **0x0** to **0xFFFFF**.| -| tag | string | Yes| String constant used to identify the class or service behavior.| -| format | string | Yes| String constant format, including the parameter type and privacy identifier. A parameter without the privacy identifier is treated as a privacy parameter by default.| -| args | any[] | Yes| Variable-length parameter list corresponding to the parameter type in the format string. The number and type of parameters must map to the identifier in the format string.| +| domain | number | Yes | Service domain. The value ranges from **0x0** to **0xFFFFF**. | +| tag | string | Yes | String constant used to identify the class or service behavior. | +| format | string | Yes | String constant format, including the parameter type and privacy identifier. A parameter without the privacy identifier is treated as a privacy parameter by default.| +| args | any[] | Yes | Variable-length parameter list corresponding to the parameter type in the format string. The number and type of parameters must map to the identifier in the format string.| **Example** @@ -74,14 +75,16 @@ warn(domain: number, tag: string, format: string, ...args: any[]) : void Prints logs of the WARN level. +**System capability**: SystemCapability.HiviewDFX.HiLog + **Parameters** -| Name| Type| Mandatory| Description| +| Name| Type | Mandatory| Description | | ------ | -------------- | ---- | ------------------------------------------------------------ | -| domain | number | Yes| Service domain. The value ranges from **0x0** to **0xFFFFF**.| -| tag | string | Yes| String constant used to identify the class or service behavior.| -| format | string | Yes| String constant format, including the parameter type and privacy identifier. A parameter without the privacy identifier is treated as a privacy parameter by default.| -| args | any[] | Yes| Variable-length parameter list corresponding to the parameter type in the format string. The number and type of parameters must map to the identifier in the format string.| +| domain | number | Yes | Service domain. The value ranges from **0x0** to **0xFFFFF**. | +| tag | string | Yes | String constant used to identify the class or service behavior. | +| format | string | Yes | String constant format, including the parameter type and privacy identifier. A parameter without the privacy identifier is treated as a privacy parameter by default.| +| args | any[] | Yes | Variable-length parameter list corresponding to the parameter type in the format string. The number and type of parameters must map to the identifier in the format string.| **Example** @@ -101,14 +104,16 @@ error(domain: number, tag: string, format: string, ...args: any[]) : void Prints logs of the ERROR level. +**System capability**: SystemCapability.HiviewDFX.HiLog + **Parameters** -| Name| Type| Mandatory| Description| +| Name| Type | Mandatory| Description | | ------ | -------------- | ---- | ------------------------------------------------------------ | -| domain | number | Yes| Service domain. The value ranges from **0x0** to **0xFFFFF**.| -| tag | string | Yes| String constant used to identify the class or service behavior.| -| format | string | Yes| String constant format, including the parameter type and privacy identifier. A parameter without the privacy identifier is treated as a privacy parameter by default.| -| args | any[] | Yes| Variable-length parameter list corresponding to the parameter type in the format string. The number and type of parameters must map to the identifier in the format string.| +| domain | number | Yes | Service domain. The value ranges from **0x0** to **0xFFFFF**. | +| tag | string | Yes | String constant used to identify the class or service behavior. | +| format | string | Yes | String constant format, including the parameter type and privacy identifier. A parameter without the privacy identifier is treated as a privacy parameter by default.| +| args | any[] | Yes | Variable-length parameter list corresponding to the parameter type in the format string. The number and type of parameters must map to the identifier in the format string.| **Example** @@ -128,14 +133,16 @@ fatal(domain: number, tag: string, format: string, ...args: any[]) : void Prints logs of the FATAL level. +**System capability**: SystemCapability.HiviewDFX.HiLog + **Parameters** -| Name| Type| Mandatory| Description| +| Name| Type | Mandatory| Description | | ------ | -------------- | ---- | ------------------------------------------------------------ | -| domain | number | Yes| Service domain. The value ranges from **0x0** to **0xFFFFF**.| -| tag | string | Yes| String constant used to identify the class or service behavior.| -| format | string | Yes| String constant format, including the parameter type and privacy identifier. A parameter without the privacy identifier is treated as a privacy parameter by default.| -| args | any[] | Yes| Variable-length parameter list corresponding to the parameter type in the format string. The number and type of parameters must map to the identifier in the format string.| +| domain | number | Yes | Service domain. The value ranges from **0x0** to **0xFFFFF**. | +| tag | string | Yes | String constant used to identify the class or service behavior. | +| format | string | Yes | String constant format, including the parameter type and privacy identifier. A parameter without the privacy identifier is treated as a privacy parameter by default.| +| args | any[] | Yes | Variable-length parameter list corresponding to the parameter type in the format string. The number and type of parameters must map to the identifier in the format string.| **Example** @@ -155,13 +162,15 @@ isLoggable(domain: number, tag: string, level: LogLevel) : boolean Checks whether printing is enabled for a domain, tag, or log level. +**System capability**: SystemCapability.HiviewDFX.HiLog + **Parameters** -| Name| Type| Mandatory| Description| +| Name| Type | Mandatory| Description | | ------ | --------------------- | ---- | ------------------------------------------ | -| domain | number | Yes| Service domain. The value ranges from **0x0** to **0xFFFFF**.| -| tag | string | Yes| String constant used to identify the class or service behavior.| -| level | [LogLevel](#loglevel) | Yes| Log level.| +| domain | number | Yes | Service domain. The value ranges from **0x0** to **0xFFFFF**. | +| tag | string | Yes | String constant used to identify the class or service behavior.| +| level | [LogLevel](#loglevel) | Yes | Log level. | **Example** @@ -173,10 +182,12 @@ hilog.isLoggable(0xFF00, "testTag", hilog.DEBUG); Enumerates event types. -| Name| Default Value| Description| +**System capability**: SystemCapability.HiviewDFX.HiLog + +| Name | Default Value| Description | | ----- | ------ | ----------- | | DEBUG | 3 | DEBUG level| -| INFO | 4 | INFO level| -| WARN | 5 | WARN level| +| INFO | 4 | INFO level | +| WARN | 5 | WARN level | | ERROR | 6 | ERROR level| | FATAL | 7 | FATAL level| diff --git a/en/application-dev/reference/apis/js-apis-hitracechain.md b/en/application-dev/reference/apis/js-apis-hitracechain.md index b5af74e563..9cd2fd38fb 100644 --- a/en/application-dev/reference/apis/js-apis-hitracechain.md +++ b/en/application-dev/reference/apis/js-apis-hitracechain.md @@ -82,7 +82,7 @@ Starts call chain tracing. This API works in synchronous manner. | name | string | Yes| Traced service name.| | flags | number | Yes| Trace flag combination. For details, see [HiTraceFlag](#hitraceflag).| -**Return value** +**Return Value** | Type| Description| | -------- | -------- | @@ -124,7 +124,7 @@ Obtains the trace ID. This API works in synchronous manner. **System capability**: SystemCapability.HiviewDFX.HiTrace -**Return value** +**Return Value** | Type| Description| | -------- | -------- | @@ -184,7 +184,7 @@ Creates a trace span. This API works in synchronous manner. **System capability**: SystemCapability.HiviewDFX.HiTrace -**Return value** +**Return Value** | Type| Description| | -------- | -------- | @@ -237,7 +237,7 @@ Checks whether a **HiTraceId** instance is valid. This API works in synchronous | -------- | -------- | -------- | -------- | | id | [HiTraceId](#hitraceid) | Yes| **HiTraceId** instance.| -**Return value** +**Return Value** | Type| Description| | -------- | -------- | @@ -265,7 +265,7 @@ Checks whether the specified trace flag in the **HiTraceId** instance is enabled | id | [HiTraceId](#hitraceid) | Yes| **HiTraceId** instance.| | flag | [HiTraceFlag](#hitraceflag) | Yes| Specified trace flag.| -**Return value** +**Return Value** | Type| Description| | -------- | -------- | diff --git a/en/application-dev/reference/apis/js-apis-hitracemeter.md b/en/application-dev/reference/apis/js-apis-hitracemeter.md index 17f62fb18b..ad7e023755 100644 --- a/en/application-dev/reference/apis/js-apis-hitracemeter.md +++ b/en/application-dev/reference/apis/js-apis-hitracemeter.md @@ -11,21 +11,18 @@ import hiTraceMeter from '@ohos.hiTraceMeter'; ``` -## System Capabilities - -SystemCapability.HiviewDFX.HiTrace - - ## hiTraceMeter.startTrace startTrace(name: string, taskId: number): void -Starts a trace task. +Starts a trace task. **expectedTime** is an optional parameter, which specifies the expected duration of the trace. If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different task IDs must be specified in **startTrace**. If the trace tasks with the same name are not performed at the same time, the same taskId can be used. For a specific example, refer to an example in [hiTraceMeter.finishTrace](#hitracemeterfinishtrace). +**System capability**: SystemCapability.HiviewDFX.HiTrace + **Parameters** | Name| Type| Mandatory| Description| @@ -37,6 +34,7 @@ If the trace tasks with the same name are not performed at the same time, the sa ``` hiTraceMeter.startTrace("myTestFunc", 1); +hiTraceMeter.startTrace("myTestFunc", 1, 5); // The expected duration of the trace task is 5 ms. ``` @@ -48,6 +46,8 @@ Stops a trace task. To stop a trace task, the values of name and task ID in **finishTrace** must be the same as those in [startTrace](#hitracemeterstarttrace). +**System capability**: SystemCapability.HiviewDFX.HiTrace + **Parameters** | Name| Type| Mandatory| Description| @@ -90,6 +90,8 @@ traceByValue(name: string, count: number): void Traces the value changes of a variable. +**System capability**: SystemCapability.HiviewDFX.HiTrace + **Parameters** | Name| Type| Mandatory| Description| -- GitLab