未验证 提交 8cecbd09 编写于 作者: O openharmony_ci 提交者: Gitee

!2601 翻译已完成2052#I4XY2E

Merge pull request !2601 from shawn_he/b2052
......@@ -11,21 +11,19 @@ import hichecker from '@ohos.hichecker';
```
## System Capabilities
SystemCapability.HiviewDFX.HiChecker
## Rule Constants
## Constants
Provides the constants of all rule types.
| Name| Type| Description|
**System capability**: SystemCapability.HiviewDFX.HiChecker
| Name | Type| Description |
| ---------------------------------- | -------- | ------------------------------------------------------ |
| RULE_CAUTION_PRINT_LOG | BigInt | Alarm rule, which is programmed to print a log when an alarm is generated.|
| RULE_CAUTION_TRIGGER_CRASH | BigInt | Alarm rule, which is programmed to force the application to exit when an alarm is generated.|
| RULE_THREAD_CHECK_SLOW_PROCESS | BigInt | Caution rule, which is programmed to detect whether any time-consuming function is invoked.|
| RULE_CHECK_SLOW_EVENT | BigInt | Caution rule, which is programmed to detect whether the event distribution or processing time has exceeded the specified time threshold.|
| RULE_CHECK_ABILITY_CONNECTION_LEAK | BigInt | Caution rule, which is programmed to detect whether ability leakage has occurred.|
| RULE\_CAUTION\_PRINT\_LOG | BigInt | Alarm rule, which is programmed to print a log when an alarm is generated. |
| RULE\_CAUTION\_TRIGGER\_CRASH | BigInt | Alarm rule, which is programmed to force the application to exit when an alarm is generated. |
| RULE\_THREAD\_CHECK\_SLOW\_PROCESS | BigInt | Caution rule, which is programmed to detect whether any time-consuming function is invoked. |
| RULE\_CHECK\_SLOW\_EVENT | BigInt | Caution rule, which is programmed to detect whether the event distribution or processing time has exceeded the specified time threshold.|
| RULE\_CHECK\_ABILITY\_CONNECTION\_LEAK| BigInt | Caution rule, which is programmed to detect whether ability leakage has occurred. |
## hichecker.addRule
......@@ -34,11 +32,13 @@ addRule(rule: BigInt): void
Adds one or more rules. HiChecker detects unexpected operations or gives feedback based on the added rules.
**System capability**: SystemCapability.HiviewDFX.HiChecker
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------- |
| rule | BigInt | Yes| Rule to be added.|
| rule | BigInt | Yes | Rule to be added.|
**Example**
......@@ -57,11 +57,13 @@ removeRule(rule: BigInt): void
Removes one or more rules. The removed rules will become ineffective.
**System capability**: SystemCapability.HiviewDFX.HiChecker
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------- |
| rule | BigInt | Yes| Rule to be removed.|
| rule | BigInt | Yes | Rule to be removed.|
**Example**
......@@ -80,9 +82,11 @@ getRule(): BigInt
Obtains a collection of thread, process, and alarm rules that have been added.
**System capability**: SystemCapability.HiviewDFX.HiChecker
**Return value**
| Type| Description|
| Type | Description |
| ------ | ---------------------- |
| BigInt | Collection of added rules.|
......@@ -93,7 +97,7 @@ Obtains a collection of thread, process, and alarm rules that have been added.
hichecker.addRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS);
// Obtain the collection of added rules.
hichecker.getRule(); // return 1n;
hichecker.getRule(); // Return 1n.
```
## hichecker.contains
......@@ -102,15 +106,17 @@ contains(rule: BigInt): boolean
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.
**System capability**: SystemCapability.HiviewDFX.HiChecker
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------- |
| rule | BigInt | Yes| Rule to be checked.|
| rule | BigInt | Yes | Rule to be checked.|
**Return value**
| Type| Description|
| Type | Description |
| ------- | ---------------------------------------------------------- |
| boolean | Returns **true** if the rule exists in the collection of added rules; returns **false** otherwise.|
......@@ -121,6 +127,6 @@ Checks whether the specified rule exists in the collection of added rules. If th
hichecker.addRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS);
// Check whether the added rule exists in the collection of added rules.
hichecker.contains(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS); // return true;
hichecker.contains(hichecker.RULE_CAUTION_PRINT_LOG); // return false;
hichecker.contains(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS); // Return true.
hichecker.contains(hichecker.RULE_CAUTION_PRINT_LOG); // Return false.
```
......@@ -62,7 +62,7 @@ After being started by the init process, the appspawn process waits for inter-pr
</tr>
<tr id="row187625816314"><td class="cellrowborder" valign="top" width="39.489999999999995%" headers="mcps1.2.3.1.1 "><p id="p188771758833"><a name="p188771758833"></a><a name="p188771758833"></a>gidTable</p>
</td>
<td class="cellrowborder" valign="top" width="60.51%" headers="mcps1.2.3.1.2 "><p id="p187716587310"><a name="p187716587310"></a><a name="p187716587310"></a>Information about the application process group to be started. Its length is specified by **gidCount**. A maximum of 64 process groups are supported. The value must be a positive number.</p>
<td class="cellrowborder" valign="top" width="60.51%" headers="mcps1.2.3.1.2 "><p id="p187716587310"><a name="p187716587310"></a><a name="p187716587310"></a>Information about the application process group to be started. Its length is specified by <strong>gidCount</strong>. A maximum of 64 process groups are supported. The value must be a positive number.</p>
</td>
</tr>
<tr id="row187625816314"><td class="cellrowborder" valign="top" width="39.489999999999995%" headers="mcps1.2.3.1.1 "><p id="p188771758833"><a name="p188771758833"></a><a name="p188771758833"></a>gidCount</p>
......@@ -89,8 +89,8 @@ After being started by the init process, the appspawn process waits for inter-pr
### Available APIs<a name="section56901555914"></a>
**Table 2** Available APIs
<table><thead align="left"><tr id="row6650142913713"><th class="cellrowborder" valign="top" width="39.489999999999995%" id="mcps1.2.3.1.1"><p id="p17650112914379"><a name="p17650112914379"></a><a name="p17650112914379"></a>Field</p>
**Table 2** API description
<table><thead align="left"><tr id="row6650142913713"><th class="cellrowborder" valign="top" width="39.489999999999995%" id="mcps1.2.3.1.1"><p id="p17650112914379"><a name="p17650112914379"></a><a name="p17650112914379"></a>API</p>
</th>
<th class="cellrowborder" valign="top" width="60.51%" id="mcps1.2.3.1.2"><p id="p865032916376"><a name="p865032916376"></a><a name="p865032916376"></a>Description</p>
</th>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册