- Disabling the privacy flag: hdc_std shell hilog -p off
- Increasing the log buffer to 200 MB: hdc_std shell hilog -G 200M
- Enabling the log function of the specific domain (that is, disabling the global log function): hdc_std shell hilog –b D –D 0xd0xxxxx
After performing the preceding operations, restart the DevEco Studio.
## What should I do if the HAP installed on the development board through the IDE cannot be opened?
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
Check whether the SDK version is consistent with the system version on the development board. You are advised to use the SDK version and system version that are released on the same day.
## How do I upload files using the hdc command?
Applicable to: OpenHarmony SDK 3.2.2.5
Run the **hdc_std file send** command.
## How do I prevent the screen of the RK3568 development board from turning off?
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
Run the **hdc_std shell "power-shell setmode 602"** command.
## How do I start an ability using the hdc command?
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
Run the **hdc\_std shell aa start -a AbilityName -b bundleName -m moduleName** command.
## How do I change the read and write permissions on a file directory on the development board?
Applicable to: OpenHarmony SDK 3.2.5.6, stage model of API version 9
Run the **hdc\_std shell mount -o remount,rw /** command.
## What should I do if the error message "Unknown file option -r" is displayed when hdc_std file recv is run?
Applicable to: OpenHarmony SDK 3.2.5.6, stage model of API version 9
1. Use the the hdc tool in the device image or SDK of the same version.
2. Remove any Chinese characters or spaces from the directory specified for the hdc tool.
## How do I uninstall an application using the hdc command?
Applicable to: OpenHarmony SDK 3.2.2.5
Run the **hdc\_std uninstall [-k] [package_name]** command.
## How do I check whether the system is 32-bit or 64-bit?
Applicable to: OpenHarmony SDK 3.2.5.5
Run the **hdc\_std shell getconf LONG_BIT** command.
If **64** is returned, the system is a 64-bit one. Otherwise, the system is a 32-bit one.
## How do I view the component tree structure?
Applicable to: OpenHarmony SDK 3.2.5.5
1. Run the **hdc\_std shell** command to launch the CLI.
2. Run the **aa dump -a** command to find **abilityID**.
3. Run the **aa dump -i [abilityID] -c -render** command to view the component tree.
Initiates a call. This API uses an asynchronous callback to return the result.
>**NOTE**
>
> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9). The substitute API is available only for system applications.
Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result.
>**NOTE**
>
> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9). The substitute API is available only for system applications.
Initiates a call. You can set call options as needed. This API uses a promise to return the result.
>**NOTE**
>
> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9). The substitute API is available only for system applications.
The **hichecker** module is provided for you to check issues that may be easily ignored during development of OpenHarmony applications (including system-built and third-party applications). Such issues include calling of time-consuming functions by key application threads, event distribution and execution timeout in application processes, and ability resource leakage in application processes. The issues are recorded in logs or lead to process crashes explicitly so that you can find and rectify them.
The HiChecker module allows you to check issues that may be easily ignored during development of applications (including system-built and third-party applications). Such issues include calling of time-consuming functions by key application threads, event distribution and execution timeout in application processes, and ability resource leakage in application processes. The issues are recorded in logs or lead to process crashes explicitly so that you can find and rectify them.
> **NOTE**<br>
> **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 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
@@ -13,7 +14,7 @@ import hichecker from '@ohos.hichecker';
...
@@ -13,7 +14,7 @@ import hichecker from '@ohos.hichecker';
```
```
## Constant
## Constants
Provides the constants of all rule types.
Provides the constants of all rule types.
...
@@ -26,10 +27,8 @@ Provides the constants of all rule types.
...
@@ -26,10 +27,8 @@ Provides the constants of all rule types.
| RULE_THREAD_CHECK_SLOW_PROCESS | bigint | Caution rule, which is programmed to detect whether any time-consuming function is invoked. |
| RULE_THREAD_CHECK_SLOW_PROCESS | bigint | Caution rule, which is programmed to detect whether any time-consuming function is invoked. |
| RULE_CHECK_ABILITY_CONNECTION_LEAK | bigint | Caution rule, which is programmed to detect whether ability leakage has occurred. |
| RULE_CHECK_ABILITY_CONNECTION_LEAK | bigint | Caution rule, which is programmed to detect whether ability leakage has occurred. |
## hichecker.addCheckRule<sup>9+</sup>
## hichecker.addCheckRule<sup>9+</sup>
## hichecker.addRule
addCheckRule(rule: bigint): void
addCheckRule(rule: bigint): void
Adds one or more rules. HiChecker detects unexpected operations or gives feedback based on the added rules.
Adds one or more rules. HiChecker detects unexpected operations or gives feedback based on the added rules.
...
@@ -121,12 +120,12 @@ try {
...
@@ -121,12 +120,12 @@ try {
## hichecker.addRule<sup>(deprecated)</sup>
## hichecker.addRule<sup>(deprecated)</sup>
## hichecker.addRule
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [hichecker.addCheckRule](#hicheckeraddcheckrule9) instead.
addRule(rule: bigint): void
addRule(rule: bigint): void
> **NOTE**
>
> This API is deprecated since API version 9. You are advised to use [hichecker.addCheckRule](#hicheckeraddcheckrule9).
Adds one or more rules. HiChecker detects unexpected operations or gives feedback based on the added rules.
Adds one or more rules. HiChecker detects unexpected operations or gives feedback based on the added rules.
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [hichecker.containsCheckRule](#hicheckercontainscheckrule9) instead.
> **NOTE**
>
> This API is deprecated since API version 9. You are advised to use [hichecker.containsCheckRule](#hicheckercontainscheckrule9).
Checks whether the specified rule exists in the collection of added rules. If the rule is of the thread level, this operation is performed only on the current thread.
Checks whether the specified rule exists in the collection of added rules. If the rule is of the thread level, this operation is performed only on the current thread.
@@ -363,7 +363,7 @@ Unregisters the observer for HTTP Response Header events.
...
@@ -363,7 +363,7 @@ Unregisters the observer for HTTP Response Header events.
>**NOTE**
>**NOTE**
>
>
>1. This API has been deprecated. You are advised to use [off('headersReceive')<sup>8+</sup>](#offheadersreceive8) instead.
>1. This API has been deprecated. You are advised to use [off('headersReceive')<sup>8+</sup>](#offheadersreceive8).
>
>
>2. You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
>2. You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
@@ -154,6 +157,7 @@ Obtains the network status. This API uses an asynchronous callback to return the
...
@@ -154,6 +157,7 @@ Obtains the network status. This API uses an asynchronous callback to return the
| callback | AsyncCallback\<[NetworkState](#networkstate)\> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<[NetworkState](#networkstate)\> | Yes | Callback used to return the result. |
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -198,6 +202,7 @@ Obtains the network status. This API uses a promise to return the result.
...
@@ -198,6 +202,7 @@ Obtains the network status. This API uses a promise to return the result.
| Promise\<[NetworkState](#networkstate)\> | Promise used to return the result.|
| Promise\<[NetworkState](#networkstate)\> | Promise used to return the result.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -238,6 +243,7 @@ Obtains the network selection mode of the SIM card in the specified slot. This A
...
@@ -238,6 +243,7 @@ Obtains the network selection mode of the SIM card in the specified slot. This A
| callback | AsyncCallback\<[NetworkSelectionMode](#networkselectionmode)\> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<[NetworkSelectionMode](#networkselectionmode)\> | Yes | Callback used to return the result. |
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -279,6 +285,7 @@ Obtains the network selection mode of the SIM card in the specified slot. This A
...
@@ -279,6 +285,7 @@ Obtains the network selection mode of the SIM card in the specified slot. This A
| Promise\<[NetworkSelectionMode](#networkselectionmode)\> | Promise used to return the result.|
| Promise\<[NetworkSelectionMode](#networkselectionmode)\> | Promise used to return the result.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -318,6 +325,7 @@ Obtains the ISO country code of the network with which the SIM card in the speci
...
@@ -318,6 +325,7 @@ Obtains the ISO country code of the network with which the SIM card in the speci
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result, which is an ISO country code, for example, **CN** (China).|
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result, which is an ISO country code, for example, **CN** (China).|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -359,6 +367,7 @@ Obtains the ISO country code of the network with which the SIM card in the speci
...
@@ -359,6 +367,7 @@ Obtains the ISO country code of the network with which the SIM card in the speci
| Promise\<string\> | Promise used to return the result, which is an ISO country code, for example, **CN** (China).|
| Promise\<string\> | Promise used to return the result, which is an ISO country code, for example, **CN** (China).|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -397,6 +406,7 @@ Obtains the ID of the slot in which the primary card is located. This API uses a
...
@@ -397,6 +406,7 @@ Obtains the ID of the slot in which the primary card is located. This API uses a
| callback | AsyncCallback\<number\> | Yes | Callback invoked to return the result.|
| callback | AsyncCallback\<number\> | Yes | Callback invoked to return the result.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -430,6 +440,7 @@ Obtains the ID of the slot in which the primary card is located. This API uses a
...
@@ -430,6 +440,7 @@ Obtains the ID of the slot in which the primary card is located. This API uses a
| Promise\<number\> | Promise used to return the result.|
| Promise\<number\> | Promise used to return the result.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -467,6 +478,7 @@ Obtains a list of signal strengths of the network with which the SIM card in the
...
@@ -467,6 +478,7 @@ Obtains a list of signal strengths of the network with which the SIM card in the
| callback | AsyncCallback\<Array\<[SignalInformation](#signalinformation)\>\> | Yes | Callback used to return the result, which is a list of [SignalInformation](#signalinformation) objects.|
| callback | AsyncCallback\<Array\<[SignalInformation](#signalinformation)\>\> | Yes | Callback used to return the result, which is a list of [SignalInformation](#signalinformation) objects.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -508,6 +520,7 @@ Obtains a list of signal strengths of the network with which the SIM card in the
...
@@ -508,6 +520,7 @@ Obtains a list of signal strengths of the network with which the SIM card in the
| Promise\<Array\<[SignalInformation](#signalinformation)\>\> | Promise used to return the result, which is a list of [SignalInformation](#signalinformation) objects.|
| Promise\<Array\<[SignalInformation](#signalinformation)\>\> | Promise used to return the result, which is a list of [SignalInformation](#signalinformation) objects.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -656,6 +669,7 @@ Checks whether the radio service is enabled on the primary SIM card. This API us
...
@@ -656,6 +669,7 @@ Checks whether the radio service is enabled on the primary SIM card. This API us
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.|
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -694,6 +708,7 @@ Checks whether the radio service is enabled on the SIM card in the specified slo
...
@@ -694,6 +708,7 @@ Checks whether the radio service is enabled on the SIM card in the specified slo
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.|
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -738,6 +753,7 @@ Checks whether the radio service is enabled on the SIM card in the specified slo
...
@@ -738,6 +753,7 @@ Checks whether the radio service is enabled on the SIM card in the specified slo
| Promise\<boolean\> | Promise used to return the result.<br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.|
| Promise\<boolean\> | Promise used to return the result.<br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -778,6 +794,7 @@ Obtains the carrier name for the SIM card in the specified slot. This API uses a
...
@@ -778,6 +794,7 @@ Obtains the carrier name for the SIM card in the specified slot. This API uses a
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result, which is the carrier name, for example, China Mobile.|
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result, which is the carrier name, for example, China Mobile.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -819,6 +836,7 @@ Obtains the carrier name for the SIM card in the specified slot. This API uses a
...
@@ -819,6 +836,7 @@ Obtains the carrier name for the SIM card in the specified slot. This API uses a
| Promise\<string\> | Promise used t return the result, which is the carrier name, for example, China Mobile. |
| Promise\<string\> | Promise used t return the result, which is the carrier name, for example, China Mobile. |
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -861,6 +879,7 @@ Sets the ID of the slot in which the primary card is located. This API uses an a
...
@@ -861,6 +879,7 @@ Sets the ID of the slot in which the primary card is located. This API uses an a
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -877,8 +896,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -877,8 +896,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
@@ -133,6 +133,7 @@ Checks whether the application (caller) has been granted the operator permission
...
@@ -133,6 +133,7 @@ Checks whether the application (caller) has been granted the operator permission
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result. |
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -141,7 +142,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -141,7 +142,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| 8300001 | Invalid parameter value. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
| 8300999 | Unknown error code. |
**Example**
**Example**
...
@@ -173,6 +173,7 @@ Checks whether the application (caller) has been granted the operator permission
...
@@ -173,6 +173,7 @@ Checks whether the application (caller) has been granted the operator permission
| Promise\<boolean\> | Promise used to return the result. The value **true** indicates that the application (caller) has been granted the carrier permission, and the value **false** indicates the opposite.|
| Promise\<boolean\> | Promise used to return the result. The value **true** indicates that the application (caller) has been granted the carrier permission, and the value **false** indicates the opposite.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -181,7 +182,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -181,7 +182,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| 8300001 | Invalid parameter value. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
| 8300999 | Unknown error code. |
**Example**
**Example**
...
@@ -211,6 +211,7 @@ Obtains the ISO country code of the SIM card in the specified slot. This API use
...
@@ -211,6 +211,7 @@ Obtains the ISO country code of the SIM card in the specified slot. This API use
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result, which is an ISO country code, for example, **CN** (China).|
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result, which is an ISO country code, for example, **CN** (China).|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -252,6 +253,7 @@ Obtains the ISO country code of the SIM card in the specified slot. This API use
...
@@ -252,6 +253,7 @@ Obtains the ISO country code of the SIM card in the specified slot. This API use
| Promise\<string\> | Promise used to return the result, which is an ISO country code, for example, **CN** (China).|
| Promise\<string\> | Promise used to return the result, which is an ISO country code, for example, **CN** (China).|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -291,6 +293,7 @@ Obtains the public land mobile network \(PLMN\) ID of the SIM card in the specif
...
@@ -291,6 +293,7 @@ Obtains the public land mobile network \(PLMN\) ID of the SIM card in the specif
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. |
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -332,6 +335,7 @@ Obtains the PLMN ID of the SIM card in the specified slot. This API uses a promi
...
@@ -332,6 +335,7 @@ Obtains the PLMN ID of the SIM card in the specified slot. This API uses a promi
| Promise\<string\> | Promise used to return the result.|
| Promise\<string\> | Promise used to return the result.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -371,6 +375,7 @@ Obtains the service provider name (SPN) of the SIM card in the specified slot. T
...
@@ -371,6 +375,7 @@ Obtains the service provider name (SPN) of the SIM card in the specified slot. T
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. |
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -412,6 +417,7 @@ Obtains the SPN of the SIM card in the specified slot. This API uses a promise t
...
@@ -412,6 +417,7 @@ Obtains the SPN of the SIM card in the specified slot. This API uses a promise t
| Promise\<string\> | Promise used to return the result.|
| Promise\<string\> | Promise used to return the result.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -451,6 +457,7 @@ Obtains the state of the SIM card in the specified slot. This API uses an asynch
...
@@ -451,6 +457,7 @@ Obtains the state of the SIM card in the specified slot. This API uses an asynch
| callback | AsyncCallback\<[SimState](#simstate)\> | Yes | Callback used to return the result. For details, see [SimState](#simstate). |
| callback | AsyncCallback\<[SimState](#simstate)\> | Yes | Callback used to return the result. For details, see [SimState](#simstate). |
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -459,7 +466,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -459,7 +466,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| 8300001 | Invalid parameter value. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
| 8300999 | Unknown error code. |
**Example**
**Example**
...
@@ -492,6 +498,7 @@ Obtains the state of the SIM card in the specified slot. This API uses a promise
...
@@ -492,6 +498,7 @@ Obtains the state of the SIM card in the specified slot. This API uses a promise
| Promise\<[SimState](#simstate)\> | Promise used to return the result.|
| Promise\<[SimState](#simstate)\> | Promise used to return the result.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -500,7 +507,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -500,7 +507,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| 8300001 | Invalid parameter value. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
| 8300999 | Unknown error code. |
**Example**
**Example**
...
@@ -530,6 +536,7 @@ Obtains the type of the SIM card in the specified slot. This API uses an asynchr
...
@@ -530,6 +536,7 @@ Obtains the type of the SIM card in the specified slot. This API uses an asynchr
| callback | AsyncCallback\<[CardType](#cardtype7)\> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<[CardType](#cardtype7)\> | Yes | Callback used to return the result. |
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -571,6 +578,7 @@ Obtains the type of the SIM card in the specified slot. This API uses a promise
...
@@ -571,6 +578,7 @@ Obtains the type of the SIM card in the specified slot. This API uses a promise
| Promise\<[CardType](#cardtype7)\> | Promise used to return the result.|
| Promise\<[CardType](#cardtype7)\> | Promise used to return the result.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -579,7 +587,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -579,7 +587,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| 8300001 | Invalid parameter value. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
| 8300999 | Unknown error code. |
**Example**
**Example**
...
@@ -610,6 +617,7 @@ Checks whether the SIM card in the specified slot is installed. This API uses an
...
@@ -610,6 +617,7 @@ Checks whether the SIM card in the specified slot is installed. This API uses an
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. |
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. |
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -618,7 +626,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -618,7 +626,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| 8300001 | Invalid parameter value. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
| 8300999 | Unknown error code. |
**Example**
**Example**
...
@@ -651,6 +658,7 @@ Checks whether the SIM card in the specified slot is installed. This API uses a
...
@@ -651,6 +658,7 @@ Checks whether the SIM card in the specified slot is installed. This API uses a
| Promise<boolean> | Promise used to return the result. The value **true** indicates that the SIM card in the specified slot is installed, and the value **false** indicates the opposite.|
| Promise<boolean> | Promise used to return the result. The value **true** indicates that the SIM card in the specified slot is installed, and the value **false** indicates the opposite.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -693,6 +701,7 @@ Obtains SIM card account information. This API uses an asynchronous callback to
...
@@ -693,6 +701,7 @@ Obtains SIM card account information. This API uses an asynchronous callback to
| callback | AsyncCallback\<[IccAccountInfo](#iccaccountinfo7)\> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<[IccAccountInfo](#iccaccountinfo7)\> | Yes | Callback used to return the result. |
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -740,6 +749,7 @@ Obtains SIM card account information. This API uses a promise to return the resu
...
@@ -740,6 +749,7 @@ Obtains SIM card account information. This API uses a promise to return the resu
| Promise<[IccAccountInfo](#iccaccountinfo7)\> | Promise used to return the result.|
| Promise<[IccAccountInfo](#iccaccountinfo7)\> | Promise used to return the result.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -783,6 +793,7 @@ Obtains the account information list of the active SIM card. This API uses an as
...
@@ -783,6 +793,7 @@ Obtains the account information list of the active SIM card. This API uses an as
| callback | AsyncCallback\<Array<[IccAccountInfo](#iccaccountinfo7)\>\> | Yes | Callback used to return the result.|
| callback | AsyncCallback\<Array<[IccAccountInfo](#iccaccountinfo7)\>\> | Yes | Callback used to return the result.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -823,6 +834,7 @@ Obtains the account information list of the active SIM card. This API uses a pro
...
@@ -823,6 +834,7 @@ Obtains the account information list of the active SIM card. This API uses a pro
| Promise<Array<[IccAccountInfo](#iccaccountinfo7)\>\> | Promise used to return the result.|
| Promise<Array<[IccAccountInfo](#iccaccountinfo7)\>\> | Promise used to return the result.|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -866,6 +878,7 @@ Sets the default slot ID of the SIM card that provides voice services. This API
...
@@ -866,6 +878,7 @@ Sets the default slot ID of the SIM card that provides voice services. This API
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| ID| Error Message |
...
@@ -882,8 +895,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -882,8 +895,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
The **socket** module implements data transfer over TCPSocket, UDPSocket, WebSocket, and TLSSocket connections.
> **NOTE**
> **NOTE**
>
>
> 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.
> 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.
HiCollie provides the software watchdog function. It provides a unified framework for fault detection and fault log generation to help you locate software timeout faults resulting from system service deadlock, application main thread blocking, and service process timeout.
HiCollie provides the software watchdog function. It provides a unified framework for fault detection and fault log generation to help you locate software timeout faults resulting from system service deadlock, application main thread blocking, and service process timeout.
## Available APIs<a name="section139261151145116"></a>
| void RegisterXCollieChecker(const sptr<XCollieChecker>&checker, unsigned int type) | Registers the callback of the thread suspension detection result.<br>Input arguments:<br>- **checker**: pointer to the XCollieChecker instance.<br>- **type**: suspension detection type. Set it to **XCOLLIE_THREAD**.<br>Output arguments: none<br>Return value: none|
</td>
| int SetTimer(const std::string &name, unsigned int timeout, std::function<void(void*)> func, void *arg, unsigned int flag) | Adds timers.<br>Input arguments:<br>- **name**: timer name.<br>- **timeout**: timeout duration, in seconds.<br>- **func**: timeout callback.<br>- **arg**: pointer to the timeout callback.<br>- **flag**: timer operation type.<br> - **XCOLLIE_FLAG_DEFAULT**: default flag, which is the combination of the other three options.<br> - **XCOLLIE_FLAG_NOOP**: Calls only the timeout callback.<br> - **XCOLLIE_FLAG_LOG**: Generates a timeout fault log.<br> - **XCOLLIE_FLAG_RECOVERY**: Exits the process.<br>Output arguments: none<br>Return value: timer ID if the operation is successful; **-1** otherwise.|
<tdclass="cellrowborder"valign="top"width="44.47555244475552%"headers="mcps1.2.4.1.3 "><pid="p18700175062115"><aname="p18700175062115"></a><aname="p18700175062115"></a>Provides the callback of the suspension detection result.</p>
| bool UpdateTimer(int id, unsigned int timeout) | Updates timers.<br>Input arguments:<br>- **id**: timer ID.<br>- **timeout**: timeout duration, in seconds.<br>Output arguments: none<br>Return value: **true** if the operation is successful; **false** otherwise.|
<tdclass="cellrowborder"valign="top"width="44.47555244475552%"headers="mcps1.2.4.1.3 "><pid="p127630177475"><aname="p127630177475"></a><aname="p127630177475"></a>Provides the callback of the thread suspension detection result.</p>
<tdclass="cellrowborder"valign="top"width="35.82641735826417%"headers="mcps1.2.4.1.2 "><pid="p16289114074812"><aname="p16289114074812"></a><aname="p16289114074812"></a>void RegisterXCollieChecker(const sptr<XCollieChecker>&checker, unsigned int type)</p>
</td>
<tdclass="cellrowborder"valign="top"width="44.47555244475552%"headers="mcps1.2.4.1.3 "><pid="p186437319482"><aname="p186437319482"></a><aname="p186437319482"></a>Registers the callback of the thread suspension detection result.</p>
<aname="ul7783192181413"></a><aname="ul7783192181413"></a><ulid="ul7783192181413"><li><strongid="b64637561712"><aname="b64637561712"></a><aname="b64637561712"></a>checker</strong>: Indicates the pointer to the XCollieChecker instance.</li><li><strongid="b1947711661711"><aname="b1947711661711"></a><aname="b1947711661711"></a>type</strong>: Indicates the suspension detection type. Set it to <strongid="b259214119717"><aname="b259214119717"></a><aname="b259214119717"></a>XCOLLIE_THREAD</strong>.</li></ul>
<aname="ul845512153147"></a><aname="ul845512153147"></a><ulid="ul845512153147"><li><strongid="b44651010141715"><aname="b44651010141715"></a><aname="b44651010141715"></a>name</strong>: Indicates the timer name.</li><li><strongid="b266981221717"><aname="b266981221717"></a><aname="b266981221717"></a>timeout</strong>: Indicates the timeout duration, in seconds.</li><li><strongid="b17158171421710"><aname="b17158171421710"></a><aname="b17158171421710"></a>func</strong>: Indicates the timeout callback.</li><li><strongid="b1950162581810"><aname="b1950162581810"></a><aname="b1950162581810"></a>arg</strong>: Indicates the pointer to the timeout callback.</li><li><strongid="b4949151521714"><aname="b4949151521714"></a><aname="b4949151521714"></a>flag</strong>: Indicates the timer operation type.<pid="p1242762435310"><aname="p1242762435310"></a><aname="p1242762435310"></a>XCOLLIE_FLAG_DEFAULT // Indicates the default flag, which is the combination of the other three options.</p>
<pid="p1542712435312"><aname="p1542712435312"></a><aname="p1542712435312"></a>XCOLLIE_FLAG_NOOP // Calls only the timeout callback.</p>
<pid="p15427112416531"><aname="p15427112416531"></a><aname="p15427112416531"></a>XCOLLIE_FLAG_LOG // Generates a timeout fault log.</p>
<pid="p242762455314"><aname="p242762455314"></a><aname="p242762455314"></a>XCOLLIE_FLAG_RECOVERY // Exits the process.</p>
<pid="p144271424155316"><aname="p144271424155316"></a><aname="p144271424155316"></a>Return value: Returns the timer ID if the operation is successful; returns <strongid="b2229713291"><aname="b2229713291"></a><aname="b2229713291"></a>-1</strong> otherwise.</p>
<aname="ul1628783221411"></a><aname="ul1628783221411"></a><ulid="ul1628783221411"><li><strongid="b61651021161710"><aname="b61651021161710"></a><aname="b61651021161710"></a>id</strong>: Indicates the timer ID.</li><li><strongid="b24661423141717"><aname="b24661423141717"></a><aname="b24661423141717"></a>timeout</strong>: Indicates the timeout duration, in seconds.</li></ul>
<pid="p38311853105716"><aname="p38311853105716"></a><aname="p38311853105716"></a>Return value: Returns <strongid="b95701352192819"><aname="b95701352192819"></a><aname="b95701352192819"></a>true</strong> if the operation is successful; returns <strongid="b175761652152814"><aname="b175761652152814"></a><aname="b175761652152814"></a>false</strong> otherwise.</p>
<pid="p9311488283"><aname="p9311488283"></a><aname="p9311488283"></a><strongid="b9666749171816"><aname="b9666749171816"></a><aname="b9666749171816"></a>id</strong>: Indicates the timer ID.</p>
This function requires you to implement two callback functions: **CheckBlock** and **CheckThreadBlock** of the **XCollieChecker** class. After the callbacks are implemented, you need to use the **RegisterXCollieChecker** function of the **XCollie** class to register their instances. The suspension monitoring thread periodically executes all successfully registered callbacks, checks the thread logic completion flag, and determines whether the service logic of any registered thread is suspended.
This function requires you to implement two callback functions: **CheckBlock** and **CheckThreadBlock** of the **XCollieChecker** class. After the callbacks are implemented, you need to use the **RegisterXCollieChecker** function of the **XCollie** class to register their instances. The suspension monitoring thread periodically executes all successfully registered callbacks, checks the thread logic completion flag, and determines whether the service logic of any registered thread is suspended.
1. Develop the source code.
1. Develop the source code.
Include the **xcollie** header file in the source file.
Include the **xcollie** header file in the source file.
```
```
...
@@ -124,6 +42,7 @@ This function requires you to implement two callback functions: **CheckBlock**
...
@@ -124,6 +42,7 @@ This function requires you to implement two callback functions: **CheckBlock**
Add the following code to the service code:
Add the following code to the service code:
```
```
void MyXCollieChecker::CheckLock()
void MyXCollieChecker::CheckLock()
{
{
...
@@ -138,7 +57,7 @@ This function requires you to implement two callback functions: **CheckBlock**
...
@@ -138,7 +57,7 @@ This function requires you to implement two callback functions: **CheckBlock**
sptr<XCollieChecker> checker = new MyXCollieChecker("MyXCollieChecker");
sptr<XCollieChecker> checker = new MyXCollieChecker("MyXCollieChecker");
You can add a maximum of 128 timers for a single process by using the **SetTimer** function. Adding timers will fail if the number of timers has reached the upper limit.
You can add a maximum of 128 timers for a single process by using the **SetTimer** function. Adding timers will fail if the number of timers has reached the upper limit.
1. Develop the source code.
1. Develop the source code.
Include the **xcollie** header file in the source file.
Include the **xcollie** header file in the source file.
```
```
...
@@ -173,7 +91,7 @@ You can add a maximum of 128 timers for a single process by using the **SetTime
...
@@ -173,7 +91,7 @@ You can add a maximum of 128 timers for a single process by using the **SetTime
XCollie::GetInstance().UpdateTimer(id, 5);
XCollie::GetInstance().UpdateTimer(id, 5);
/* time consuming job */
/* time consuming job */
XCollie::GetInstance().CancelTimer(id);
XCollie::GetInstance().CancelTimer(id);
...
......
```
```
2. Configure compilation information. Specifically, add the subsystem SDK dependency to **BUILD.gn**.
2. Configure compilation information. Specifically, add the subsystem SDK dependency to **BUILD.gn**.
...
@@ -181,5 +99,3 @@ You can add a maximum of 128 timers for a single process by using the **SetTime
...
@@ -181,5 +99,3 @@ You can add a maximum of 128 timers for a single process by using the **SetTime
HiDumper is a tool provided by OpenHarmony for developers, testers, and IDE tool engineers to obtain system information necessary for analyzing and locating faults. This section applies only to the standard system.
HiDumper is a tool provided by OpenHarmony for developers, testers, and IDE tool engineers to obtain system information necessary for analyzing and locating faults. This section applies only to the standard system.
### Source Code Directories
## Source Code Directories
```
```
...
@@ -34,14 +31,14 @@ HiDumper is a tool provided by OpenHarmony for developers, testers, and IDE tool
...
@@ -34,14 +31,14 @@ HiDumper is a tool provided by OpenHarmony for developers, testers, and IDE tool
```
```
## Usage
# Usage
### Command-Line Options
## Command-Line Options
**Table 1** HiDumper command-line options
**Table 1** HiDumper command-line options
| Option| Description|
| Option| **Description**|
| -------- | -------- |
| -------- | -------- |
| -h | Shows the help Information.|
| -h | Shows the help Information.|
| -t [timeout] | Specifies the timeout period, in seconds. The default value is **30**. Value **0** indicates no timeout limit.|
| -t [timeout] | Specifies the timeout period, in seconds. The default value is **30**. Value **0** indicates no timeout limit.|
...
@@ -56,14 +53,14 @@ HiDumper is a tool provided by OpenHarmony for developers, testers, and IDE tool
...
@@ -56,14 +53,14 @@ HiDumper is a tool provided by OpenHarmony for developers, testers, and IDE tool
| --net | Exports network information.|
| --net | Exports network information.|
| --storage | Exports storage information.|
| --storage | Exports storage information.|
| -p | Exports the process list and all process information.|
| -p | Exports the process list and all process information.|
| -p [pid] | Exports all information about a specified process.|
| -p [pid] | Exports all information about the specified process.|
| --cpuusage [pid] | Exports the CPU usage information based on **pid**.|
| --cpuusage [pid] | Exports the CPU usage information. If **pid** is specified, the CPU usage of the corresponding process is exported.|
| --cpufreq | Exports the actual CPU frequency.|
| --cpufreq | Exports the actual CPU frequency.|
| --mem [pid] | Exports the memory usage information based on **pid**.|
| --mem [pid] | Export memory usage information. If **pid** is specified, the memory usage of the corresponding process is exported.|
| --zip | Compresses the exported information to a specified folder.|
| --zip | Compresses the exported information to a specified folder.|
### Development Example
## Development Example
HiDumper helps you export basic system information to locate and analyze faults. Complex parameters passed to sub-services and abilities must be enclosed in double quotation marks.
HiDumper helps you export basic system information to locate and analyze faults. Complex parameters passed to sub-services and abilities must be enclosed in double quotation marks.
...
@@ -118,7 +115,7 @@ The procedure is as follows:
...
@@ -118,7 +115,7 @@ The procedure is as follows:
hidumper -s 3008
hidumper -s 3008
```
```
9. Run the **hidumper -e** command to obtain the crash information generated by the FaultLogger module.
9. Run the **hidumper -e** command to obtain the crash information generated by the FaultLoger module.
```
```
hidumper -e
hidumper -e
...
@@ -148,7 +145,7 @@ The procedure is as follows:
...
@@ -148,7 +145,7 @@ The procedure is as follows:
hidumper -p 1024
hidumper -p 1024
```
```
14. Run the **hidumper --cpuusage [pid]** command to obtain the CPU usage information of the process whose PID has been specified.
14. Run the **hidumper --cpuusage [pid]** command to obtain the CPU usage information. If the PID of a process is specified, only the CPU usage of the process is returned.
```
```
hidumper --cpuusage
hidumper --cpuusage
...
@@ -161,7 +158,7 @@ The procedure is as follows:
...
@@ -161,7 +158,7 @@ The procedure is as follows:
hidumper --cpufreq
hidumper --cpufreq
```
```
16. Run the **hidumper --mem [pid]** command to obtain all memory usage information of the process whose PID has been specified.
16. Run the **hidumper --mem [pid]** command to obtain all memory usage information. If the PID of a process is specified, only the memory usage of the process is returned.
HiTraceChain tracks the call chain with the same **traceid** throughout the inter-device, inter-process, and inter-thread service processes. It associates and displays the call relationship and various output information during the entire process, helping you analyze and locate faults and optimize the system.
HiTraceChain tracks the call chain with the same **traceid** throughout the inter-device, inter-process, and inter-thread service processes. It associates and displays the call relationship and various output information during the entire process, helping you analyze and locate faults and optimize the system.
## Use Cases
## When to Use
HiTraceChain can be used for the following purposes:
HiTraceChain can be used for the following purposes:
- Associates and reports service process information \(such as logs and events\) on the device.
- Associates and reports service process information (such as logs and events) on the device.
- Displays and analyzes reported information on the cloud to facilitate fault location.
- Displays and analyzes reported information on the cloud to facilitate fault location.
- Works with the IDE to debug the detailed service process and time consumption distribution for system optimization.
- Works with the IDE to debug the detailed service process and time consumption distribution for system optimization.
1. Display the call relationship in the service process, analyze key paths and function dependency, and determine the time consumption and call frequency at each call point to detect performance bottlenecks.
1. Display the call relationship in the service process, analyze key paths and function dependency, and determine the time consumption and call frequency at each call point to detect performance bottlenecks.
2. Add **traceid** to logs and events automatically to facilitate comprehensive analysis and quick fault location.
2. Add **traceid** to logs and events automatically to facilitate comprehensive analysis and quick fault location.
## Available APIs
## Available APIs
HiTraceChain provides C++ and C APIs. The upper-layer services mainly use HiTraceChain to start and stop call chain tracing.
HiTraceChain provides C++ and C APIs. The upper-layer services mainly use HiTraceChain to start and stop call chain trace.
HiTraceChain is implemented at layer C. It works by transferring **traceid** throughout the service calling process. Before service processing, HiTrace sets **traceid** in the thread local storage (TLS) of the calling thread. During service processing, HiTrace obtains **traceid** from the contextual TLS of the calling thread and automatically adds it to the log and event information. After service processing is complete, HiTrace clears **traceid** from the TLS of the calling thread.
HiTraceChain is implemented at layer C. It works by transferring **traceid** throughout the service calling process. Before service processing, HiTraceChain sets **traceid** in the thread local storage \(TLS\) of the calling thread. During service processing, HiTraceChain obtains **traceid** from the contextual TLS of the calling thread and automatically adds it to the log and event information. After service processing is complete, HiTraceChain clears **traceid** from the TLS of the calling thread.
| HITRACE_FLAG_INCLUDE_ASYNC | 1 | Asynchronous call flag. By default, only synchronous calls are traced. If this flag is set, both synchronous and asynchronous calls will be traced. |
</th>
| HITRACE_FLAG_DONOT_CREATE_SPAN | 1 << 1 | No span flag. By default, spans are created within a trace of synchronous and asynchronous service calls. If this flag is set, no spans are created. |
| HITRACE_FLAG_TP_INFO | 1 << 2 | Trace point flag. By default, no trace point is added when trace is enabled. This flag is used for debugging. If this flag is set, trace points will be automatically added on the TX and RX sides of synchronous and asynchronous calls to output trace point and timestamp information. Trace points are classified into four types: client send (CS), server receive (SR), server send (SS), and client receive (CR). For a synchronous call, the output trace points are CS, SR, SS, and CR; for an asynchronous call, the output trace points are CS, SR, and SS. |
</th>
| HITRACE_FLAG_NO_BE_INFO | 1 << 3 | No begin/end flag. By default, information about the start and end of the trace task is printed. If this flag is set, information about the start and end of the trace task will not be printed.|
</tr>
| HITRACE_FLAG_DONOT_ENABLE_LOG | 1 << 4 | Log association flag. If this flag is set, information about the trace task will not be printed. |
</thead>
| HITRACE_FLAG_FAULT_TRIGGER | 1 << 5 | Failure trigger flag. This flag is reserved for future use. |
| HITRACE_FLAG_D2D_TP_INFO | 1 << 6 | Device-to-device trace point flag. It is a subset of **TP_INFO**. If this flag is set, trace points are added only for call chain trace between devices.|
<tdclass="cellrowborder"valign="top"width="31.430000000000003%"headers="mcps1.2.4.1.2 "><pid="p198391118193717"><aname="p198391118193717"></a><aname="p198391118193717"></a>HiTraceId Begin(const std::string& name, int flags)</p>
| HITRACE_TP_SR | 3 | SR trace point. |
</td>
| HITRACE_TP_GENERAL | 4 | General trace points except CS, CR, SS, and SR.|
<tdclass="cellrowborder"valign="top"width="58.77%"headers="mcps1.2.4.1.3 "><pid="p684013182375"><aname="p684013182375"></a><aname="p684013182375"></a>Starts HiTraceChain, generates a <strongid="b2063619462230"><aname="b2063619462230"></a><aname="b2063619462230"></a>HiTraceId</strong> object, and sets it in the TLS of the calling thread.</p>
<aname="ul1537854218177"></a><aname="ul1537854218177"></a><ulid="ul1537854218177"><li><strongid="b1566312131676"><aname="b1566312131676"></a><aname="b1566312131676"></a>name</strong>: Indicates the name of the service process.</li><li><strongid="b75512128711"><aname="b75512128711"></a><aname="b75512128711"></a>flags</strong>: Indicates tracing flags, which can be used in combination. <aname="ul18842248101915"></a><aname="ul18842248101915"></a><ulid="ul18842248101915"><li>HITRACE_FLAG_INCLUDE_ASYNC: Traces both synchronous and asynchronous calls. By default, only synchronous calls are traced.</li><li><strongid="b724616241477"><aname="b724616241477"></a><aname="b724616241477"></a>HITRACE_FLAG_DONOT_CREATE_SPAN</strong>: Do not create a span. By default, a span is created.</li><li><strongid="b136181926479"><aname="b136181926479"></a><aname="b136181926479"></a>HITRACE_FLAG_TP_INFO</strong>: Outputs the tracepoint information. By default, the information is not output.</li><li><strongid="b358818291777"><aname="b358818291777"></a><aname="b358818291777"></a>HITRACE_FLAG_NO_BE_INFO</strong>: Do not output the start and end information. By default, the information is output.</li><li><strongid="b38571331974"><aname="b38571331974"></a><aname="b38571331974"></a>HITRACE_FLAG_DONOT_ENABLE_LOG</strong>: Do not associate logs for output. By default, logs are associated for output.</li><li><strongid="b17320371870"><aname="b17320371870"></a><aname="b17320371870"></a>HITRACE_FLAG_FAULT_TRIGGER</strong>: Triggers tracing by fault. By default, tracing is triggered normally.</li><li><strongid="b876915381711"><aname="b876915381711"></a><aname="b876915381711"></a>HITRACE_FLAG_D2D_TP_INFO</strong>: Outputs the device-to-device tracepoint information. By default, the information is not output.</li><li><strongid="b66510421776"><aname="b66510421776"></a><aname="b66510421776"></a>HITRCE_FLAG_DEFAULT</strong>: Indicates the default flag.</li></ul>
</li><li>Output arguments: none</li><li>Return value: Returns a valid <strongid="b7411101522917"><aname="b7411101522917"></a><aname="b7411101522917"></a>HiTraceId</strong> object if call chain tracing is triggered successfully; returns an invalid object otherwise.</li></ul>
| **Name**| **Value**| **Description**|
<pid="p188401918203713"><aname="p188401918203713"></a><aname="p188401918203713"></a>Note: In nested tracing mode, an invalid object will be returned if tracing is started at the nested layer.</p>
| -------- | -------- | -------- |
</td>
| HITRACE_CM_DEFAULT | 0 | Default communication mode. |
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p3840181820372"><aname="p3840181820372"></a><aname="p3840181820372"></a>Stops HiTraceChain based on the <strongid="b1605239122415"><aname="b1605239122415"></a><aname="b1605239122415"></a>HiTraceId</strong> object returned by the <strongid="b7610183992419"><aname="b7610183992419"></a><aname="b7610183992419"></a>Begin</strong> API, and clears the <strongid="b1610173918241"><aname="b1610173918241"></a><aname="b1610173918241"></a>HiTraceId</strong> object in the TLS of the calling thread.</p>
<aname="ul2917140133015"></a><aname="ul2917140133015"></a><ulid="ul2917140133015"><li><strongid="b8201185118711"><aname="b8201185118711"></a><aname="b8201185118711"></a>id</strong>: Indicates the <strongid="b2071183114331"><aname="b2071183114331"></a><aname="b2071183114331"></a>HiTraceId</strong> object.</li></ul>
| HiTraceChain | HiTraceId Begin(const std::string& name, int flags) | Starts HiTraceChain, generates a **HiTraceId** object, and sets it in the TLS of the calling thread.<br>Input arguments:<br>- **name**: name of the service process.<br>- **flags**: trace flags, which can be used in combination. For details, see Table 2.<br>Output arguments: none<br>Return value: a valid **HiTraceId** object if call chain trace is triggered successfully; returns an invalid object otherwise.<br>Note: In nested trace mode, an invalid object will be returned if trace is started at the nested layer.|
</tr>
| | void End(const HiTraceId& id) | Stops HiTraceChain based on the **HiTraceId** object returned by the **Begin** API, and clears the **HiTraceId** object in the TLS of the calling thread.<br>Input arguments:<br>- **id**: **HiTraceId** object.<br>Output arguments: none<br>Return value: none|
| | HiTraceId GetId(); | Obtains the **HiTraceId** object from the TLS of the calling thread.<br>Input arguments: none<br>Output arguments: none<br>Return value: **HiTraceId** object in the contextual TLS of the calling thread.|
</td>
| | void SetId(const HiTraceId& id) | Purpose: Sets the **HiTraceId** object in the TLS of the calling thread.<br>Input arguments:<br>- **id**: **HiTraceId** object.<br>Output arguments: none<br>Return value: none|
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p98401818123720"><aname="p98401818123720"></a><aname="p98401818123720"></a>Obtains the <strongid="b98371719256"><aname="b98371719256"></a><aname="b98371719256"></a>HiTraceId</strong> object from the TLS of the calling thread.</p>
| | void ClearId() | Clears the **HiTraceId** object in the TLS of the calling thread.<br>Input arguments: none<br>Output arguments: none<br>Return value: none|
| | HiTraceId CreateSpan() | Obtains the span ID from the current **HiTraceId** object.<br>Input arguments: none<br>Output arguments: none<br>Return value: current span ID.|
| | void Tracepoint(HiTraceTracepointType type, const HiTraceId& id, const char* fmt, ...) | Outputs HiTraceChain trace point information based on the information type. The information includes the timestamp and **HiTraceId** object of the span.<br>Input arguments:<br>- **type**: trace point type. For details, see Table 3.<br>- **id**: ID of the current span.<br>- **fmt**: string describing the format variable parameter.<br>- **args**: variable parameter.<br>Output arguments: none<br>Return value: none|
<pid="p9840418133716"><aname="p9840418133716"></a><aname="p9840418133716"></a>Return value: Returns the <strongid="b73911122162613"><aname="b73911122162613"></a><aname="b73911122162613"></a>HiTraceId</strong> object in the contextual TLS of the calling thread.</p>
| | void Tracepoint(HiTraceCommunicationMode mode, HiTraceTracepointType type, const HiTraceId& id, const char* fmt, ...) | Outputs HiTraceChain trace point information based on the communication mode and information type. The information includes the timestamp and **HiTraceId** object of the span.<br>Input arguments:<br>- **mode**: communication mode. For details, see Table 4.<br>- **type**: trace point type. For details, see Table 3.<br>- **id**: ID of the current span.<br>- **fmt**: string describing the format variable parameter.<br>- **args**: variable parameter.<br>Output arguments: none<br>Return value: none|
</td>
| HiTraceId | HiTraceId(); | Represents the default constructor used to generate an invalid **HiTraceId** object. <br>Input arguments: none<br>Output arguments: none<br>Return value: none|
</tr>
| | HiTraceId(const uint8_t* pIdArray, int len) | Represents the constructor used to create a **HiTraceId** object based on the specified byte array. <br>Input arguments:<br>- **pIdArray**: pointer to a byte array.<br>- **len**: length of the byte array.<br>Output arguments: none<br>Return value: none|
| | bool IsValid() | Checks whether the **HiTraceId** object is valid.<br>Input arguments: none<br>Output arguments: none<br>Return value: **true** if the **HiTraceId** object is valid; **false** otherwise.|
</td>
| | bool IsFlagEnabled(HiTraceFlag flag) | Checks whether the trace flag of the **HiTraceId** object is enabled.<br>Input arguments:<br>- **flag**: trace flag. For details, see the description in the **Begin** function.<br>Output arguments: none<br>Return value: **true** if the trace flag is enabled; **false** otherwise.|
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p384061893715"><aname="p384061893715"></a><aname="p384061893715"></a>Purpose: Sets the <strongid="b7405852152614"><aname="b7405852152614"></a><aname="b7405852152614"></a>HiTraceId</strong> object in the TLS of the calling thread.</p>
| | void EnableFlag(HiTraceFlag flag) | Enables the trace flag of the **HiTraceId** object.<br>Input arguments:<br>- **flag**: trace flag. For details, see the description in the **Begin** function.<br>Output arguments: none<br>Return value: none|
| | int GetFlags() | Obtains the trace flag set in the **HiTraceId** object.<br>Input arguments: none<br>Output arguments: none<br>Return value: Returns the combination of trace flags. For details, see the description in the **Begin** function.|
<aname="ul1355016467304"></a><aname="ul1355016467304"></a><ulid="ul1355016467304"><li><strongid="b648307174"><aname="b648307174"></a><aname="b648307174"></a>id</strong>: Indicates the <strongid="b492669584"><aname="b492669584"></a><aname="b492669584"></a>HiTraceId</strong> object.</li></ul>
| | void SetFlags(int flags) | Sets a trace flag in the **HiTraceId** object.<br>Input arguments:<br>- **flags**: combination of trace flags. For details, see the description in the **Begin** function.<br>Output arguments: none<br>Return value: none|
| | void SetChainId(uint64_t chainId) | Sets the call chain ID in the **HiTraceId** object.<br>Input arguments:<br>- **chainId**: call chain ID.<br>Output arguments: none<br>Return value: none|
</td>
| | uint64_t GetSpanId() | Obtains the span ID from the current **HiTraceId** object.<br>Input arguments: none<br>Output arguments: none<br>Return value: current span ID.|
</tr>
| | void SetSpanId(uint64_t spanId) | Sets the span ID in the **HiTraceId** object.<br>Input arguments:<br>- **spanId**: span ID.<br>Output arguments: none<br>Return value: none|
| | uint64_t GetParentSpanId() | Obtains the parent span ID from the current **HiTraceId** object.<br>Input arguments: none<br>Output arguments: none<br>Return value: parent span ID.|
</td>
| | void SetParentSpanId(uint64_t parentSpanId) | Sets the parent span ID in the **HiTraceId** object.<br>Input arguments:<br>- **parentSpanId**: parent span ID.<br>Output arguments: none<br>Return value: none|
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p584019184379"><aname="p584019184379"></a><aname="p584019184379"></a>Clears the <strongid="b8445182151511"><aname="b8445182151511"></a><aname="b8445182151511"></a>HiTraceId</strong> object in the TLS of the current thread.</p>
| | int ToBytes(uint8_t* pIdArray, int len) | Converts the **HiTraceId** object into a byte array to facilitate caching or communication transfer.<br>Input arguments:<br>- **pIdArray**: pointer to a byte array. The minimum length of the byte array is **HITRACE_ID_LEN**.<br>- **len**: length of the byte array.<br>Output parameters:<br>- **pIdArray**: pointer to a byte array. If the object is valid, the object data after conversion is stored.<br>Return value: a value greater than **0** (indicating a valid array of object data) if the conversion is successful; **0** otherwise.|
Inter-device, inter-process, and inter-thread calls are implemented through the communication mechanism. HiTraceChain requires transfer of **traceid** in the communication mechanism.
Some built-in communication mechanisms (such as ZIDL) of OpenHarmony already support the transfer of **traceid**.
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p984031812378"><aname="p984031812378"></a><aname="p984031812378"></a>Obtains the span ID from the current <strongid="b186741420142718"><aname="b186741420142718"></a><aname="b186741420142718"></a>HiTraceId</strong> object.</p>
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p88419184373"><aname="p88419184373"></a><aname="p88419184373"></a>Outputs HiTraceChain call chain information based on the information type. The information includes the timestamp and <strongid="b185817437323"><aname="b185817437323"></a><aname="b185817437323"></a>HiTraceId</strong> object information of the span.</p>
<aname="ul18619103153812"></a><aname="ul18619103153812"></a><ulid="ul18619103153812"><li><strongid="b7818831083"><aname="b7818831083"></a><aname="b7818831083"></a>type</strong>: Indicates the information type. The options are as follows:<aname="ul1941510328297"></a><aname="ul1941510328297"></a><ulid="ul1941510328297"><li><strongid="b18809161180"><aname="b18809161180"></a><aname="b18809161180"></a>HITRACE_TP_CS</strong>: Client Send, which indicates the messages sent by the synchronous/asynchronous communication client.</li><li><strongid="b327281271319"><aname="b327281271319"></a><aname="b327281271319"></a>HITRACE_TP_SR</strong>: Server Receive, which indicates the messages received by the server in synchronous/asynchronous communication.</li><li><strongid="b10154742682"><aname="b10154742682"></a><aname="b10154742682"></a>HITRACE_TP_SS</strong>: Server Send, which indicates the response messages sent by the server in synchronous communication.</li><li><strongid="b152598127810"><aname="b152598127810"></a><aname="b152598127810"></a>HITRACE_TP_CR</strong>: Client Receive, which indicates the response messages received by the synchronous communication client.</li><li><strongid="b82631512817"><aname="b82631512817"></a><aname="b82631512817"></a>HITRACE_TP_GENERAL</strong>: Indicates the common output information.</li></ul>
</li><li><strongid="b117401716584"><aname="b117401716584"></a><aname="b117401716584"></a>id</strong>: Indicates the ID of the current span.</li><li><strongid="b392172019813"><aname="b392172019813"></a><aname="b392172019813"></a>fmt</strong>: Indicates the string describing the format variable parameter.</li><li><strongid="b986771717818"><aname="b986771717818"></a><aname="b986771717818"></a>args</strong>: Indicates the variable parameter.</li></ul>
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p68411618153713"><aname="p68411618153713"></a><aname="p68411618153713"></a>Outputs HiTraceChain call chain information based on the communication mode and information type. The information includes the timestamp and <strongid="b8151210123912"><aname="b8151210123912"></a><aname="b8151210123912"></a>HiTraceId</strong> object information of the span.</p>
<aname="ul914264413811"></a><aname="ul914264413811"></a><ulid="ul914264413811"><li><strongid="b76471824183"><aname="b76471824183"></a><aname="b76471824183"></a>mode</strong>: Indicates the communication mode. The options are as follows:<aname="ul137382469451"></a><aname="ul137382469451"></a><ulid="ul137382469451"><li><strongid="b13732297812"><aname="b13732297812"></a><aname="b13732297812"></a>HITRACE_CM_DEFAULT</strong>: default communication mode used when no communication mode is specified</li><li><strongid="b1820115271789"><aname="b1820115271789"></a><aname="b1820115271789"></a>HITRACE_CM_THREAD</strong>: inter-thread communication</li><li><strongid="b27781831488"><aname="b27781831488"></a><aname="b27781831488"></a>HITRACE_CM_PROCESS</strong>: inter-process communication</li><li><strongid="b15657113313819"><aname="b15657113313819"></a><aname="b15657113313819"></a>HITRACE_CM_DEVICE</strong>: inter-device communication</li></ul>
</li><li><strongid="b172723513812"><aname="b172723513812"></a><aname="b172723513812"></a>type</strong>: Indicates the information type. The options are as follows:<aname="ul19648426458"></a><aname="ul19648426458"></a><ulid="ul19648426458"><li><strongid="b26421037382"><aname="b26421037382"></a><aname="b26421037382"></a>HITRACE_TP_CS</strong>: Client Send, which indicates the messages sent by the synchronous/asynchronous communication client.</li><li><strongid="b66504018818"><aname="b66504018818"></a><aname="b66504018818"></a>HITRACE_TP_SR</strong>: Server Receive, which indicates the messages received by the server in synchronous/asynchronous communication.</li><li><strongid="b285283761"><aname="b285283761"></a><aname="b285283761"></a>HITRACE_TP_SS</strong>: Server Send, which indicates the response messages sent by the server in synchronous communication.</li><li><strongid="b148684447814"><aname="b148684447814"></a><aname="b148684447814"></a>HITRACE_TP_CR</strong>: Client Receive, which indicates the response messages received by the synchronous communication client.</li><li><strongid="b17875164618816"><aname="b17875164618816"></a><aname="b17875164618816"></a>HITRACE_TP_GENERAL</strong>: Indicates the common output information.</li></ul>
</li><li><strongid="b1216749882"><aname="b1216749882"></a><aname="b1216749882"></a>id</strong>: Indicates the ID of the current span.</li><li><strongid="b82757501383"><aname="b82757501383"></a><aname="b82757501383"></a>fmt</strong>: Indicates the string describing the format variable parameter.</li><li><strongid="b15518145114817"><aname="b15518145114817"></a><aname="b15518145114817"></a>args</strong>: Indicates the variable parameter.</li></ul>
<tdclass="cellrowborder"valign="top"width="58.77%"headers="mcps1.2.4.1.3 "><pid="p48419181372"><aname="p48419181372"></a><aname="p48419181372"></a>Represents the default constructor used to generate an invalid <strongid="b1235325844115"><aname="b1235325844115"></a><aname="b1235325844115"></a>HiTraceId</strong> object. </p>
<trid="row138418186374"><tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.1 "><pid="p19841111813712"><aname="p19841111813712"></a><aname="p19841111813712"></a>HiTraceId(const uint8_t* pIdArray, int len)</p>
</td>
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p684110183377"><aname="p684110183377"></a><aname="p684110183377"></a>Represents the constructor used to create a <strongid="b1488144194216"><aname="b1488144194216"></a><aname="b1488144194216"></a>HiTraceId</strong> object based on the specified byte array. </p>
<divclass="p"id="p9841151833711"><aname="p9841151833711"></a><aname="p9841151833711"></a>Input arguments:<aname="ul783818256482"></a><aname="ul783818256482"></a><ulid="ul783818256482"><li><strongid="b1725445715818"><aname="b1725445715818"></a><aname="b1725445715818"></a>pIdArray</strong>: Indicates the pointer to a byte array.</li><li><strongid="b3437458486"><aname="b3437458486"></a><aname="b3437458486"></a>len</strong>: Indicates the length of the byte array.</li></ul>
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p1084251893713"><aname="p1084251893713"></a><aname="p1084251893713"></a>Checks whether the <strongid="b18546440145116"><aname="b18546440145116"></a><aname="b18546440145116"></a>HiTraceId</strong> object is valid.</p>
<pid="p884261893710"><aname="p884261893710"></a><aname="p884261893710"></a>Return value: Returns <strongid="b20386195514314"><aname="b20386195514314"></a><aname="b20386195514314"></a>true</strong> if the <strongid="b1899544174516"><aname="b1899544174516"></a><aname="b1899544174516"></a>HiTraceId</strong> object is valid; returns <strongid="b1273655294313"><aname="b1273655294313"></a><aname="b1273655294313"></a>false</strong> otherwise.</p>
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p128421518153712"><aname="p128421518153712"></a><aname="p128421518153712"></a>Checks whether the tracing flag of the <strongid="b1014619442447"><aname="b1014619442447"></a><aname="b1014619442447"></a>HiTraceId</strong> object is enabled.</p>
<aname="ul9760031103115"></a><aname="ul9760031103115"></a><ulid="ul9760031103115"><li><strongid="b136731441791"><aname="b136731441791"></a><aname="b136731441791"></a>flag</strong>: Indicates the tracing flag. For details, see the description in the <strongid="b186672319452"><aname="b186672319452"></a><aname="b186672319452"></a>Begin</strong> function.</li></ul>
<pid="p98421318143720"><aname="p98421318143720"></a><aname="p98421318143720"></a>Return value: Returns <strongid="b151944819455"><aname="b151944819455"></a><aname="b151944819455"></a>true</strong> if the tracing flag is enabled; returns <strongid="b1619204874513"><aname="b1619204874513"></a><aname="b1619204874513"></a>false</strong> otherwise.</p>
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p1084221893717"><aname="p1084221893717"></a><aname="p1084221893717"></a>Enables the tracing flag of the <strongid="b118041135213"><aname="b118041135213"></a><aname="b118041135213"></a>HiTraceId</strong> object.</p>
<aname="ul144862816319"></a><aname="ul144862816319"></a><ulid="ul144862816319"><li><strongid="b430319434"><aname="b430319434"></a><aname="b430319434"></a>flag</strong>: Indicates the tracing flag. For details, see the description in the <strongid="b1067701187"><aname="b1067701187"></a><aname="b1067701187"></a>Begin</strong> function.</li></ul>
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p12842151803718"><aname="p12842151803718"></a><aname="p12842151803718"></a>Obtains the tracing flag set in the <strongid="b36515674811"><aname="b36515674811"></a><aname="b36515674811"></a>HiTraceId</strong> object.</p>
<pid="p19842101853716"><aname="p19842101853716"></a><aname="p19842101853716"></a>Return value: Returns the combination of tracing flags. For details, see the description in the <strongid="b12693139144817"><aname="b12693139144817"></a><aname="b12693139144817"></a>Begin</strong> function.</p>
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p7842141823718"><aname="p7842141823718"></a><aname="p7842141823718"></a>Sets a tracing flag in the <strongid="b9174314814"><aname="b9174314814"></a><aname="b9174314814"></a>HiTraceId</strong> object.</p>
<aname="ul6490121183115"></a><aname="ul6490121183115"></a><ulid="ul6490121183115"><li><strongid="b1556719154919"><aname="b1556719154919"></a><aname="b1556719154919"></a>flags</strong>: Indicates the combination of tracing flags. For details, see the description in the <strongid="b469312329341"><aname="b469312329341"></a><aname="b469312329341"></a>Begin</strong> function.</li></ul>
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p784271815372"><aname="p784271815372"></a><aname="p784271815372"></a>Sets the call chain ID in the <strongid="b1319041125416"><aname="b1319041125416"></a><aname="b1319041125416"></a>HiTraceId</strong> object.</p>
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p1484351820374"><aname="p1484351820374"></a><aname="p1484351820374"></a>Obtains the span ID from the current <strongid="b8123101515516"><aname="b8123101515516"></a><aname="b8123101515516"></a>HiTraceId</strong> object.</p>
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p14843171816375"><aname="p14843171816375"></a><aname="p14843171816375"></a>Sets the span ID in the <strongid="b13643024185512"><aname="b13643024185512"></a><aname="b13643024185512"></a>HiTraceId</strong> object.</p>
<aname="ul1799516134316"></a><aname="ul1799516134316"></a><ulid="ul1799516134316"><li><strongid="b43891187116"><aname="b43891187116"></a><aname="b43891187116"></a>spanId</strong>: Indicates the span ID.</li></ul>
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p884381819373"><aname="p884381819373"></a><aname="p884381819373"></a>Obtains the parent span ID from the current <strongid="b5851839615"><aname="b5851839615"></a><aname="b5851839615"></a>HiTraceId</strong> object.</p>
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p1884361803719"><aname="p1884361803719"></a><aname="p1884361803719"></a>Sets the parent span ID in the <strongid="b1660960324"><aname="b1660960324"></a><aname="b1660960324"></a>HiTraceId</strong> object.</p>
<trid="row128435182379"><tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.1 "><pid="p5843181816371"><aname="p5843181816371"></a><aname="p5843181816371"></a>int ToBytes(uint8_t* pIdArray, int len)</p>
</td>
<tdclass="cellrowborder"valign="top"headers="mcps1.2.4.1.2 "><pid="p8843171818378"><aname="p8843171818378"></a><aname="p8843171818378"></a>Converts the <strongid="b68851225439"><aname="b68851225439"></a><aname="b68851225439"></a>HiTraceId</strong> object into a byte array to facilitate caching or communication transfer.</p>
<aname="ul169461002314"></a><aname="ul169461002314"></a><ulid="ul169461002314"><li><strongid="b960934311010"><aname="b960934311010"></a><aname="b960934311010"></a>pIdArray</strong>: Indicates the pointer to a byte array. The minimum length of the byte array is <strongid="b96124430106"><aname="b96124430106"></a><aname="b96124430106"></a>HITRACE_ID_LEN</strong>.</li><li><strongid="b13672164941019"><aname="b13672164941019"></a><aname="b13672164941019"></a>len</strong>: Indicates the length of the byte array.</li></ul>
<aname="ul116274319312"></a><aname="ul116274319312"></a><ulid="ul116274319312"><li><strongid="b12376938695"><aname="b12376938695"></a><aname="b12376938695"></a>pIdArray</strong>: Indicates the pointer to a byte array. If the object is valid, the object data after conversion is stored.</li></ul>
<pid="p8843618143720"><aname="p8843618143720"></a><aname="p8843618143720"></a>Return value: Returns a value greater than 0 (indicating a valid array of object data) if the conversion is successful; returns <strongid="b2156170234"><aname="b2156170234"></a><aname="b2156170234"></a>0</strong> otherwise.</p>
</td>
</tr>
</tbody>
</table>
## Call Chain Processing
Inter-device, inter-process, and inter-thread calls are implemented through the communication mechanism. **HiTraceChain** requires transfer of **traceid** in the communication mechanism.
Some built-in communication mechanisms \(such as ZIDL\) of OpenHarmony already support the transfer of **traceid**.
The following figure shows the process of transferring **traceid** in synchronous call. The process of transferring **traceid** in asynchronous call is similar.
The following figure shows the process of transferring **traceid** in synchronous call. The process of transferring **traceid** in asynchronous call is similar.
Extended communication mechanisms can also follow this implementation.
Extended communication mechanisms can also follow this implementation.
**Figure 5** Call chain trace in synchronous communication
**Figure 5** Call chain tracing in synchronous communication
1. The service module on the client calls the **begin\(\)** function to start call chain tracing.
1. The service module on the client calls the **begin()** function to start call chain trace.
2. The service module on the client synchronously calls the **transact** function to the communication component on the client.
2. The service module on the client synchronously calls the **transact** function to the communication component on the client.
3. The communication component on the client performs the following:
3. The communication component on the client performs the following:
1. Obtains **traceid** from the TLS of the calling thread.
1. Obtains **traceid** from the TLS of the calling thread.
2. Generates child **traceid**.
2. Generates child **traceid**.
3. Writes child **traceid** into the transaction data \(synchronous communication data\).
3. Writes child **traceid** into the transaction data (synchronous communication data).
4. Performs Client Send \(CS\) tracing.
4. Performs CS trace.
5. Sends communication data to the communication component on the server.
5. Sends communication data to the communication component on the server.
4. On receiving the communication data, the communication component on the server performs the following:
4. On receiving the communication data, the communication component on the server performs the following:
1. Obtains **traceid** from the data message package.
1. Obtains **traceid** from the data message package.
2. Sets **traceid** in the TLS of the calling thread.
2. Sets **traceid** in the TLS of the calling thread.
3. Performs Server Receive \(SR\) tracing.
3. Performs SR trace.
4. Synchronously call the **onTransact** callback to the service module on the server.
4. Synchronously calls the **onTransact** callback to the service module on the server.
5. The service module on the server processes the service and sends the transact reply message carrying the processing result to the communication component.
5. The service module on the server processes the service and sends the transact reply message carrying the processing result to the communication component.
6. The communication component on the server performs the following:
6. The communication component on the server performs the following:
1. Performs Server Send \(SS\) tracing.
1. Performs SS trace.
2. Sends communication data to the communication component on the client.
2. Sends communication data to the communication component on the client.
3. Clears **traceid** from the TLS of the calling thread.
3. Clears **traceid** from the TLS of the calling thread.
7. On receiving the communication data, the communication component on the client performs the following:
7. On receiving the communication data, the communication component on the client performs the following:
1. Performs Client Receive \(CR\) tracing.
1. Performs CR trace.
2. Sends a transact reply response to the service module on the client.
2. Sends a transact reply response to the service module on the client.
8. The service module on the client processes the transact reply response.
8. The service module on the client processes the transact reply response.
9. When the process ends, the service module on the client calls the **end\(\)** function to stop call chain tracing.
9. When the process ends, the service module on the client calls the **end()** function to stop call chain trace.
## How to Develop
## How to Develop
### C++
1. Develop the source code.
### **C++**
1. Develop the source code.
Include the **hitracechain** header file in the class definition header file or class implementation source file. For example:
Include the **hitracechain** header file in the class definition header file or class implementation source file. For example:
```
```
#include "hitrace/tracechain.h"
#include "hitrace/tracechain.h"
```
```
Add the code to start and stop call chain tracing in the class implementation source file.
Add the code to start and stop call chain trace in the class implementation source file.
```
```
using namespace OHOS::HiviewDFX;
using namespace OHOS::HiviewDFX;
auto traceId = HiTraceChain::Begin("MyServiceFlow", HITRACE_FLAG_DEFAULT);
auto traceId = HiTraceChain::Begin("MyServiceFlow", HITRACE_FLAG_DEFAULT);
...
......
HiTraceChain::End(traceId);
HiTraceChain::End(traceId);
```
```
...
@@ -504,21 +212,20 @@ The process is as follows:
...
@@ -504,21 +212,20 @@ The process is as follows:
```
```
### C
### **C**
1. Develop the source code.
1. Develop the source code.
Include the **hitracechain** header file in the source file.
Include the **hitracechain** header file in the source file.
```
```
#include "hitrace/tracechain.h"
#include "hitrace/tracechain.h"
```
```
Add the code to start and stop call chain tracing in the class implementation source file.
Add the code to start and stop call chain trace in the class implementation source file.
HiTraceMeter is the OpenHarmony subsystem that provides APIs to implement call chain trace throughout a service process. With HiTraceMeter, you can quickly obtain the run log specific to the call chain of a service process and locate faults in inter-device, inter-process, or inter-thread communications. HiTraceMeter supports event logging in user mode and can collect trace data in user mode and kernel mode for performance tracing and analysis.
HiTraceMeter is the OpenHarmony subsystem that provides APIs to implement call chain trace throughout a service process. With HiTraceMeter, you can quickly obtain the run log specific to the call chain of a service process and locate faults in inter-device, inter-process, or inter-thread communications. HiTraceMeter supports event logging in user mode and can collect trace data in user mode and kernel mode for performance trace and analysis.
## Basic Concepts
## Basic Concepts
The HiTraceMeter subsystem consists of three parts:
The HiTraceMeter subsystem consists of three parts:
- JS/C++ HiTraceMeter APIs for application logging
- JS/C++ HiTraceMeter APIs for application logging
- hitrace CLI tool for data collection
- hitrace CLI tool for data collection
- smartperf tool for graphical data analysis
- smartperf tool for graphical data analysis
Wherein, HiTraceMeter APIs and the hitrace CLI tool run on the device side, and the smartperf tool runs on the PC side. HiTraceMeter APIs are provided in C++ and JS for event logging, which aims to generate the trace data necessary for performance tracing and analysis during the development process.
Wherein, HiTraceMeter APIs and the hitrace CLI tool run on the device side, and the smartperf tool runs on the PC side. HiTraceMeter APIs are provided in C++ and JS for event logging, which aims to generate the trace data necessary for performance trace and analysis during the development process.
The hitrace CLI tool is used to collect trace data. It captures trace data flows and saves the data as a text file.
The hitrace CLI tool is used to collect trace data. It captures trace data flows and saves the data as a text file.
...
@@ -80,7 +81,6 @@ HiTraceMeter provides the hitrace CLI tool for capturing trace data in user mode
...
@@ -80,7 +81,6 @@ HiTraceMeter provides the hitrace CLI tool for capturing trace data in user mode
## Constraints
## Constraints
- The implementation of HiTraceMeter functions and APIs depends on the ftrace functionality, a framework provided by the kernel. It enables developers to add more trace functions via plug-ins. Therefore, make sure that ftrace is enabled before you use HiTraceMeter.
- The implementation of HiTraceMeter functions and APIs depends on the ftrace functionality, a framework provided by the kernel. It enables developers to add more trace functions via plug-ins. Therefore, make sure that ftrace is enabled before you use HiTraceMeter.
...
@@ -95,7 +95,6 @@ HiTraceMeter development focuses on two parts: JS/C++ event logging APIs and the
...
@@ -95,7 +95,6 @@ HiTraceMeter development focuses on two parts: JS/C++ event logging APIs and the
## When to Use
## When to Use
You may encounter unexpected issues like app freezing during app development or need to view the code's call chain during code debugging. With the APIs provided by HiTraceMeter, you'll be able to trace the application delay and call chain to identify performance problems.
You may encounter unexpected issues like app freezing during app development or need to view the code's call chain during code debugging. With the APIs provided by HiTraceMeter, you'll be able to trace the application delay and call chain to identify performance problems.
...
@@ -106,18 +105,17 @@ Only C++ APIs are now open for system developers. If you're developing a JS app,
...
@@ -106,18 +105,17 @@ Only C++ APIs are now open for system developers. If you're developing a JS app,
| void StartTrace(uint64_t label, const std::string& value, float limit = -1); | Starts a synchronous trace.|**label**: trace category.<br>**value**: trace data that indicates the specific status, such as the memory size and queue length.|
| void StartTrace(uint64_t label, const std::string& value, float limit = -1); | Starts a synchronous trace.| **label**: trace category.<br>**value**: trace data that indicates the specific status, such as the memory size and queue length.|
**StartTrace** and **FinishTrace** must be used in pairs, and **FinishTrace** matches the latest **StartTrace**. The two APIs can be used in nested mode. The stack data structure is used for matching during trace data parsing. The **limit** parameter is used for flow control, and you are advised to use the default value.
**StartTrace** and **FinishTrace** must be used in pairs, and **FinishTrace** matches the latest **StartTrace**. The two APIs can be used in nested mode. The stack data structure is used for matching during trace data parsing. The **limit** parameter is used for flow control, and you are advised to use the default value.
**Table 2** Async APIs
**Table 2** Async APIs
| Async trace | Function |Parameter Description |
| Async trace | Function | Parameter Description |
| void StartAsyncTrace(uint64_t label, const std::string& value, int32_t taskId, float limit = -1); | Starts an asynchronous trace.| **label**: trace category.<br>**value**: trace data that indicates the specific status, such as the memory size and queue length.<br>**taskId**: ID used to indicate the association of APIs in an asynchronous trace.|
| void StartAsyncTrace(uint64_t label, const std::string& value, int32_t taskId, float limit = -1); | Starts an asynchronous trace.| **label**: trace category.<br>**value**: trace data that indicates the specific status, such as the memory size and queue length.<br>**taskId**: ID used to indicate the association of APIs in an asynchronous trace.|
| void FinishAsyncTrace(uint64_t label, const std::string& value, int32_t taskId); | Stops an asynchronous trace.| **label**: trace category.<br>**value**: trace data that indicates the specific status, such as the memory size and queue length.<br>**taskId**: ID used to indicate the association of APIs in an asynchronous trace.|
| void FinishAsyncTrace(uint64_t label, const std::string& value, int32_t taskId); | Stops an asynchronous trace.| **label**: trace category.<br>**value**: trace data that indicates the specific status, such as the memory size and queue length.<br>**taskId**: ID used to indicate the association of APIs in an asynchronous trace.|
...
@@ -127,17 +125,18 @@ The trace data of **StartAsyncTrace** and **FinishAsyncTrace** is matched based
...
@@ -127,17 +125,18 @@ The trace data of **StartAsyncTrace** and **FinishAsyncTrace** is matched based
**Table 3** Counter APIs
**Table 3** Counter APIs
| Counter Trace | Function |Parameter Description |
| Counter Trace | Function | Parameter Description |
| void CountTrace(uint64_t label, const std::string& name, int64_t); | Count trace.|**label**: trace category.<br>**name**: trace name displayed in the IDE.|
| void CountTrace(uint64_t label, const std::string& name, int64_t); | Count trace.| **label**: trace category.<br>**name**: trace name displayed in the IDE.|
## How to Develop
## How to Develop
1. Add the build dependencies to the build configuration file **base\hiviewdfx\hitrace\cmd\BUILD.gn**.
1. Add the build dependencies to the build configuration file **base\hiviewdfx\hitrace\cmd\BUILD.gn**.
```
```
external_deps = [ "hitrace_native:hitrace_meter"]
external_deps = [ "hitrace_native:hitrace_meter"]
```
```
2. Add the header file dependencies.
2. Add the header file dependencies.
```cpp
```cpp
...
@@ -146,13 +145,12 @@ The trace data of **StartAsyncTrace** and **FinishAsyncTrace** is matched based
...
@@ -146,13 +145,12 @@ The trace data of **StartAsyncTrace** and **FinishAsyncTrace** is matched based
3. When calling an API, pass the trace value as an input parameter. The trace tags currently supported are listed in **hitrace_meter.h**. Assume that the trace tag is **OHOS** and trace data of **func1** and **func2** needs to be captured. After the hitrace command is executed in the shell, the trace data is automatically captured. The captured data includes the function call process and the memory and time consumed during this process. You can use the data to analyze the call process to identify performance problems.
3. When calling an API, pass the trace value as an input parameter. The trace tags currently supported are listed in **hitrace_meter.h**. Assume that the trace tag is **OHOS** and trace data of **func1** and **func2** needs to be captured. After the hitrace command is executed in the shell, the trace data is automatically captured. The captured data includes the function call process and the memory and time consumed during this process. You can use the data to analyze the call process to identify performance problems.
```cpp
#include "hitrace_meter.h" // Include hitrace_meter.h
usingnamespacestd;
```cpp
intmain()
#include "hitrace_meter.h" // Include hitrace_meter.h
FinishTrace(label);// Trace end point of func1Trace
FinishTrace(label);// Trace end point of func1Trace
StartAsyncTrace(label,"asyncTrace1",1234);// Trace start point of asyncTrace1
StartAsyncTrace(label,"asyncTrace1",1234);// Trace start point of asyncTrace1
FinishAsyncTrace(label,"asyncTrace1",1234);// Trace end point of asyncTrace2
FinishAsyncTrace(label,"asyncTrace1",1234);// Trace end point of asyncTrace1
return0;
return0;
}
}
...
@@ -180,7 +178,6 @@ int main()
...
@@ -180,7 +178,6 @@ int main()
You can open the captured data by clicking **Open trace file** in the smartperf tool or dragging the data to the graphics area. For details, see [smartperf](https://toscode.gitee.com/openharmony-sig/smartperf).
You can open the captured data by clicking **Open trace file** in the smartperf tool or dragging the data to the graphics area. For details, see [smartperf](https://toscode.gitee.com/openharmony-sig/smartperf).
## Verification
## Verification
The following is a demo debugging process, where the **StartTrace** and **FinishTrace** APIs are used in synchronization mode.
The following is a demo debugging process, where the **StartTrace** and **FinishTrace** APIs are used in synchronization mode.
...
@@ -274,10 +271,10 @@ The hitrace CLI tool is an executable binary program. On an OpenHarmony-powered
...
@@ -274,10 +271,10 @@ The hitrace CLI tool is an executable binary program. On an OpenHarmony-powered
| -b *n*, --buffer_size *n* | Sets the buffer size for trace data in KB. The default value is **2048**. |
| -b *n*, --buffer_size *n* | Sets the buffer size for trace data in KB. The default value is **2048**. |
| -t *n*, --time *n* | Sets the trace uptime in seconds, which depends on the time required for analysis.|
| -t *n*, --time *n* | Sets the trace uptime in seconds, which depends on the time required for analysis.|
| --trace_clock clock | Sets the type of the clock for adding a timestamp to a trace. The value can be **boot** (default), **global**, **mono**, **uptime**, or **perf**.|
| --trace_clock clock | Sets the type of the clock for adding a timestamp to a trace. The value can be **boot** (default), **global**, **mono**, **uptime**, or **perf**.|
| --trace_begin | Starts capturing trace data. |
| --trace_begin | Starts capturing trace data. |
| --trace_dump | Dumps trace data to the specified position. The default position is the console. |
| --trace_dump | Dumps trace data to the specified position. The default position is the console. |
...
@@ -292,34 +289,41 @@ Examples:
...
@@ -292,34 +289,41 @@ Examples:
- Query supported labels.
- Query supported labels.
```
```
hitrace -l
hitrace -l
```
```
Alternatively, run the following command:
Alternatively, run the following command:
```
```
hitrace --list_categories
hitrace --list_categories
```
```
- Trace ability information for 10 seconds and store the trace data in a buffer of 4 MB.
- Trace ability information for 10 seconds and store the trace data in a buffer of 4 MB.
The data captured by running the hitrace command is incomplete or no data is captured.
The data captured by running the hitrace command is incomplete or no data is captured.
#### **Root Cause**
The value of **-t** or **-b** buffer is too small, leading to data loss.
#### Solution
#### Solution
Check the value of the **-t** and **-b** parameters. If the value is too small, data loss will occur. You are advised to set **-t** to **60** and **-b** to **204800** to increase the trace capture time and buffer, respectively.
You can set **-t** to **60** and **-b** to **204800** to increase the trace time and buffer size.
# Reference
# Reference
For details about HiTraceMeter, see [hiviewdfx_hitrace: A Lightweight Distributed Tracing](https://gitee.com/openharmony/hiviewdfx_hitrace).
For details about HiTraceMeter, see [hiviewdfx_hitrace: Lightweight Distributed Trace](https://gitee.com/openharmony/hiviewdfx_hitrace).
[Design for X](https://en.wikipedia.org/wiki/Design_for_X)\(DFX\) refers to the software design that aims to improve the quality attributes in OpenHarmony. It mainly consists of two parts: design for reliability \(DFR\) and design for testability \(DFT\).
[Design for X](https://en.wikipedia.org/wiki/Design_for_X)\(DFX\) refers to the software design that aims to improve the quality attributes in OpenHarmony. It mainly consists of two parts: design for reliability \(DFR\) and design for testability \(DFT\).
The DFX subsystem provides the following functions:
The DFX subsystem provides the following functions:
- HiLog: implements the logging function. It is applicable to mini-system devices \(reference memory ≥ 128 KiB\), small-system devices \(reference memory ≥ 1 MiB\), and standard-system devices \(reference memory ≥ 128 MB\).
- HiLog: implements the logging function. It is applicable to mini-system devices \(reference memory ≥ 128 KiB\), small-system devices \(reference memory ≥ 1 MiB\), and standard-system devices \(reference memory ≥ 128 MiB\).
- HiTraceChain: implements distributed call chain tracing. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- HiTraceChain: implements distributed call chain trace. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- HiTraceMeter: implements performance trace. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- HiTraceMeter: implements performance trace. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- HiCollie: implements thread suspension detection. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- HiCollie: implements thread suspension detection. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- HiSysEvent: implements system event logging. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- HiSysEvent: implements system event logging. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- HiDumper: exports system information. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- HiDumper: exports system information. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- FaultLogger: implements crash detection. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- Faultlogger: implements crash detection. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- Hiview: implements device maintenance across different platforms. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- Hiview: implements device maintenance across different platforms. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- HiAppEvent and HiChecker are only hap developer oriented。
- HiAppEvent and HiChecker are applicable only for HAP developers.
Logging means to record the log information generated during system running so you can understand the running process and status of the system or applications.
Logging means to record the log information generated during system running so you can understand the running process and status of the system or applications.
**Distributed call chain tracing**
**Distributed call chain trace**
In a distributed system, the initiation of a service may involve multiple software modules, with control commands and data transmitted over intra-process, inter-process, and inter-device communication interfaces. To help you understand such complex communication processes and locate service faults efficiently, the DFX subsystem provides a distributed call chain tracing framework.
In a distributed system, the initiation of a service may involve multiple software modules, with control commands and data transmitted over intra-process, inter-process, and inter-device communication interfaces. To help you understand such complex communication processes and locate service faults efficiently, the DFX subsystem provides a distributed call chain trace framework.
**Thread suspension detection**
**Thread suspension detection**
If a thread is trapped in an infinite loop or the kernel state \(for example, Uninterruptable Sleep, Traced, Zombie, or synchronous wait\) when it is running, the thread cannot respond to normal service requests and cannot detect and recover from faults by itself. To detect and locate this type of faults, the DFX subsystem provides a simple watchdog mechanism by inserting detection probes to the process nodes that are prone to suspension. This ensures that suspension faults can be detected and logs can be collected.
If a thread is trapped in an infinite loop or the kernel state (for example, Uninterruptable Sleep, Traced, Zombie, or synchronous wait) when it is running, the thread cannot respond to normal service requests and cannot detect and recover from faults by itself. To detect and locate this type of faults, the DFX subsystem provides a simple watchdog mechanism by inserting detection probes to the process nodes that are prone to suspension. This ensures that suspension faults can be detected and logs can be collected.
**Event logging**
**Logging**
Event logging means to collect and log events reported during system running. The log information will help you better analyze the product usage.
Event logging means to collect and log events reported during system running. The log information will help you better analyze the product usage.
**System event**
**System event**
A system event is an indication of the system status at a given time point during system running. You can use these events to analyze the status change of the system.
A system event is an indication of the system status at a given time point during system running. You can use these events to analyze the status change of the system.