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

!3463 Mark coding language type in markdown file.

Merge pull request !3463 from honghecun/master
......@@ -5,7 +5,7 @@
## Modules to Import
```
```javascript
import hiTraceChain from '@ohos.hiTraceChain';
```
......@@ -90,7 +90,7 @@ Starts call chain tracing. This API works in synchronous manner.
**Example**
```
```javascript
let asyncTraceId = hiTraceChain.begin("business", hiTraceChain.HiTraceFlag.INCLUDE_ASYNC | hiTraceChain.HiTraceFlag.DONOT_CREATE_SPAN);
```
......@@ -110,7 +110,7 @@ Stops call chain tracing. This API works in synchronous manner.
**Example**
```
```javascript
let asyncTraceId = hiTraceChain.begin("business");
// End the call chain tracing after the service logic is executed for several times.
hiTraceChain.end(asyncTraceId);
......@@ -132,7 +132,7 @@ Obtains the trace ID. This API works in synchronous manner.
**Example**
```
```javascript
let traceId = hiTraceChain.begin("business");
// Obtain the current trace ID after the service logic is executed for several times.
let curTraceId = hiTraceChain.getId();
......@@ -154,7 +154,7 @@ Sets a trace ID. This API works in synchronous manner.
**Example**
```
```javascript
let traceId = hiTraceChain.begin("business");
// Set the current trace ID after the service logic is executed for several times.
hiTraceChain.setId(asyncTraceId);
......@@ -170,7 +170,7 @@ Clears the trace ID. This API works in synchronous manner.
**Example**
```
```javascript
let traceId = hiTraceChain.begin("business");
// Clear the current trace ID after the service logic is executed for several times.
hiTraceChain.clearId();
......@@ -192,7 +192,7 @@ Creates a trace span. This API works in synchronous manner.
**Example**
```
```javascript
let traceId = hiTraceChain.begin("business");
// Create a trace span after the service logic is executed for several times.
let spanTraceId = hiTraceChain.createSpan();
......@@ -217,7 +217,7 @@ Triggers a trace point. This API works in synchronous manner.
**Example**
```
```javascript
let asyncTraceId = hiTraceChain.begin("business", hiTraceChain.HiTraceFlag.INCLUDE_ASYNC | hiTraceChain.HiTraceFlag.DONOT_CREATE_SPAN);
// Trigger the trace point after the service logic is executed for several times.
hiTraceChain.tracepoint(hiTraceChain.HiTraceCommunicationMode.THREAD, hiTraceChain.HiTraceTracepointType.SS, asyncTraceId, "Just a example");
......@@ -245,7 +245,7 @@ Checks whether a **HiTraceId** instance is valid. This API works in synchronous
**Example**
```
```javascript
let traceId = hiTraceChain.begin("business");
let traceIdIsvalid = hiTraceChain.isValid(traceId);
```
......@@ -273,7 +273,7 @@ Checks whether the specified trace flag in the **HiTraceId** instance is enabled
**Example**
```
```javascript
let asyncTraceId = hiTraceChain.begin("business", hiTraceChain.HiTraceFlag.INCLUDE_ASYNC);
// The value of enabledDoNotCreateSpanFlag is true.
let enabledDoNotCreateSpanFlag = hiTraceChain.isFlagEnabled(asyncTraceId, hiTraceChain.HiTraceFlag.INCLUDE_ASYNC);
......@@ -295,7 +295,7 @@ Enables the specified trace flag in the **HiTraceId** instance. This API works i
**Example**
```
```javascript
let asyncTraceId = hiTraceChain.begin("business", hiTraceChain.HiTraceFlag.INCLUDE_ASYNC);
hiTraceChain.enable(asyncTraceId, hiTraceChain.HiTraceFlag.DONOT_CREATE_SPAN);
// The value of enabledDoNotCreateSpanFlag is true.
......
......@@ -6,7 +6,7 @@
## Modules to Import
```
```javascript
import hiTraceMeter from '@ohos.hiTraceMeter';
```
......@@ -32,7 +32,7 @@ If the trace tasks with the same name are not performed at the same time, the sa
**Example**
```
```javascript
hiTraceMeter.startTrace("myTestFunc", 1);
hiTraceMeter.startTrace("myTestFunc", 1, 5); // The expected duration of the trace task is 5 ms.
```
......@@ -57,11 +57,11 @@ To stop a trace task, the values of name and task ID in **finishTrace** must be
**Example**
```
```javascript
hiTraceMeter.finishTrace("myTestFunc", 1);
```
```
```javascript
// Start track tasks with the same name concurrently.
hiTraceMeter.startTrace("myTestFunc", 1);
// Service flow
......@@ -72,7 +72,7 @@ hiTraceMeter.finishTrace("myTestFunc", 1);
hiTraceMeter.finishTrace("myTestFunc", 2);
```
```
```javascript
// Start track tasks with the same name at different times.
hiTraceMeter.startTrace("myTestFunc", 1);
// Service flow
......@@ -100,7 +100,7 @@ Traces the value changes of a variable.
| count | number | Yes| Value of the variable.|
**Example**
```
```javascript
let traceCount = 3;
hiTraceMeter.traceByValue("myTestCount", traceCount);
traceCount = 4;
......
......@@ -5,7 +5,7 @@
## 导入模块
```
```javascript
import hiTraceChain from '@ohos.hiTraceChain';
```
......@@ -90,7 +90,7 @@ begin(name: string, flags: number = HiTraceFlag.DEFAULT): HiTraceId
**示例:**
```
```javascript
let asyncTraceId = hiTraceChain.begin("business", hiTraceChain.HiTraceFlag.INCLUDE_ASYNC | hiTraceChain.HiTraceFlag.DONOT_CREATE_SPAN);
```
......@@ -110,7 +110,7 @@ end(id: HiTraceId): void
**示例:**
```
```javascript
let asyncTraceId = hiTraceChain.begin("business");
// 若干业务逻辑完成后,结束跟踪。
hiTraceChain.end(asyncTraceId);
......@@ -132,7 +132,7 @@ getId(): HiTraceId
**示例:**
```
```javascript
let traceId = hiTraceChain.begin("business");
// 若干业务逻辑完成后,获取当前HiTraceId。
let curTraceId = hiTraceChain.getId();
......@@ -154,7 +154,7 @@ setId(id: HiTraceId): void
**示例:**
```
```javascript
let traceId = hiTraceChain.begin("business");
// 若干业务逻辑完成后,设置当前HiTraceId。
hiTraceChain.setId(asyncTraceId);
......@@ -170,7 +170,7 @@ clearId(): void
**示例:**
```
```javascript
let traceId = hiTraceChain.begin("business");
// 若干业务逻辑完成后,清除当前HiTraceId。
hiTraceChain.clearId();
......@@ -192,7 +192,7 @@ createSpan(): HiTraceId
**示例:**
```
```javascript
let traceId = hiTraceChain.begin("business");
// 若干业务逻辑完成后,创建跟踪分支。
let spanTraceId = hiTraceChain.createSpan();
......@@ -217,7 +217,7 @@ tracepoint(mode: HiTraceCommunicationMode, type: HiTraceTracepointType, id: HiTr
**示例:**
```
```javascript
let asyncTraceId = hiTraceChain.begin("business", hiTraceChain.HiTraceFlag.INCLUDE_ASYNC | hiTraceChain.HiTraceFlag.DONOT_CREATE_SPAN);
// 若干业务逻辑完成后,触发信息埋点操作。
hiTraceChain.tracepoint(hiTraceChain.HiTraceCommunicationMode.THREAD, hiTraceChain.HiTraceTracepointType.SS, asyncTraceId, "Just a example");
......@@ -245,7 +245,7 @@ isValid(id: HiTraceId): boolean
**示例:**
```
```javascript
let traceId = hiTraceChain.begin("business");
let traceIdIsvalid = hiTraceChain.isValid(traceId);
```
......@@ -273,7 +273,7 @@ isFlagEnabled(id: HiTraceId, flag: HiTraceFlag): boolean
**示例:**
```
```javascript
let asyncTraceId = hiTraceChain.begin("business", hiTraceChain.HiTraceFlag.INCLUDE_ASYNC);
// enabledDoNotCreateSpanFlag为true
let enabledDoNotCreateSpanFlag = hiTraceChain.isFlagEnabled(asyncTraceId, hiTraceChain.HiTraceFlag.INCLUDE_ASYNC);
......@@ -295,7 +295,7 @@ enableFlag(id: HiTraceId, flag: HiTraceFlag): void
**示例:**
```
```javascript
let asyncTraceId = hiTraceChain.begin("business", hiTraceChain.HiTraceFlag.INCLUDE_ASYNC);
hiTraceChain.enable(asyncTraceId, hiTraceChain.HiTraceFlag.DONOT_CREATE_SPAN);
// enabledDoNotCreateSpanFlag为true
......
......@@ -6,7 +6,7 @@
## 导入模块
```
```javascript
import hiTraceMeter from '@ohos.hiTraceMeter';
```
......@@ -32,7 +32,7 @@ startTrace(name: string, taskId: number): void
**示例:**
```
```javascript
hiTraceMeter.startTrace("myTestFunc", 1);
hiTraceMeter.startTrace("myTestFunc", 1, 5); //从startTrace到finishTrace流程的耗时期望为5ms
```
......@@ -57,11 +57,11 @@ finishTrace的name和taskId必须与流程开始的[startTrace](#hitracemetersta
**示例:**
```
```javascript
hiTraceMeter.finishTrace("myTestFunc", 1);
```
```
```javascript
//追踪并行执行的同名任务
hiTraceMeter.startTrace("myTestFunc", 1);
//业务流程......
......@@ -72,7 +72,7 @@ hiTraceMeter.finishTrace("myTestFunc", 1);
hiTraceMeter.finishTrace("myTestFunc", 2);
```
```
```javascript
//追踪串行执行的同名任务
hiTraceMeter.startTrace("myTestFunc", 1);
//业务流程......
......@@ -100,7 +100,7 @@ traceByValue(name: string, count: number): void
| count | number | 是 | 变量的值 |
**示例:**
```
```javascript
let traceCount = 3;
hiTraceMeter.traceByValue("myTestCount", traceCount);
traceCount = 4;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册