| hiTraceMeter.startTrace(name: string, taskId: number) | void | Starts a trace task. If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different task IDs must be specified in **startTrace**. If the trace tasks with the same name are not performed at the same time, the same task ID can be used.|
| hiTraceMeter.startTrace(name: string, taskId: number) | void | Marks the start of a trace task. If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different task IDs must be specified in **startTrace**. If the trace tasks with the same name are not performed at the same time, the same task ID can be used.|
| hiTraceMeter.finishTrace(name: string, taskId: number) | void | Stops a trace task. The values of **name** and **taskId** must be the same as those of **hiTraceMeter.startTrace**.|
| hiTraceMeter.finishTrace(name: string, taskId: number) | void | Marks the end of a trace task. The values of **name** and **taskId** must be the same as those of **hiTraceMeter.startTrace**.|
| hiTraceMeter.traceByValue(name: string, value: number) | void | Traces the value changes of a variable.|
| hiTraceMeter.traceByValue(name: string, value: number) | void | Marks the value changes of a numeric variable in a trace task.|
## How to Develop
## How to Develop
...
@@ -46,12 +46,12 @@ In this example, distributed call chain tracing begins when the application star
...
@@ -46,12 +46,12 @@ In this example, distributed call chain tracing begins when the application star
},
},
onInit(){
onInit(){
this.title=this.$t('strings.world');
this.title=this.$t('strings.world');
// Start track tasks with the same name concurrently.
// Start trace tasks with the same name concurrently.
hiTraceMeter.startTrace("business",1);
hiTraceMeter.startTrace("business",1);
// Keep the service process running.
// Keep the service process running.
console.log(`business running`);
console.log(`business running`);
hiTraceMeter.startTrace("business",2);// Start the second trace task while the first task is still running. The first and second tasks have the same name but different task IDs.
hiTraceMeter.startTrace("business",2);// Start the second trace task with the same name while the first task is still running. The tasks are running concurrently and therefore their taskId must be different.
// Keep the service process running.
// Keep the service process running.
console.log(`business running`);
console.log(`business running`);
hiTraceMeter.finishTrace("business",1);
hiTraceMeter.finishTrace("business",1);
...
@@ -59,14 +59,14 @@ In this example, distributed call chain tracing begins when the application star
...
@@ -59,14 +59,14 @@ In this example, distributed call chain tracing begins when the application star
console.log(`business running`);
console.log(`business running`);
hiTraceMeter.finishTrace("business",2);
hiTraceMeter.finishTrace("business",2);
// Start track tasks with the same name at different times.
// Start trace tasks with the same name in serial mode.
hiTraceMeter.startTrace("business",1);
hiTraceMeter.startTrace("business",1);
// Keep the service process running.
// Keep the service process running.
console.log(`business running`);
console.log(`business running`);
hiTraceMeter.finishTrace("business",1);// End the first trace task.
hiTraceMeter.finishTrace("business",1);// End the first trace task.
// Keep the service process running.
// Keep the service process running.
console.log(`business running`);
console.log(`business running`);
hiTraceMeter.startTrace("business",1);// Start the second trace task after the first trace task ends. The two tasks have the same name and task ID.
hiTraceMeter.startTrace("business",1);// Start the second trace task with the same name in serial mode.
// Keep the service process running.
// Keep the service process running.
console.log(`business running`);
console.log(`business running`);
...
@@ -79,4 +79,95 @@ In this example, distributed call chain tracing begins when the application star
...
@@ -79,4 +79,95 @@ In this example, distributed call chain tracing begins when the application star
}
}
```
```
2. Click the run button on the application page. Then, you'll obtain the log information for service analysis.
2. Create an ArkTs application project. In the displayed **Project** window, choose **entry** > **src** > **main** > **ets** > **pages** > **index**, and double-click **index.js**. Add the code to implement performance tracing upon page loading. For example, if the name of the trace task is **HITRACE\_TAG\_APP**, the sample code is as follows:
```ts
importhitracefrom'@ohos.hiTraceMeter';
@Entry
@Component
structIndex{
@Statemessage:string='Hello World';
build(){
Row(){
Column(){
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.onClick(()=>{
this.message='Hello ArkUI';
// Start trace tasks with the same name concurrently.
hitrace.startTrace("HITRACE_TAG_APP",1001);
// Keep the service process running.
console.log(`HITRACE_TAG_APP running`);
// Start the second trace task with the same name while the first task is still running. The tasks are running concurrently and therefore their taskId must be different.
hitrace.startTrace("HITRACE_TAG_APP",1002);
// Keep the service process running.
console.log(`HITRACE_TAG_APP running`);
hitrace.finishTrace("HITRACE_TAG_APP",1001);
hitrace.finishTrace("HITRACE_TAG_APP",1002);
// If trace tasks with the same name are not run concurrently, the same taskId can be used.
hitrace.startTrace("HITRACE_TAG_APP",1003);
// Keep the service process running.
console.log(`HITRACE_TAG_APP running`);
// End the first trace task.
hitrace.finishTrace("HITRACE_TAG_APP",1003);
// Start the second trace task with the same name in serial mode. It uses a taskId different from the first trace task.
hitrace.startTrace("HITRACE_TAG_APP",1004);
// Keep the service process running.
console.log(`HITRACE_TAG_APP running`);
lettraceCount=3;
hitrace.traceByValue("myTestCount",traceCount);
hitrace.finishTrace("HITRACE_TAG_APP",1004);
// Start the third trace task with the same name in serial mode. It uses a taskId same as the second trace task.
hitrace.startTrace("HITRACE_TAG_APP",1004);
// Keep the service process running.
console.log(`HITRACE_TAG_APP running`);
// End the third trace task.
hitrace.finishTrace("HITRACE_TAG_APP",1004);
})
}
.width('100%')
}
.height('100%')
}
}
```
3. Click the run button on the application page. Then, run the following commands in sequence in shell:
```shell
hdc shell
hitrace --trace_begin app
```
After the trace command is executed, call the hiTraceMeter APIs in your own service logic on the device. Then, run the following commands in sequence:
```shell
hitrace --trace_dump | grep tracing_mark_write
hitrace --trace_finish
```
The following is an example of the captured trace data:
@@ -168,28 +168,28 @@ You must install **Node.js** and HPM on your local PC. The installation procedur
...
@@ -168,28 +168,28 @@ You must install **Node.js** and HPM on your local PC. The installation procedur
To ensure the download performance, you are advised to download the source code or the corresponding solution from the image library of the respective site listed in the table below.
To ensure the download performance, you are advised to download the source code or the corresponding solution from the image library of the respective site listed in the table below.
The table below provides only the sites for downloading the latest OpenHarmony LTS code. For details about how to obtain the source code of earlier versions, see the [Release Notes]([Release Notes](../../release-notes/Readme.md).
The table below provides only the sites for downloading the latest OpenHarmony LTS code. For details about how to obtain the source code of earlier versions, see the [Release Notes](../../release-notes/Readme.md).
| Full code base (for mini, small, and standard systems)| 3.0 | [Download](https://repo.huaweicloud.com/openharmony/os/3.0/code-v3.0-LTS.tar.gz) | [Download](https://repo.huaweicloud.com/openharmony/os/3.0/code-v3.0-LTS.tar.gz.sha256)|
| Full code base (for mini, small, and standard systems)| 3.0 | [Download](https://repo.huaweicloud.com/openharmony/os/3.0/code-v3.0-LTS.tar.gz) | [Download](https://repo.huaweicloud.com/openharmony/os/3.0/code-v3.0-LTS.tar.gz.sha256)| 7.0 GB |
| Standard system solution (binary)| 3.0 | [Download](https://repo.huaweicloud.com/openharmony/os/3.0/standard.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.0/standard.tar.gz.sha256)|
| Standard system solution (binary)| 3.0 | [Download](https://repo.huaweicloud.com/openharmony/os/3.0/standard.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.0/standard.tar.gz.sha256)| 973.7 MB |
| **Source code of the Latest Release**| **Version Information**| **Site**| **SHA-256 Verification Code**|
| **Source Code of the Latest Release**| **Version**| **Site**| **SHA-256 Checksum**| **Software Package Size**|
| Full code base (for mini, small, and standard systems)| 3.2 Beta3 | [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Beta3/code-v3.2-Beta3.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Beta3/code-v3.2-Beta3.tar.gz.sha256)|
| Full code base (for mini, small, and standard systems)| 3.2 Beta4 | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta4/code-v3.2-Beta4.tar.gz) | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta4/code-v3.2-Beta4.tar.gz.sha256) | 19.0 GB |
| RK3568 standard system solution (binary)| 3.2 Beta3 | [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Beta3/standard_rk3568.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/standard_rk3568.tar.gz.sha256)|
| RK3568 standard system solution (binary)| 3.2 Beta4 | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta4/dayu200_standard_arm32.tar.gz) | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta4/dayu200_standard_arm32.tar.gz.sha256) | 3.2 GB |
| foundation | Basic system capability subsystem set.|
<tdclass="cellrowborder"valign="top"width="50%"headers="mcps1.2.3.1.2 "><pid="p090352912914"><aname="p090352912914"></a><aname="p090352912914"></a>Application samples, for example, <strongid="b689814231158"><aname="b689814231158"></a><aname="b689814231158"></a>camera</strong></p>
<tdclass="cellrowborder"valign="top"width="50%"headers="mcps1.2.3.1.2 "><pid="p790472962914"><aname="p790472962914"></a><aname="p790472962914"></a>Basic software service subsystem set and hardware service subsystem set</p>
<tdclass="cellrowborder"valign="top"width="50%"headers="mcps1.2.3.1.2 "><pid="p390492919296"><aname="p390492919296"></a><aname="p390492919296"></a>Compiler and toolchain subsystem</p>
<tdclass="cellrowborder"valign="top"width="50%"headers="mcps1.2.3.1.2 "><pid="p690412296297"><aname="p690412296297"></a><aname="p690412296297"></a>Commonly used development tools</p>