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

!2360 翻译已完成 1971#I4XI25

Merge pull request !2360 from shawn_he/a1971
...@@ -9,57 +9,62 @@ ...@@ -9,57 +9,62 @@
import hiTraceChain from '@ohos.hiTraceChain'; import hiTraceChain from '@ohos.hiTraceChain';
``` ```
## System Capabilities
SystemCapability.HiviewDFX.HiTrace
## HiTraceFlag ## HiTraceFlag
Enumerates trace flag types. Enumerates trace flag types.
**System capability**: SystemCapability.HiviewDFX.HiTrace
| Name| Default Value| Description| | Name| Default Value| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| DEFAULT | 0 | Default flag| | DEFAULT | 0 | Default flag. |
| INCLUDE_ASYNC | 1 | Asynchronous call 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. |
| DONOT_CREATE_SPAN | 1 << 1 | No span flag| | DONOT_CREATE_SPAN | 1 << 1 | No span flag. By default, a span is automatically created during tracing of synchronous and asynchronous calls. If this flag is set, no span will be created. |
| TP_INFO | 1 << 2 | Trace point flag| | TP_INFO | 1 << 2 | Trace point flag. By default, no trace point is added when tracing 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: [CS, SR, SS, and CR](#hitracetracepointtype). 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. |
| NO_BE_INFO | 1 << 3 | No begin/end 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.|
| DISABLE_LOG | 1 << 4 | Log association flag| | DISABLE_LOG | 1 << 4 | Log association flag. If this flag is set, information about the trace task will not be printed. |
| FAILURE_TRIGGER | 1 << 5 | Failure trigger flag| | FAILURE_TRIGGER | 1 << 5 | Failure trigger flag. This flag is reserved for future use. |
| D2D_TP_INFO | 1 << 6 | Device-to-device trace point 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 tracing between devices.|
## HiTraceTracepointType ## HiTraceTracepointType
Enumerates trace point types. Enumerates trace point types.
**System capability**: SystemCapability.HiviewDFX.HiTrace
| Name| Default Value| Description| | Name| Default Value| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| CS | 0 | Client Send| | CS | 0 | Client Send (CS) trace point. |
| CR | 1 | Client Receive| | CR | 1 | Client Receive (CS) trace point. |
| SS | 2 | Server Send| | SS | 2 | Server Send (SS) trace point. |
| SR | 3 | Server Receive| | SR | 3 | Server Receive (SR) trace point. |
| GENERAL | 4 | General| | GENERAL | 4 | General trace points except CS, CR, SS, and SR.|
## HiTraceCommunicationMode ## HiTraceCommunicationMode
Enumerates communication modes. Enumerates communication modes.
**System capability**: SystemCapability.HiviewDFX.HiTrace
| Name| Default Value| Description| | Name| Default Value| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| DEFAULT | 0 | Default mode| | DEFAULT | 0 | Default communication mode. |
| THREAD | 1 | Inter-thread communication| | THREAD | 1 | Inter-thread communication. |
| PROCESS | 2 | Inter-process communication| | PROCESS | 2 | Inter-process communication. |
| DEVICE | 3 | Inter-device communication| | DEVICE | 3 | Inter-device communication. |
## HiTraceId ## HiTraceId
Defines a **HiTraceId** object. Defines a **HiTraceId** object.
**System capability**: SystemCapability.HiviewDFX.HiTrace
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| chainId | bigint | Yes| Call chain ID.| | chainId | bigint | Yes| Call chain ID. |
| spanId | number | No| Span ID.| | spanId | number | No| Span ID. |
| parentSpanId | number | No| Parent span ID.| | parentSpanId | number | No| Parent span ID. |
| flags | number | No| Trace flag combination.| | flags | number | No| Trace flag combination.|
## hiTraceChain.begin ## hiTraceChain.begin
...@@ -68,6 +73,8 @@ begin(name: string, flags: number = HiTraceFlag.DEFAULT): HiTraceId ...@@ -68,6 +73,8 @@ begin(name: string, flags: number = HiTraceFlag.DEFAULT): HiTraceId
Starts call chain tracing. This API works in synchronous manner. Starts call chain tracing. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -93,6 +100,8 @@ end(id: HiTraceId): void ...@@ -93,6 +100,8 @@ end(id: HiTraceId): void
Stops call chain tracing. This API works in synchronous manner. Stops call chain tracing. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -113,6 +122,8 @@ getId(): HiTraceId ...@@ -113,6 +122,8 @@ getId(): HiTraceId
Obtains the trace ID. This API works in synchronous manner. Obtains the trace ID. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -133,6 +144,8 @@ setId(id: HiTraceId): void ...@@ -133,6 +144,8 @@ setId(id: HiTraceId): void
Sets a trace ID. This API works in synchronous manner. Sets a trace ID. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -153,6 +166,8 @@ clearId(): void ...@@ -153,6 +166,8 @@ clearId(): void
Clears the trace ID. This API works in synchronous manner. Clears the trace ID. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Example** **Example**
``` ```
...@@ -167,6 +182,8 @@ createSpan(): HiTraceId ...@@ -167,6 +182,8 @@ createSpan(): HiTraceId
Creates a trace span. This API works in synchronous manner. Creates a trace span. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -187,6 +204,8 @@ tracepoint(mode: HiTraceCommunicationMode, type: HiTraceTracepointType, id: HiTr ...@@ -187,6 +204,8 @@ tracepoint(mode: HiTraceCommunicationMode, type: HiTraceTracepointType, id: HiTr
Triggers a trace point. This API works in synchronous manner. Triggers a trace point. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -210,6 +229,8 @@ isValid(id: HiTraceId): boolean ...@@ -210,6 +229,8 @@ isValid(id: HiTraceId): boolean
Checks whether a **HiTraceId** instance is valid. This API works in synchronous manner. Checks whether a **HiTraceId** instance is valid. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -235,6 +256,8 @@ isFlagEnabled(id: HiTraceId, flag: HiTraceFlag): boolean ...@@ -235,6 +256,8 @@ isFlagEnabled(id: HiTraceId, flag: HiTraceFlag): boolean
Checks whether the specified trace flag in the **HiTraceId** instance is enabled. This API works in synchronous manner. Checks whether the specified trace flag in the **HiTraceId** instance is enabled. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -262,6 +285,8 @@ enableFlag(id: HiTraceId, flag: HiTraceFlag): void ...@@ -262,6 +285,8 @@ enableFlag(id: HiTraceId, flag: HiTraceFlag): void
Enables the specified trace flag in the **HiTraceId** instance. This API works in synchronous manner. Enables the specified trace flag in the **HiTraceId** instance. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册