diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/.gitignore b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/.gitignore
@@ -0,0 +1,12 @@
+/node_modules
+/oh_modules
+/local.properties
+/.idea
+**/build
+/.hvigor
+.cxx
+/.clangd
+/.clang-format
+/.clang-tidy
+**/.test
+/.appanalyzer
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/AppScope/app.json5 b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..0e0f8bfa173bec8dd0236856732c2d614854bbf7
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "bundleName": "com.samples.apprecovery",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/AppScope/resources/base/element/string.json b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..63740d5bca63c2f9ef3a1583ee3e28b2fe5c798a
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "ApplyRecovery"
+ }
+ ]
+}
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/AppScope/resources/base/media/app_icon.png b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3
Binary files /dev/null and b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/AppScope/resources/base/media/app_icon.png differ
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/README_zh.md b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/README_zh.md
new file mode 100644
index 0000000000000000000000000000000000000000..2c5f67b445112e4da58e57e931bcda3998904874
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/README_zh.md
@@ -0,0 +1,67 @@
+# 应用恢复开发指导
+
+### 介绍
+
+本示例主要展示了应用恢复相关的功能,应用在运行中不可避免会产生一些非预期的行为,如运行时抛出未处理的异常和错误,违反框架的调用/运行约束等。
+
+系统默认对异常的处理方式为进程退出,如果应用使用过程中产生了用户数据,直接退出可能会导致用户工作中断,数据丢失。 如果应用在[AbilityStage](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/reference/apis-ability-kit/js-apis-app-ability-abilityStage.md)中使能[应用恢复功能](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/apprecovery-guidelines.md#应用恢复接口功能介绍),并对临时数据进行保存,应用非预期退出后的下一次启动会恢复先前的状态和数据,给用户更连贯的使用体验。这里状态包括应用的页面栈以及onSaveState接口中保存的数据。
+
+### 效果预览
+
+| 主页 |
+| :----------------------------------------------------------: |
+|
|
+
+使用说明
+
+1.在主界面,点击按钮引发崩溃,重启应用;切换到"Log"窗口,日志过滤选择"No filters",搜索内容设置分别为"[Demo]"和"This ability need to recovery"。此时窗口若分别出现下面两句,则验证成功。
+
+```
+[Demo] EntryAbility onSaveState
+This ability need to recovery
+```
+
+
+
+### 工程目录
+
+```
+entry/src/main/ets/
+└─entryability
+| └─---EntryAbility.ets //添加回调函数
+└─pages
+ └─---Index.ets //首页
+```
+
+### 具体实现
+
+- 在EntryAbility.ets中添加应用恢复回调函数,以及启动时恢复判断;
+- 在Index.ets中添加一个按钮并在其点击事件中引发崩溃事件,进而调用应用恢复回调函数。
+
+### 相关权限
+
+不涉及。
+
+### 依赖
+
+不涉及。
+
+### 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备:华为手机。
+2. HarmonyOS系统:HarmonyOS 5.0.2 Release及以上。
+3. HarmonyOS SDK版本:HarmonyOS 5.0.2 Release及以上。
+4. 本示例需要使用DevEco Studio (5.0.3.910)及以上版本才可编译运行。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo PerformanceAnalysisKit/ErrorManage/ApplyRecovery/ > .git/info/sparse-checkout
+git remote add origin https://gitee.com/harmonyos_samples/guide-snippets.git
+git pull origin master
+```
+
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/build-profile.json5 b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..d8c3e12104de496a651cbb5a6ee0536a28b21411
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/build-profile.json5
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.2(14)",
+ "targetSdkVersion": "5.0.2(14)",
+ "runtimeOS": "HarmonyOS"
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/.gitignore b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/build-profile.json5 b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..eed6635f664fa08b992d84590bf62be7e0bb5381
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/build-profile.json5
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/hvigorfile.ts b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/obfuscation-rules.txt b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..69c4d6a8a5531548e4886fa766090c5c157a87d9
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/obfuscation-rules.txt
@@ -0,0 +1,18 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/oh-package.json5 b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c9cb6c8174858277c9b0d465a51547dcab16d5ff
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/ets/entryability/EntryAbility.ets b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..e47fcfedf8047f4b3f0a86e01b55a2adf6a67fe8
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start AppRecovery_All]
+import {
+ AbilityConstant,
+ UIAbility,
+ Want,
+ AbilityStage,
+ appRecovery,
+ errorManager,
+ wantConstant
+} from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+let abilityWant: Want;
+let registerId = -1;
+let callback: errorManager.ErrorObserver = {
+ onUnhandledException(errMsg) {
+ console.log(errMsg);
+ appRecovery.saveAppState();
+ appRecovery.restartApp();
+ }
+}
+
+export default class EntryAbility extends UIAbility {
+ storage: LocalStorage | undefined = undefined;
+
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ appRecovery.enableAppRecovery(appRecovery.RestartFlag.ALWAYS_RESTART,
+ appRecovery.SaveOccasionFlag.SAVE_WHEN_ERROR | appRecovery.SaveOccasionFlag.SAVE_WHEN_BACKGROUND,
+ appRecovery.SaveModeFlag.SAVE_WITH_FILE);
+
+ abilityWant = want;
+ if (launchParam.launchReason == AbilityConstant.LaunchReason.APP_RECOVERY) {
+ this.storage = new LocalStorage();
+ if (want.parameters) {
+ let recoveryData = want.parameters['myData'];
+ this.storage.setOrCreate('myData', recoveryData);
+ this.context.restoreWindowStage(this.storage);
+ }
+ }
+ if (want.parameters === undefined) {
+ return;
+ }
+ if (want.parameters[wantConstant.Params.ABILITY_RECOVERY_RESTART] != undefined &&
+ want.parameters[wantConstant.Params.ABILITY_RECOVERY_RESTART] == true) {
+ console.log('This ability need to recovery');
+ }
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+ registerId = errorManager.on('error', callback);
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy() {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+
+ errorManager.off('error', registerId, (err) => {
+ console.error('[Demo] err:', err);
+ });
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+
+ onSaveState(state: AbilityConstant.StateType, wantParams: Record) {
+ // Ability has called to save app data
+ console.log('[Demo] EntryAbility onSaveState');
+ wantParams['myData'] = 'my1234567';
+ return AbilityConstant.OnSaveResult.ALL_AGREE;
+ }
+}
+// [End AppRecovery_All]
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b1e212947256c5533c7b06285a597c94f840a6e3
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/ets/pages/Index.ets b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c0e905b66d863d60b532028003f988536c928a72
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+@Entry
+@Component
+struct Index {
+ build() {
+ Row() {
+ Column() {
+ Button("AppRecovery")
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('60%')
+ .height('5%')
+ .onClick(() => {
+ // 在按钮点击函数中构造一个crash场景,触发应用崩溃事件
+ JSON.parse('');
+ })
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/module.json5 b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..4a80b0d2f145c2f5bdcdaa687c322f4c5a70586a
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/module.json5
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "recoverable": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/element/color.json b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/element/string.json b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..6d6a85f8bac37b0b5c8ff3d20eb01dcf6ffec23e
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "AppRecovery"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/media/background.png b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/media/background.png differ
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/media/foreground.png b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/media/foreground.png differ
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/media/layered_image.json b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/media/startIcon.png b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/profile/backup_config.json b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/profile/main_pages.json b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/en_US/element/string.json b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..6d6a85f8bac37b0b5c8ff3d20eb01dcf6ffec23e
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "AppRecovery"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/zh_CN/element/string.json b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..9d4f7eb1098ab22502d0bfec985273d000f78880
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "模块描述"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "AppRecovery"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/mock/mock-config.json5 b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b9a78e201535765168a92d3543c690273ecdc019
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/entry/src/mock/mock-config.json5
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/hvigor/hvigor-config.json5 b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..43beb743cbd25c3507b1cf8a744bf8197b3bf2fb
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/hvigor/hvigor-config.json5
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "modelVersion": "5.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/hvigorfile.ts b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2a5e543f190732c159beb574dfc9fa37bc94e156
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/oh-package.json5 b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..952ab183532e81c9c50e5de1e64393704e1e48fe
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "modelVersion": "5.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.18",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/screenshots/Screenshot_20241217182358071.jpeg b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/screenshots/Screenshot_20241217182358071.jpeg
new file mode 100644
index 0000000000000000000000000000000000000000..62abd5dea6ebd4fd6381612c3f17c9cbc62257a6
Binary files /dev/null and b/PerformanceAnalysisKit/ErrorManage/ApplyRecovery/screenshots/Screenshot_20241217182358071.jpeg differ
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/.gitignore b/PerformanceAnalysisKit/ErrorManage/ErrorManage/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/.gitignore
@@ -0,0 +1,12 @@
+/node_modules
+/oh_modules
+/local.properties
+/.idea
+**/build
+/.hvigor
+.cxx
+/.clangd
+/.clang-format
+/.clang-tidy
+**/.test
+/.appanalyzer
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/AppScope/app.json5 b/PerformanceAnalysisKit/ErrorManage/ErrorManage/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c0516a2db5d919853bf6d5c8a2579ec49329ae87
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "bundleName": "com.samples.errormanage",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/AppScope/resources/base/element/string.json b/PerformanceAnalysisKit/ErrorManage/ErrorManage/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..e403ed358693c146d923bccb2f208a2641b24ecd
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "ErrorManage"
+ }
+ ]
+}
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/AppScope/resources/base/media/app_icon.png b/PerformanceAnalysisKit/ErrorManage/ErrorManage/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3
Binary files /dev/null and b/PerformanceAnalysisKit/ErrorManage/ErrorManage/AppScope/resources/base/media/app_icon.png differ
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/README_zh.md b/PerformanceAnalysisKit/ErrorManage/ErrorManage/README_zh.md
new file mode 100644
index 0000000000000000000000000000000000000000..a3846c962310d83f2826c19ea9f73230e83ef790
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/README_zh.md
@@ -0,0 +1,66 @@
+# 错误管理开发指导
+
+### 介绍
+
+本示例主要展示了错误管理相关的功能,当应用的代码存在规范问题或错误时,会在运行中产生异常和错误,如应用未捕获异常、应用生命周期超时等。在错误产生后,应用会异常退出。错误日志通常会保存在用户本地存储上,不方便开发者定位问题。所以,应用开发者可以使用错误管理的接口,在应用退出前,及时将相关错误及日志上报到开发者的服务平台来定位问题。
+
+使用errormanager接口监听异常和错误后,应用不会退出,建议在回调函数执行完后,增加同步退出操作,如果只是为了获取错误日志,建议使用[hiappevent](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hiappevent-watcher-crash-events-arkts.md)。
+
+### 效果预览
+
+| 主页 |
+| :----------------------------------------------------------: |
+|
|
+
+使用说明
+
+1. 在主界面,点击按钮引发崩溃,重启应用;切换到"Log"窗口,日志过滤选择"No filters",搜索内容设置为"onException"。此时窗口仅显示符合条件的日志,打印日志结果为:
+
+```
+onException, name: SyntaxError
+onException, message: Unexpected Text in JSON
+onException, stack: at anonymous (entry/src/main/ets/pages/Index.ets:31:34)
+```
+
+### 工程目录
+
+```
+entry/src/main/ets/
+└─entryability
+| └─---EntryAbility.ets //添加回调函数
+└─pages
+ └─---Index.ets //首页
+```
+
+### 具体实现
+
+- 在EntryAbility.ets中添加错误回调函数;
+- 在Index.ets中添加一个按钮并在其点击事件中引发崩溃事件,进而调用错误管理的回调函数。
+
+### 相关权限
+
+不涉及。
+
+### 依赖
+
+不涉及。
+
+### 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备:华为手机。
+2. HarmonyOS系统:HarmonyOS 5.0.2 Release及以上。
+3. HarmonyOS SDK版本:HarmonyOS 5.0.2 Release及以上。
+4. 本示例需要使用DevEco Studio (5.0.3.910)及以上版本才可编译运行。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo PerformanceAnalysisKit/ErrorManage/ErrorManage/ > .git/info/sparse-checkout
+git remote add origin https://gitee.com/harmonyos_samples/guide-snippets.git
+git pull origin master
+```
+
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/build-profile.json5 b/PerformanceAnalysisKit/ErrorManage/ErrorManage/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..d8c3e12104de496a651cbb5a6ee0536a28b21411
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/build-profile.json5
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.2(14)",
+ "targetSdkVersion": "5.0.2(14)",
+ "runtimeOS": "HarmonyOS"
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/.gitignore b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/build-profile.json5 b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..eed6635f664fa08b992d84590bf62be7e0bb5381
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/build-profile.json5
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/hvigorfile.ts b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/obfuscation-rules.txt b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..69c4d6a8a5531548e4886fa766090c5c157a87d9
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/obfuscation-rules.txt
@@ -0,0 +1,18 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/oh-package.json5 b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c9cb6c8174858277c9b0d465a51547dcab16d5ff
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/ets/entryability/EntryAbility.ets b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..77e08950dfd2c604510d530b1383c6e1406f4c72
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start ErrorManage]
+import { AbilityConstant, errorManager, UIAbility, Want } from '@kit.AbilityKit';
+import { window } from '@kit.ArkUI';
+import process from '@ohos.process';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+
+let registerId = -1; // 初始化registerId
+let callback: errorManager.ErrorObserver = {
+ onUnhandledException: (errMsg) => {
+ console.log(errMsg);
+ },
+ onException: (errorObj) => {
+ console.log('onException, name: ', errorObj.name);
+ console.log('onException, message: ', errorObj.message);
+ if (typeof(errorObj.stack) === 'string') {
+ console.log('onException, stack: ', errorObj.stack);
+ }
+ // 回调函数执行完,采用同步退出方式,避免多次触发
+ let pro = new process.ProcessManager();
+ pro.exit(0);
+ }
+}
+
+let abilityWant: Want;
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ registerId = errorManager.on("error", callback);
+ abilityWant = want;
+ }
+
+ onDestroy() {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ errorManager.off("error", registerId, (result) => {
+ console.log("[Demo] result " + result.code + ";" + result.message);
+ });
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+};
+// [End ErrorManage]
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b1e212947256c5533c7b06285a597c94f840a6e3
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/ets/pages/Index.ets b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..51b3deb6b2c8be7e4f3a0b6c0bc0843a3261f7a8
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+@Entry
+@Component
+struct Index {
+ build() {
+ Row() {
+ Column() {
+ Button("ErrorManage")
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('60%')
+ .height('5%')
+ .onClick(() => {
+ // 在按钮点击函数中构造一个crash场景,触发应用崩溃事件
+ JSON.parse("");
+ })
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/module.json5 b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..4144486d1af4c03b0d767cce1cda86fc0d697f91
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/module.json5
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/element/color.json b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/element/string.json b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..ecc10e328caec151d8067992a6edb84fe799ddb9
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "ErrorManage"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/media/background.png b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/media/background.png differ
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/media/foreground.png b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/media/foreground.png differ
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/media/layered_image.json b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/media/startIcon.png b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/profile/backup_config.json b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/profile/main_pages.json b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/en_US/element/string.json b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..ecc10e328caec151d8067992a6edb84fe799ddb9
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "ErrorManage"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/zh_CN/element/string.json b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..4903663cbd3831dfdf72653d0f3ee7ec1e7f11e5
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "模块描述"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "ErrorManage"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/mock/mock-config.json5 b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b9a78e201535765168a92d3543c690273ecdc019
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/entry/src/mock/mock-config.json5
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/hvigor/hvigor-config.json5 b/PerformanceAnalysisKit/ErrorManage/ErrorManage/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..43beb743cbd25c3507b1cf8a744bf8197b3bf2fb
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/hvigor/hvigor-config.json5
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "modelVersion": "5.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/hvigorfile.ts b/PerformanceAnalysisKit/ErrorManage/ErrorManage/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2a5e543f190732c159beb574dfc9fa37bc94e156
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/oh-package.json5 b/PerformanceAnalysisKit/ErrorManage/ErrorManage/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..952ab183532e81c9c50e5de1e64393704e1e48fe
--- /dev/null
+++ b/PerformanceAnalysisKit/ErrorManage/ErrorManage/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "modelVersion": "5.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.18",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/PerformanceAnalysisKit/ErrorManage/ErrorManage/screenshots/Screenshot_20241217180226713.jpeg b/PerformanceAnalysisKit/ErrorManage/ErrorManage/screenshots/Screenshot_20241217180226713.jpeg
new file mode 100644
index 0000000000000000000000000000000000000000..0c9f085e88375b4c4cdfbc024abad7baf6d4499e
Binary files /dev/null and b/PerformanceAnalysisKit/ErrorManage/ErrorManage/screenshots/Screenshot_20241217180226713.jpeg differ
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/.gitignore b/PerformanceAnalysisKit/HiAppEvent/EventEsc/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/.gitignore
@@ -0,0 +1,12 @@
+/node_modules
+/oh_modules
+/local.properties
+/.idea
+**/build
+/.hvigor
+.cxx
+/.clangd
+/.clang-format
+/.clang-tidy
+**/.test
+/.appanalyzer
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/AppScope/app.json5 b/PerformanceAnalysisKit/HiAppEvent/EventEsc/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..158a2d7f5aca19b734b3387c1959d3852b0b0086
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "bundleName": "com.samples.eventesc",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/AppScope/resources/base/element/string.json b/PerformanceAnalysisKit/HiAppEvent/EventEsc/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..388bdebd5e685814944a142ab7286cefd7c32f59
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "EventEsc"
+ }
+ ]
+}
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/AppScope/resources/base/media/app_icon.png b/PerformanceAnalysisKit/HiAppEvent/EventEsc/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3
Binary files /dev/null and b/PerformanceAnalysisKit/HiAppEvent/EventEsc/AppScope/resources/base/media/app_icon.png differ
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/README_zh.md b/PerformanceAnalysisKit/HiAppEvent/EventEsc/README_zh.md
new file mode 100644
index 0000000000000000000000000000000000000000..39b1db4e0421727adf846c8b847c55ff676d7dc8
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/README_zh.md
@@ -0,0 +1,76 @@
+# 事件上报
+
+### 介绍
+
+本示例主要展示了使用事件上报相关的功能,HiAppEvent提供接口用于处理中上报事件。
+
+该工程中的展示的代码详细描述可查如下链接:
+
+- [事件上报](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hiappevent-event-reporting.md)
+
+### 效果预览
+
+| 主页 |
+| :----------------------------------------------------------: |
+|
|
+
+使用说明
+
+1.在应用侧主界面,从上至下依次点击按钮;
+2.在DevEco Studio侧下方导航栏,切换到"Log"窗口,日志过滤选择"No filters",搜索内容设置为"testTag"。此时窗口仅显示符合条件的日志,打印日志结果为:
+
+```
+// 点击addProcessorTest,无输出
+
+// 点击userIdTest
+userId: 123456
+// 点击userPropertyTest
+userProperty: 123456
+// 点击writeTest
+HiAppEvent success to write event
+// 点击removeProcessorTest,无输出
+
+```
+
+### 工程目录
+
+```
+entry/src/main/ets/
+└─pages
+ └─---Index.ets // 首页
+```
+
+### 具体实现
+
+1.添加一个按钮并在其onClick函数中添加数据处理者;
+2.添加一个按钮并在其onClick函数中添加并查看用户ID;
+3.添加一个按钮并在其onClick函数中添加并查看用户属性;
+4.添加一个按钮并在其onClick函数中进行事件打点,以记录按钮点击事件;
+5.添加一个按钮并在其onClick函数中进行数据处理者移除(第二步已完成数据处理者添加)。
+
+### 相关权限
+
+不涉及。
+
+### 依赖
+
+不涉及。
+
+### 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备:华为手机。
+2. HarmonyOS系统:HarmonyOS 5.0.2 Release及以上。
+3. HarmonyOS SDK版本:HarmonyOS 5.0.2 Release及以上。
+4. 本示例需要使用DevEco Studio(5.0.3.910)及以上版本才可编译运行。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo PerformanceAnalysisKit/HiAppEvent/EventEsc/ > .git/info/sparse-checkout
+git remote add origin https://gitee.com/harmonyos_samples/guide-snippets.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/build-profile.json5 b/PerformanceAnalysisKit/HiAppEvent/EventEsc/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..2c6a725edfa122f84fcc2e084988c5639f83301d
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/build-profile.json5
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.2(14)",
+ "targetSdkVersion": "5.0.2(14)",
+ "runtimeOS": "HarmonyOS",
+ "buildOption": {
+ "strictMode": {
+ "caseSensitiveCheck": true,
+ "useNormalizedOHMUrl": true
+ }
+ }
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/.gitignore b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/build-profile.json5 b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..f46d585f002f76ce6e57cffcfdc31ba04241c229
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/build-profile.json5
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/hvigorfile.ts b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e042e3f963ab27941d3b34f1f027da9933b81df1
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/obfuscation-rules.txt b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..69c4d6a8a5531548e4886fa766090c5c157a87d9
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/obfuscation-rules.txt
@@ -0,0 +1,18 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/oh-package.json5 b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..dbacc308e4f7758a11b72c6a2af812b2471a0e8a
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/ets/entryability/EntryAbility.ets b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..82e98bec44d83d2df03deb52508045cb06cc8604
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+}
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..29feaca7669174be5c2b0e2366529ee94ab7e726
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/ets/pages/Index.ets b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f772d6af80796a721b323af8cbcbc38e4a5261db
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start EventEsc_Header_And_Add_Processor]
+import { BusinessError } from '@kit.BasicServicesKit';
+import { hiAppEvent, hilog } from '@kit.PerformanceAnalysisKit';
+
+@Entry
+@Component
+struct Index {
+ processorId: number = -1 // 初始化processorId为-1
+
+ build() {
+ Row() {
+ Column() {
+ Button($r('app.string.AddProcessorTest_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('50%')
+ .height('5%')
+ .onClick(() => {
+ // 在按钮点击函数中进行数据处理者添加
+ let eventConfig: hiAppEvent.AppEventReportConfig = {
+ domain: 'button',
+ name: 'click',
+ isRealTime: true
+ };
+ let processor: hiAppEvent.Processor = {
+ name: 'analytics_demo',
+ debugMode: true,
+ routeInfo: 'CN',
+ onStartReport: true,
+ onBackgroundReport: true,
+ periodReport: 10,
+ batchReport: 5,
+ userIds: ['testUserIdName'],
+ userProperties: ['testUserPropertyName'],
+ eventConfigs: [eventConfig]
+ };
+ this.processorId = hiAppEvent.addProcessor(processor);
+ })
+ // [StartExclude EventEsc_Header_And_Add_Processor]
+ // [Start Button_Add_ID]
+ Button($r('app.string.UserIdTest_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('40%')
+ .height('5%')
+ .onClick(() => {
+ // 在按钮点击函数中设置用户ID
+ hiAppEvent.setUserId('testUserIdName', '123456');
+
+ // 在按钮点击函数中获取刚设置的用户ID
+ let userId = hiAppEvent.getUserId('testUserIdName');
+ hilog.info(0x0000, 'testTag', `userId: ${userId}`)
+ })
+ // [End Button_Add_ID]
+ // [Start Button_Add_Property]
+ Button($r('app.string.UserPropertyTest_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('50%')
+ .height('5%')
+ .onClick(() => {
+ // 在按钮点击函数中设置用户属性值
+ hiAppEvent.setUserProperty('testUserPropertyName', '123456');
+
+ // 在按钮点击函数中获取刚设置的用户属性值
+ let userProperty = hiAppEvent.getUserProperty('testUserPropertyName');
+ hilog.info(0x0000, 'testTag', `userProperty: ${userProperty}`)
+ })
+ // [End Button_Add_Property]
+ // [Start Button_Add_Event]
+ Button($r('app.string.WriteTest_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('40%')
+ .height('5%')
+ .onClick(() => {
+ // 在按钮点击函数中进行事件打点,以记录按钮点击事件
+ let eventParams: Record = { 'click_time': 100 };
+ let eventInfo: hiAppEvent.AppEventInfo = {
+ // 事件领域定义
+ domain: "button",
+ // 事件名称定义
+ name: "click",
+ // 事件类型定义
+ eventType: hiAppEvent.EventType.BEHAVIOR,
+ // 事件参数定义
+ params: eventParams,
+ };
+ hiAppEvent.write(eventInfo).then(() => {
+ hilog.info(0x0000, 'testTag', `HiAppEvent success to write event`)
+ }).catch((err: BusinessError) => {
+ hilog.error(0x0000, 'testTag', `HiAppEvent err.code: ${err.code}, err.message: ${err.message}`)
+ });
+ })
+ // [End Button_Add_Event]
+ // [Start Button_Remove_Processor]
+ Button($r('app.string.RemoveProcessorTest_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('60%')
+ .height('5%')
+ .onClick(() => {
+ // 在按钮点击函数中进行数据处理者移除
+ hiAppEvent.removeProcessor(this.processorId);
+ })
+ // [End Button_Remove_Processor]
+ // [EndExclude EventEsc_Header_And_Add_Processor]
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
+// [End EventEsc_Header_And_Add_Processor]
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/module.json5 b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9f7f873fbc51484895e18fcfd60b2498521aecb0
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/module.json5
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/element/color.json b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/element/string.json b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..0c21acc2f487e2b9bae5d52feec0b0bb9d3fb9a3
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,36 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "EventEsc"
+ },
+ {
+ "name": "AddProcessorTest_Button",
+ "value": "addProcessorTest"
+ },
+ {
+ "name": "UserIdTest_Button",
+ "value": "userIdTest"
+ },
+ {
+ "name": "UserPropertyTest_Button",
+ "value": "userPropertyTest"
+ },
+ {
+ "name": "WriteTest_Button",
+ "value": "writeTest"
+ },
+ {
+ "name": "RemoveProcessorTest_Button",
+ "value": "removeProcessorTest"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/media/background.png b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/media/background.png differ
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/media/foreground.png b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/media/foreground.png differ
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/media/layered_image.json b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/media/startIcon.png b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/profile/backup_config.json b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/profile/main_pages.json b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/en_US/element/string.json b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..0c21acc2f487e2b9bae5d52feec0b0bb9d3fb9a3
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,36 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "EventEsc"
+ },
+ {
+ "name": "AddProcessorTest_Button",
+ "value": "addProcessorTest"
+ },
+ {
+ "name": "UserIdTest_Button",
+ "value": "userIdTest"
+ },
+ {
+ "name": "UserPropertyTest_Button",
+ "value": "userPropertyTest"
+ },
+ {
+ "name": "WriteTest_Button",
+ "value": "writeTest"
+ },
+ {
+ "name": "RemoveProcessorTest_Button",
+ "value": "removeProcessorTest"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/zh_CN/element/string.json b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..2b9798060940a537af7f583ebc70dc6a7d7d6cb5
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,36 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "模块描述"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "EventEsc"
+ },
+ {
+ "name": "AddProcessorTest_Button",
+ "value": "addProcessorTest"
+ },
+ {
+ "name": "UserIdTest_Button",
+ "value": "userIdTest"
+ },
+ {
+ "name": "UserPropertyTest_Button",
+ "value": "userPropertyTest"
+ },
+ {
+ "name": "WriteTest_Button",
+ "value": "writeTest"
+ },
+ {
+ "name": "RemoveProcessorTest_Button",
+ "value": "removeProcessorTest"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/mock/mock-config.json5 b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..a99e1d70a555e9935e93519642bb8d05bcb5a149
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/entry/src/mock/mock-config.json5
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/hvigor/hvigor-config.json5 b/PerformanceAnalysisKit/HiAppEvent/EventEsc/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..a2c44fdf8f9ac103168672568ff000ac395a2edc
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/hvigor/hvigor-config.json5
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "modelVersion": "5.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/hvigorfile.ts b/PerformanceAnalysisKit/HiAppEvent/EventEsc/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..79d8761856e2996edc0649eca63b96b2c883b28a
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/oh-package.json5 b/PerformanceAnalysisKit/HiAppEvent/EventEsc/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b7f346f7ddb2fc98ac428c55207a63ff89ea1c70
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "modelVersion": "5.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.18",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/ohosTest.md b/PerformanceAnalysisKit/HiAppEvent/EventEsc/ohosTest.md
new file mode 100644
index 0000000000000000000000000000000000000000..1a3e169730c72d7b191be9c90c8b013530413ed4
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventEsc/ohosTest.md
@@ -0,0 +1,8 @@
+
+
+# EventEsc测试用例归档
+
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 |
+| ------------ | ------------ | ------------ | ------------ | -------- | -------- |
+| 拉起应用 | 设备正常运行 | | 成功拉起应用 | 否 | Pass |
+| 主页按钮点击 | 位于主页 | 依次点击按钮 | 输出预期日志 | 否 | Pass |
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventEsc/screenshots/Screenshot_20241217155644259.jpeg b/PerformanceAnalysisKit/HiAppEvent/EventEsc/screenshots/Screenshot_20241217155644259.jpeg
new file mode 100644
index 0000000000000000000000000000000000000000..cf137c8006bb1155f12141495e2b050a02a39071
Binary files /dev/null and b/PerformanceAnalysisKit/HiAppEvent/EventEsc/screenshots/Screenshot_20241217155644259.jpeg differ
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/.gitignore b/PerformanceAnalysisKit/HiAppEvent/EventSub/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/.gitignore
@@ -0,0 +1,12 @@
+/node_modules
+/oh_modules
+/local.properties
+/.idea
+**/build
+/.hvigor
+.cxx
+/.clangd
+/.clang-format
+/.clang-tidy
+**/.test
+/.appanalyzer
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/AppScope/app.json5 b/PerformanceAnalysisKit/HiAppEvent/EventSub/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..11ec180f4bdd0479c366174be005d029057fa76b
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "bundleName": "com.samples.eventsub",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/AppScope/resources/base/element/string.json b/PerformanceAnalysisKit/HiAppEvent/EventSub/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..5e8cd8a19f7473dae53e6273e9b38ea3e70d4f4e
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "EventSub"
+ }
+ ]
+}
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/AppScope/resources/base/media/app_icon.png b/PerformanceAnalysisKit/HiAppEvent/EventSub/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3
Binary files /dev/null and b/PerformanceAnalysisKit/HiAppEvent/EventSub/AppScope/resources/base/media/app_icon.png differ
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/README_zh.md b/PerformanceAnalysisKit/HiAppEvent/EventSub/README_zh.md
new file mode 100644
index 0000000000000000000000000000000000000000..df9b3ebd1191952016c0ab4e4e52e7c19103671e
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/README_zh.md
@@ -0,0 +1,476 @@
+# 事件订阅
+
+### 介绍
+
+本示例主要展示了使用HiAppEvent提供的事件订阅接口,获取本地应用事件(AppEvent),系统崩溃事件(CrashEvent),系统卡死事件(FreezeEvent),系统资源泄漏事件(PssLeakEvent),系统踩内存事件(ASANEvent)以及主线程超时事件(TimeOutEvent)。
+
+该工程中的展示的代码详细描述可查如下链接:
+
+- [订阅应用事件(ArkTS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hiappevent-watcher-app-events-arkts.md)
+
+- [订阅应用事件(C/C++)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hiappevent-watcher-app-events-ndk.md)
+
+- [订阅崩溃事件(ArkTS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hiappevent-watcher-crash-events-arkts.md)
+
+- [订阅崩溃事件(C/C++)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hiappevent-watcher-crash-events-ndk.md)
+
+- [订阅卡死事件(ArkTS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hiappevent-watcher-freeze-events-arkts.md)
+
+- [订阅卡死事件(C/C++)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hiappevent-watcher-freeze-events-ndk.md)
+
+- [订阅资源泄漏事件(ArkTS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hiappevent-watcher-resourceleak-events-arkts.md)
+
+- [订阅资源泄漏事件(C/C++)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hiappevent-watcher-resourceleak-events-ndk.md)
+
+- [订阅踩内存事件(ArkTS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hiappevent-watcher-address-sanitizer-events-arkts.md)
+
+- [订阅踩内存事件(C/C++)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hiappevent-watcher-address-sanitizer-events-ndk.md)
+
+- [订阅主线程超时事件(ArkTS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hiappevent-watcher-mainthreadjank-events-arkts.md)
+
+- [订阅主线程超时事件(C/C++)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hiappevent-watcher-mainthreadjank-events-ndk.md)
+
+### 效果预览
+
+| 主页 |
+| :----------------------------------------------------------: |
+|
|
+
+#### 使用说明
+
+请先按照工程目录添加三方库文件jsoncpp相关文件,否则编译无法通过;jsoncpp官方下载地址为https://github.com/open-source-parsers/jsoncpp,下载完成后在文件夹内运行python脚本“amalgamate.py”(需要有python环境),脚本运行完成后将生成名为“dist”的文件夹,打开后即可得到jsoncpp.cpp,json.h和json-forward.h三个文件。
+
+##### 1.订阅应用事件(ArkTS)使用说明
+
+1.在应用侧主界面,点击"writeEvent ArkTS"按钮,从ets层触发一次按钮点击事件打点;
+
+2.在DevEco Studio侧下方导航栏,切换到"Log"窗口,日志过滤选择"All log of selected app",搜索内容设置为"testTag"。此时窗口仅显示符合条件的日志,打印日志结果为:
+
+```
+HiAppEvent eventInfo.WatcherType=OnReceive
+HiAppEvent eventInfo.domain=button
+HiAppEvent eventInfo.name=click
+HiAppEvent eventInfo.eventType=4
+readEvent C++ Success // C++读事件成功
+HiAppEvent eventInfo.params.click_time=100
+HiAppEvent eventInfo.WatcherType=OnTrigger
+HiAppEvent eventInfo.domain=button
+HiAppEvent eventInfo.name=click
+HiAppEvent eventInfo.eventType=4
+HiAppEvent eventInfo.params.click_time=100
+writeEvent ArkTS success // ArkTS写事件成功
+HiAppEvent onTrigger: curRow=1, curSize=124
+readEvent ArkTS Success // ArkTS读事件成功
+HiAppEvent eventPkg.packageId=0
+HiAppEvent eventPkg.row=1
+HiAppEvent eventPkg.size=124
+HiAppEvent eventPkg.info={"domain_":"button","name_":"click","type_":4,"time_":1501889519611,"tz_":"+0800","pid_":2579,"tid_":2579,"click_time":100
+```
+
+注意:
+
+1.出现C++读事件成功的原因是本示例中ArkTS和C++写的打点事件是相同的,故读取时均能读到,不影响结果。
+
+2.C++读事件比ArkTS写事件先出现的原因可能是C++层的日志打印执行速度更快,不影响结果。
+
+##### 2.订阅应用事件(C/C++)使用说明
+
+1.在应用侧主界面,点击"writeEvent C++"按钮,从c++层触发一次按钮点击事件打点;
+
+2.在DevEco Studio侧下方导航栏,切换到"Log"窗口,日志过滤选择"All log of selected app",搜索内容设置为"testTag"。此时窗口仅显示符合条件的日志,打印日志结果为:
+
+```
+writeEvent C++ success // C++写事件成功
+HiAppEvent eventInfo.WatcherType=OnReceive
+HiAppEvent eventInfo.domain=button
+HiAppEvent eventInfo.name=click
+HiAppEvent eventInfo.eventType=4
+readEvent C++ Success // C++读事件成功
+HiAppEvent eventInfo.params.click_time=1501890218
+HiAppEvent eventInfo.WatcherType=OnTrigger
+HiAppEvent eventInfo.domain=button
+HiAppEvent eventInfo.name=click
+HiAppEvent eventInfo.eventType=4
+HiAppEvent eventInfo.params.click_time=1501890218
+HiAppEvent onTrigger: curRow=1, curSize=131
+readEvent ArkTS Success // ArkTS读事件成功
+HiAppEvent eventPkg.packageId=2
+HiAppEvent eventPkg.row=1
+HiAppEvent eventPkg.size=131
+HiAppEvent eventPkg.info={"domain_":"button","name_":"click","type_":4,"time_":1501890218641,"tz_":"+0800","pid_":2579,"tid_":2579,"click_time":1501890218}
+```
+
+注意:
+
+1.出现ArkTS读事件成功的原因是本示例中ArkTS和C++写、读的打点事件是相同的,故读取时均能读到,不影响结果。
+
+##### 3.订阅崩溃事件(ArkTS&C++)
+
+1.在应用侧主界面,点击"appCrash ArkTS&C++"按钮触发崩溃,应用退出后重启应用;
+
+2.在DevEco Studio侧下方导航栏,切换到"Log"窗口,日志过滤选择"All log of selected app",搜索内容设置为"HiAppevent"。此时窗口仅显示符合条件的日志,打印日志结果为:
+
+```
+HiAppEvent eventInfo.WatcherType=OnTrigger
+HiAppEvent eventInfo.domain=OS
+HiAppEvent eventInfo.name=APP_CRASH
+HiAppEvent eventInfo.eventType=1
+HiAppEvent eventInfo.params.time=1501890680817
+HiAppEvent eventInfo.params.crash_type=JsError
+HiAppEvent eventInfo.params.foreground=1
+HiAppEvent eventInfo.params.bundle_version=1.0.0
+HiAppEvent eventInfo.params.bundle_name=com.samples.eventsub
+HiAppEvent eventInfo.params.pid=2579
+HiAppEvent eventInfo.params.uid=20010051
+HiAppEvent eventInfo.params.uuid=114e22cab85a934b58dca7442edb14bad4301a7fe9a4f5ee5c662c557ada08b1
+HiAppEvent eventInfo.params.exception={"message":"Unexpected Text in JSON: Empty Text","name":"SyntaxError","stack":" at anonymous entry (entry/src/main/ets/pages/Index.ets:65:13)\n"}
+HiAppEvent eventInfo.params.hilog.size=100
+HiAppEvent eventInfo.params.external_log=["/data/storage/el2/log/hiappevent/APP_CRASH_1501890680961_2579.log"]
+HiAppEvent eventInfo.params.log_over_limit=0
+// 以上为C++ onTrigger类型观察者日志输出
+HiAppEvent eventInfo.WatcherType=OnReceive
+HiAppEvent eventInfo.domain=OS
+HiAppEvent eventInfo.name=APP_CRASH
+HiAppEvent eventInfo.eventType=1
+HiAppEvent eventInfo.params.time=1501890680817
+HiAppEvent eventInfo.params.crash_type=JsError
+HiAppEvent eventInfo.params.foreground=1
+HiAppEvent eventInfo.params.bundle_version=1.0.0
+HiAppEvent eventInfo.params.bundle_name=com.samples.eventsub
+HiAppEvent eventInfo.params.pid=2579
+HiAppEvent eventInfo.params.uid=20010051
+HiAppEvent eventInfo.params.uuid=114e22cab85a934b58dca7442edb14bad4301a7fe9a4f5ee5c662c557ada08b1
+HiAppEvent eventInfo.params.exception={"message":"Unexpected Text in JSON: Empty Text","name":"SyntaxError","stack":" at anonymous entry (entry/src/main/ets/pages/Index.ets:65:13)\n"}
+HiAppEvent eventInfo.params.hilog.size=100
+HiAppEvent eventInfo.params.external_log=["/data/storage/el2/log/hiappevent/APP_CRASH_1501890680961_2579.log"]
+HiAppEvent eventInfo.params.log_over_limit=0
+// 以上为C++ onReceive类型观察者日志输出
+HiAppEvent onReceive: domain=OS
+HiAppEvent eventName=APP_CRASH
+HiAppEvent eventInfo.domain=OS
+HiAppEvent eventInfo.name=APP_CRASH
+HiAppEvent eventInfo.eventType=1
+HiAppEvent eventInfo.params.time=1501890680817
+HiAppEvent eventInfo.params.crash_type=JsError
+HiAppEvent eventInfo.params.foreground=true
+HiAppEvent eventInfo.params.bundle_version=1.0.0
+HiAppEvent eventInfo.params.bundle_name=com.samples.eventsub
+HiAppEvent eventInfo.params.pid=2579
+HiAppEvent eventInfo.params.uid=20010051
+HiAppEvent eventInfo.params.uuid=114e22cab85a934b58dca7442edb14bad4301a7fe9a4f5ee5c662c557ada08b1
+HiAppEvent eventInfo.params.exception={"message":"Unexpected Text in JSON: Empty Text","name":"SyntaxError","stack":" at anonymous entry (entry/src/main/ets/pages/Index.ets:65:13)\n"}
+HiAppEvent eventInfo.params.hilog.size=100
+HiAppEvent eventInfo.params.external_log=["/data/storage/el2/log/hiappevent/APP_CRASH_1501890680961_2579.log"]
+HiAppEvent eventInfo.params.log_over_limit=false
+HiAppEvent eventInfo.params.test_data=100
+// 以上为ArkTS onReceive类型观察者日志输出
+```
+
+注意:
+
+1.要确认日志输出中的eventInfo.name为APP_CRASH。
+
+2.C++实现了onReceive和onTrigger两种观察者,ArkTS实现了onReceive观察者。
+
+##### 4.订阅卡死事件(ArkTS&C++)
+
+1.在应用侧主界面,点击"appFreeze ArkTS&C++"按钮触发卡死(可能需要几秒),应用退出后重启应用;
+
+2.在DevEco Studio侧下方导航栏,切换到"Log"窗口,日志过滤选择"All log of selected app",搜索内容设置为"HiAppevent"。此时窗口仅显示符合条件的日志,打印日志结果为:
+
+```
+HiAppEvent eventInfo.WatcherType=OnReceive
+HiAppEvent eventInfo.domain=OS
+HiAppEvent eventInfo.name=APP_FREEZE
+HiAppEvent eventInfo.eventType=1
+HiAppEvent eventInfo.params.time=1501891964864
+HiAppEvent eventInfo.params.foreground=1
+HiAppEvent eventInfo.params.bundle_version=1.0.0
+HiAppEvent eventInfo.params.bundle_name=com.samples.eventsub
+HiAppEvent eventInfo.params.process_name=com.samples.eventsub
+HiAppEvent eventInfo.params.pid=5105
+HiAppEvent eventInfo.params.uid=20010051
+HiAppEvent eventInfo.params.uuid=c450b09dcefc0f9bd9b6cb4230e0c8f2d1b1e3c5becf82d272ef1a3241c958da
+HiAppEvent eventInfo.params.exception={"message":"App main thread is not response!","name":"THREAD_BLOCK_6S"}
+HiAppEvent eventInfo.params.hilog.size=88
+HiAppEvent eventInfo.params.event_handler.size=0
+HiAppEvent eventInfo.params.event_handler_3s.size=0
+HiAppEvent eventInfo.params.event_handler_6s.size=0
+HiAppEvent eventInfo.params.peer_binder.size=0
+HiAppEvent eventInfo.params.threads.size=38
+HiAppEvent eventInfo.params.memory={"pss":0,"rss":0,"sys_avail_mem":1000060,"sys_free_mem":485304,"sys_total_mem":1935816,"vss":0}
+HiAppEvent eventInfo.params.external_log=["/data/storage/el2/log/hiappevent/APP_FREEZE_1501891977850_5105.log"]
+HiAppEvent eventInfo.params.log_over_limit=0
+// 以上为C++ onReceive类型观察者日志输出
+HiAppEvent eventInfo.WatcherType=OnTrigger
+HiAppEvent eventInfo.domain=OS
+HiAppEvent eventInfo.name=APP_FREEZE
+HiAppEvent eventInfo.eventType=1
+HiAppEvent eventInfo.params.time=1501891964864
+HiAppEvent eventInfo.params.foreground=1
+HiAppEvent eventInfo.params.bundle_version=1.0.0
+HiAppEvent eventInfo.params.bundle_name=com.samples.eventsub
+HiAppEvent eventInfo.params.process_name=com.samples.eventsub
+HiAppEvent eventInfo.params.pid=5105
+HiAppEvent eventInfo.params.uid=20010051
+HiAppEvent eventInfo.params.uuid=c450b09dcefc0f9bd9b6cb4230e0c8f2d1b1e3c5becf82d272ef1a3241c958da
+HiAppEvent eventInfo.params.exception={"message":"App main thread is not response!","name":"THREAD_BLOCK_6S"}
+HiAppEvent eventInfo.params.hilog.size=88
+HiAppEvent eventInfo.params.event_handler.size=0
+HiAppEvent eventInfo.params.event_handler_3s.size=0
+HiAppEvent eventInfo.params.event_handler_6s.size=0
+HiAppEvent eventInfo.params.peer_binder.size=0
+HiAppEvent eventInfo.params.threads.size=38
+HiAppEvent eventInfo.params.memory={"pss":0,"rss":0,"sys_avail_mem":1000060,"sys_free_mem":485304,"sys_total_mem":1935816,"vss":0}
+HiAppEvent eventInfo.params.external_log=["/data/storage/el2/log/hiappevent/APP_FREEZE_1501891977850_5105.log"]
+HiAppEvent eventInfo.params.log_over_limit=0
+// 以上为C++ onTrigger类型观察者日志输出
+HiAppEvent onReceive: domain=OS
+HiAppEvent eventName=APP_FREEZE
+HiAppEvent eventInfo.domain=OS
+HiAppEvent eventInfo.name=APP_FREEZE
+HiAppEvent eventInfo.eventType=1
+HiAppEvent eventInfo.params.time=1501891964864
+HiAppEvent eventInfo.params.foreground=true
+HiAppEvent eventInfo.params.bundle_version=1.0.0
+HiAppEvent eventInfo.params.bundle_name=com.samples.eventsub
+HiAppEvent eventInfo.params.process_name=com.samples.eventsub
+HiAppEvent eventInfo.params.pid=5105
+HiAppEvent eventInfo.params.uid=20010051
+HiAppEvent eventInfo.params.uuid=c450b09dcefc0f9bd9b6cb4230e0c8f2d1b1e3c5becf82d272ef1a3241c958da
+HiAppEvent eventInfo.params.exception={"message":"App main thread is not response!","name":"THREAD_BLOCK_6S"}
+HiAppEvent eventInfo.params.hilog.size=88
+HiAppEvent eventInfo.params.event_handler.size=0
+HiAppEvent eventInfo.params.event_handler_size_3s=0
+HiAppEvent eventInfo.params.event_handler_size_6s=0
+HiAppEvent eventInfo.params.peer_binder.size=0
+HiAppEvent eventInfo.params.threads.size=38
+HiAppEvent eventInfo.params.memory={"pss":0,"rss":0,"sys_avail_mem":1000060,"sys_free_mem":485304,"sys_total_mem":1935816,"vss":0}
+HiAppEvent eventInfo.params.external_log=["/data/storage/el2/log/hiappevent/APP_FREEZE_1501891977850_5105.log"]
+HiAppEvent eventInfo.params.log_over_limit=false
+HiAppEvent eventInfo.params.test_data=100
+// 以上为ArkTS onReceive类型观察者日志输出
+```
+
+注意:
+
+1.如果在应用重启时立即在log窗口搜索日志会出现日志暂时未出现的情况,原因是Freeze事件处理时间较长,等待10秒即可。
+
+2.要确认日志输出中的eventInfo.name为APP_FREEZE。
+
+3.C++实现了onReceive和onTrigger两种观察者,ArkTS实现了onReceive观察者。
+
+##### 5.订阅资源泄漏事件(ArkTS&C++)
+
+1.先在设备“开发者选项”中打开“系统资源泄漏日志”,并重启设备;
+
+2.在应用侧主界面,点击"pssLeak ArkTS&C++"按钮触发资源泄露事件,等待15~30分钟,会上报应用内存泄漏事件;
+
+3.在DevEco Studio侧下方导航栏,切换到"Log"窗口,日志过滤选择"All log of selected app",搜索内容设置为"HiAppevent"。此时窗口仅显示符合条件的日志,打印日志结果为:
+
+```
+HiAppEvent eventInfo.WatcherType=OnReceive
+HiAppEvent eventInfo.domain=OS
+HiAppEvent eventInfo.name=RESOURCE_OVERLIMIT
+HiAppEvent eventInfo.eventType=1
+HiAppEvent eventInfo.params.time=1502049167732
+HiAppEvent eventInfo.params.pid=1587
+HiAppEvent eventInfo.params.uid=20010043
+HiAppEvent eventInfo.params.resource_type=pss_memory
+HiAppEvent eventInfo.params.bundle_name=com.example.eventsub
+HiAppEvent eventInfo.params.bundle_version=1.0.0
+HiAppEvent eventInfo.params.memory={"pss":2100257,"rss":1352644,"sys_avail_mem":250272,"sys_free_mem":60004,"sys_total_mem":1992340,"vss":2462936}
+HiAppEvent eventInfo.params.external_log=["/data/storage/el2/log/resourcelimit/RESOURCE_OVERLIMIT_1725614572401_6808.log","/data/storage/el2/log/resourcelimit/RESOURCE_OVERLIMIT_1725614572412_6808.log"]
+HiAppEvent eventInfo.params.log_over_limit=0
+以上为C++ OnReceive类型观察者日志输出
+HiAppEvent eventInfo.WatcherType=OnTrigger
+HiAppEvent eventInfo.domain=OS
+HiAppEvent eventInfo.name=RESOURCE_OVERLIMIT
+HiAppEvent eventInfo.eventType=1
+HiAppEvent eventInfo.params.time=1502049167732
+HiAppEvent eventInfo.params.pid=1587
+HiAppEvent eventInfo.params.uid=20010043
+HiAppEvent eventInfo.params.resource_type=pss_memory
+HiAppEvent eventInfo.params.bundle_name=com.example.eventsub
+HiAppEvent eventInfo.params.bundle_version=1.0.0
+HiAppEvent eventInfo.params.memory={"pss":2100257,"rss":1352644,"sys_avail_mem":250272,"sys_free_mem":60004,"sys_total_mem":1992340,"vss":2462936}
+HiAppEvent eventInfo.params.external_log=["/data/storage/el2/log/resourcelimit/RESOURCE_OVERLIMIT_1725614572401_6808.log","/data/storage/el2/log/resourcelimit/RESOURCE_OVERLIMIT_1725614572412_6808.log"]
+HiAppEvent eventInfo.params.log_over_limit=0
+// 以上为C++ onTrigger类型观察者日志输出
+HiAppEvent onReceive: domain=OS
+HiAppEvent eventName=RESOURCE_OVERLIMIT
+HiAppEvent eventInfo={"domain":"OS","name":"RESOURCE_OVERLIMIT","eventType":1,"params":{"bundle_name":"com.example.eventsub","bundle_version":"1.0.0","memory":{"pss":2100257,"rss":1352644,"sys_avail_mem":250272,"sys_free_mem":60004,"sys_total_mem":1992340,"vss":2462936},"pid":20731,"resource_type":"pss_memory","time":1502348798106,"uid":20010044,"external_log": ["/data/storage/el2/log/resourcelimit/RESOURCE_OVERLIMIT_1725614572401_6808.log", "/data/storage/el2/log/resourcelimit/RESOURCE_OVERLIMIT_1725614572412_6808.log"], "log_over_limit": false}}eventInfo.params.bundle_version=1.0.0
+// 以上为ArkTS onReceive类型观察者日志输出
+```
+
+注意:
+
+1.如果设备“开发者选项”中没有“系统资源泄漏日志”选项,或有该选项但重启后该选项自动关闭,则无法测试该功能。
+
+2.要确认日志输出中的eventInfo.name为RESOURCE_OVERLIMIT。
+
+3.C++实现了onReceive和onTrigger两种观察者,ArkTS实现了onReceive观察者。
+
+##### 6.订阅踩内存事件(ArkTS&C++)
+
+1.点击DevEco Studio界面中的“entry”,点击“Edit Configurations”,点击“Diagnostics”,勾选“Address Sanitizer”,保存设置。
+
+2.在应用侧主界面,点击"appAsanEvent ArkTS&C++"按钮触发踩内存事件,应用退出后重启应用;
+
+3.在DevEco Studio侧下方导航栏,切换到"Log"窗口,日志过滤选择"All log of selected app",搜索内容设置为"HiAppevent"。此时窗口仅显示符合条件的日志,打印日志结果为:
+
+```
+HiAppEvent eventInfo.WatcherType=OnTrigger
+HiAppEvent eventInfo.domain=OS
+HiAppEvent eventInfo.name=ADDRESS_SANITIZER
+HiAppEvent eventInfo.eventType=1
+HiAppEvent eventInfo.params.time=1609739933049
+HiAppEvent eventInfo.params.bundle_version=1.0.0
+HiAppEvent eventInfo.params.bundle_name=com.example.cpp
+HiAppEvent eventInfo.params.pid=6628
+HiAppEvent eventInfo.params.uid=20010050
+HiAppEvent eventInfo.params.type="stack-buffer-overflow"
+HiAppEvent eventInfo.params.external_log=["/data/storage/el2/log/hiappevent/ADDRESS_SANITIZER_1609739933234_6628.log"]
+HiAppEvent eventInfo.params.log_over_limit=0
+// 以上为C++ OnTrigger观察者日志输出
+HiAppEvent eventInfo.WatcherType=OnReceive
+HiAppEvent eventInfo.domain=OS
+HiAppEvent eventInfo.name=ADDRESS_SANITIZER
+HiAppEvent eventInfo.eventType=1
+HiAppEvent eventInfo.params.time=1609739933049
+HiAppEvent eventInfo.params.bundle_version=1.0.0
+HiAppEvent eventInfo.params.bundle_name=com.example.cpp
+HiAppEvent eventInfo.params.pid=6628
+HiAppEvent eventInfo.params.uid=20010050
+HiAppEvent eventInfo.params.type="stack-buffer-overflow"
+HiAppEvent eventInfo.params.external_log=["/data/storage/el2/log/hiappevent/ADDRESS_SANITIZER_1609739933234_6628.log"]
+HiAppEvent eventInfo.params.log_over_limit=0
+// 以上为C++ OnReceiver观察者日志输出
+HiAppEvent onReceive: domain=OS
+HiAppEvent eventName=ADDRESS_SANITIZER
+HiAppEvent eventInfo.domain=OS
+HiAppEvent eventInfo.name=ADDRESS_SANITIZER
+HiAppEvent eventInfo.eventType=1
+HiAppEvent eventInfo.params.time=1609739473665
+HiAppEvent eventInfo.params.crash_type=JsError
+HiAppEvent eventInfo.params.foreground=true
+HiAppEvent eventInfo.params.bundle_version=1.0.0
+HiAppEvent eventInfo.params.bundle_name=com.example.eventsub
+HiAppEvent eventInfo.params.pid=4116
+HiAppEvent eventInfo.params.uid=20010053
+HiAppEvent eventInfo.type=stack-buffer-overflow
+HiAppEvent eventInfo.params.external_log=["/data/storage/el2/log/hiappevent/ADDRESS_SANITIZER_1609739473837_4116.log"]
+HiAppEvent eventInfo.params.log_over_limit=0
+// 以上为ArkTS onReceive类型观察者日志输出
+```
+
+注意:
+
+1.如果在勾选“Address Sanitizer”设置后,应用无法在设备上打开,可能是DevEco Studio和设备版本的原因,请切换版本尝试。
+
+2.要确认日志输出中的eventInfo.name为ADDRESS_SANITIZER。
+
+3.C++实现了onReceive和onTrigger两种观察者,ArkTS实现了onReceive观察者。
+
+##### 7.订阅主线程超时事件(ArkTS&C++)
+
+1.测试设备应能使用开发者使用nolog版本,开发者模式处于关闭状态,可以使能主线程超时检测抓取trace的功能,建议使用真机测试;
+
+2.在应用侧主界面,快速连续点击两次"timeOut350 ArkTS&C++"按钮触发主线程超时事件;
+
+3.在DevEco Studio侧下方导航栏,切换到"Log"窗口,日志过滤选择"All log of selected app",搜索内容设置为"HiAppevent"。此时窗口仅显示符合条件的日志,打印日志结果为:
+
+```
+HiAppEvent eventInfo.WatcherType=OnReceive
+HiAppEvent eventInfo.domain=OS
+HiAppEvent eventInfo.name=MAIN_THREAD_JANK
+HiAppEvent eventInfo.eventType=1
+HiAppEvent eventInfo.params.time=1609739933049
+HiAppEvent eventInfo.params.pid=6628
+HiAppEvent eventInfo.params.uid=20010050
+HiAppEvent eventInfo.params.bundle_version=1.0.0
+HiAppEvent eventInfo.params.bundle_name=com.example.cpp
+HiAppEvent eventInfo.params.begin_time=1609739932900
+HiAppEvent eventInfo.params.end_time=1609739933049
+HiAppEvent eventInfo.params.external_log=["/data/storage/el2/log/hiappevent/MAIN_THREAD_JANK_1609739933234_6628.log"]
+HiAppEvent eventInfo.params.log_over_limit=0
+// 以上为C++ OnReceiver观察者日志输出
+HiAppEvent onReceive: domain=OS
+HiAppEvent eventName=MAIN_THREAD_JANK
+HiAppEvent eventInfo.eventType=1
+HiAppEvent eventInfo.params.time=1609739473665
+HiAppEvent eventInfo.params.bundle_version=1.0.0
+HiAppEvent eventInfo.params.bundle_name=com.example.eventsub
+HiAppEvent eventInfo.params.pid=4116
+HiAppEvent eventInfo.params.uid=20010053
+HiAppEvent eventInfo.params.begin_time=1717593620016
+HiAppEvent eventInfo.params.end_time=1717593620518
+HiAppEvent eventInfo.params.external_log=["/data/storage/el2/log/hiappevent/APP_CRASH_1609739473837_4116.log"]
+HiAppEvent eventInfo.params.log_over_limit=0
+// 以上为ArkTS onReceive类型观察者日志输出
+```
+
+注意:
+
+1.如果测试设备无法达到"使用nolog版本,开发者模式处于关闭状态,可以使能主线程超时检测抓取trace的功能"的条件,无法触发回调,日志不会输出。
+
+2.要确认日志输出中的eventInfo.name为MAIN_THREAD_JANK。
+
+3.C++实现了onReceive观察者,ArkTS实现了onReceive观察者。
+
+### 工程目录
+
+```
+entry/src/main
+├─cpp
+│ ├─json
+│ │ └─json.h // 自行添加
+│ │ └─json-forwards.h // 自行添加
+│ ├─types
+│ │ └─libentry
+│ │ └─Index.d.ts // 定义ArkTS接口
+│ ├─CMakeLists.txt // 导入so链接
+│ ├─napi_init.cpp // 功能函数,观察者定义
+│ └─jsoncpp.cpp // 自行添加
+└─ets
+ ├─entryability
+ │ └─EntryAbility.ets // 新增接口调用
+ └─pages
+ └─Index.ets // 主页
+```
+
+### 具体实现
+
+1.在entry/src/main/cpp下添加三方库文件jsoncpp.cpp和目录"json","json"目录下添加json.h和json-forwards.h;
+2.编辑"CMakeLists.txt"文件,添加源文件及动态库;
+3.编辑"napi_init.cpp"文件,导入依赖的文件,定义onReceive和onTrigger类型观察者相关方法,注册为ArkTS接口;
+4.编辑"index.d.ts"文件,定义ArkTS接口;
+5.编辑"EntryAbility.ets"文件,在onCreate()函数中新增观察者调用(包括ArkTS添加观察者和调用C++接口从而调用观察者);
+6.编辑"Index.ets"文件,新增按钮触发各种事件。
+
+### 相关权限
+
+不涉及。
+
+### 依赖
+
+不涉及。
+
+### 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备:华为手机。
+2. HarmonyOS系统:HarmonyOS 5.0.2 Release及以上。
+3. HarmonyOS SDK版本:HarmonyOS 5.0.2 Release及以上。
+4. 本示例需要使用DevEco Studio(5.0.3.910)及以上版本才可编译运行。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo PerformanceAnalysisKit/HiAppEvent/EventSub/ > .git/info/sparse-checkout
+git remote add origin https://gitee.com/harmonyos_samples/guide-snippets.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/build-profile.json5 b/PerformanceAnalysisKit/HiAppEvent/EventSub/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..4ba45bd15d5effe89b87e447e2c7574ef75f53e9
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/build-profile.json5
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.2(14)",
+ "targetSdkVersion": "5.0.2(14)",
+ "runtimeOS": "HarmonyOS"
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug"
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/.gitignore b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/build-profile.json5 b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..2f391ee59a546af5e0e1ff23f5a98cc0374ca1b7
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/build-profile.json5
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ "externalNativeOptions": {
+ "path": "./src/main/cpp/CMakeLists.txt",
+ "arguments": "",
+ "cppFlags": "",
+ "abiFilters": [
+ "arm64-v8a",
+ "x86_64"
+ ]
+ }
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ },
+ "nativeLib": {
+ "debugSymbol": {
+ "strip": true,
+ "exclude": []
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/hvigorfile.ts b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e042e3f963ab27941d3b34f1f027da9933b81df1
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/obfuscation-rules.txt b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..fdbb5b9852d7dd5f39bddaeb21ab5ee1f3346749
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/obfuscation-rules.txt
@@ -0,0 +1,22 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/oh-package.json5 b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..d55b3e8de9d84c6b79c43869a2b2f0948633f7ec
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/oh-package.json5
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {
+ "libentry.so": "file:./src/main/cpp/types/libentry"
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/cpp/CMakeLists.txt b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/cpp/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..fa2f9febd17f978b15af959a2b18032d46f06a46
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/cpp/CMakeLists.txt
@@ -0,0 +1,17 @@
+# the minimum version of CMake.
+cmake_minimum_required(VERSION 3.5.0)
+project(CPP)
+
+set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+
+if(DEFINED PACKAGE_FIND_FILE)
+ include(${PACKAGE_FIND_FILE})
+endif()
+
+include_directories(${NATIVERENDER_ROOT_PATH}
+ ${NATIVERENDER_ROOT_PATH}/include)
+
+# 新增jsoncpp.cpp(解析订阅事件中的json字符串)源文件
+add_library(entry SHARED napi_init.cpp jsoncpp.cpp)
+# 新增动态库依赖libhiappevent_ndk.z.so和libhilog_ndk.z.so(日志输出)
+target_link_libraries(entry PUBLIC libace_napi.z.so libhilog_ndk.z.so libhiappevent_ndk.z.so)
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/cpp/napi_init.cpp b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/cpp/napi_init.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..906c47d62c6e2e16f81319f11daa76a652dc447a
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/cpp/napi_init.cpp
@@ -0,0 +1,568 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start EventSub_napi_Header]
+#include "napi/native_api.h"
+#include "json/json.h"
+#include "hilog/log.h"
+#include "hiappevent/hiappevent.h"
+#include "hiappevent/hiappevent_event.h"
+
+#undef LOG_TAG
+#define LOG_TAG "testTag"
+// [End EventSub_napi_Header]
+
+// 定义一变量,用来缓存创建的观察者的指针。
+// [Start EventSub_onReceive_ptr]
+static HiAppEvent_Watcher *eventWatcherR;
+// [End EventSub_onReceive_ptr]
+// [Start EventSub_onTrigger_ptr]
+static HiAppEvent_Watcher *eventWatcherT;
+// [End EventSub_onTrigger_ptr]
+// [Start AppEvent_OnReceive]
+static void OnReceiveDottingEvent(const struct HiAppEvent_AppEventGroup *appEventGroups, int i, int j)
+{
+ if (strcmp(appEventGroups[i].appEventInfos[j].domain, "button") == 0 &&
+ strcmp(appEventGroups[i].appEventInfos[j].name, "click") == 0) {
+ Json::Value params;
+ Json::Reader reader(Json::Features::strictMode());
+ if (reader.parse(appEventGroups[i].appEventInfos[j].params, params)) {
+ auto time = params["click_time"].asInt64();
+ OH_LOG_INFO(LogType::LOG_APP, "readEvent C++ Success");
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.click_time=%{public}lld", time);
+ }
+ }
+}
+// [End AppEvent_OnReceive]
+// [Start CrashEvent_OnReceive]
+static void OnReceiveCrashEvent(const struct HiAppEvent_AppEventGroup *appEventGroups, int i, int j)
+{
+ if (strcmp(appEventGroups[i].appEventInfos[j].domain, DOMAIN_OS) == 0 &&
+ strcmp(appEventGroups[i].appEventInfos[j].name, EVENT_APP_CRASH) == 0) {
+ Json::Value params;
+ Json::Reader reader(Json::Features::strictMode());
+ Json::FastWriter writer;
+ if (reader.parse(appEventGroups[i].appEventInfos[j].params, params)) {
+ auto time = params["time"].asInt64();
+ auto crashType = params["crash_type"].asString();
+ auto foreground = params["foreground"].asBool();
+ auto bundleVersion = params["bundle_version"].asString();
+ auto bundleName = params["bundle_name"].asString();
+ auto pid = params["pid"].asInt();
+ auto uid = params["uid"].asInt();
+ auto uuid = params["uuid"].asString();
+ auto exception = writer.write(params["exception"]);
+ auto hilogSize = params["hilog"].size();
+ auto externalLog = writer.write(params["external_log"]);
+ auto logOverLimit = params["log_over_limit"].asBool();
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.time=%{public}lld", time);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.crash_type=%{public}s",
+ crashType.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.foreground=%{public}d", foreground);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_version=%{public}s",
+ bundleVersion.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_name=%{public}s",
+ bundleName.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.pid=%{public}d", pid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.uid=%{public}d", uid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.uuid=%{public}s", uuid.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.exception=%{public}s",
+ exception.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.hilog.size=%{public}d", hilogSize);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.external_log=%{public}s",
+ externalLog.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.log_over_limit=%{public}d",
+ logOverLimit);
+ }
+ }
+}
+// [End CrashEvent_OnReceive]
+// [Start FreezeEvent_OnReceive_Output]
+// OnReceiveFreezeEvent超出50行限制,将日志输出单独抽出
+static void FreezeEventOutput(Json::Value params, Json::FastWriter writer)
+{
+ auto time = params["time"].asInt64();
+ auto foreground = params["foreground"].asBool();
+ auto bundleVersion = params["bundle_version"].asString();
+ auto bundleName = params["bundle_name"].asString();
+ auto processName = params["process_name"].asString();
+ auto pid = params["pid"].asInt();
+ auto uid = params["uid"].asInt();
+ auto uuid = params["uuid"].asString();
+ auto exception = writer.write(params["exception"]);
+ auto hilogSize = params["hilog"].size();
+ auto handleSize = params["event_handler"].size();
+ auto handleSize3s = params["event_handler_size_3s"].asString();
+ auto handleSize6s = params["event_handler_size_6s"].asString();
+ auto peerBindSize = params["peer_binder"].size();
+ auto threadSize = params["threads"].size();
+ auto memory = writer.write(params["memory"]);
+ auto externalLog = writer.write(params["external_log"]);
+ auto logOverLimit = params["log_over_limit"].asBool();
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.time=%{public}lld", time);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.foreground=%{public}d", foreground);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_version=%{public}s",
+ bundleVersion.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_name=%{public}s",
+ bundleName.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.process_name=%{public}s",
+ processName.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.pid=%{public}d", pid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.uid=%{public}d", uid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.uuid=%{public}s", uuid.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.exception=%{public}s",
+ exception.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.hilog.size=%{public}d", hilogSize);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.event_handler.size=%{public}d",
+ handleSize);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.event_handler_3s.size=%{public}s",
+ handleSize3s.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.event_handler_6s.size=%{public}s",
+ handleSize6s.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.peer_binder.size=%{public}d",
+ peerBindSize);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.threads.size=%{public}d", threadSize);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.memory=%{public}s", memory.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.external_log=%{public}s",
+ externalLog.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.log_over_limit=%{public}d",
+ logOverLimit);
+}
+// [End FreezeEvent_OnReceive_Output]
+// [Start FreezeEvent_OnReceive]
+static void OnReceiveFreezeEvent(const struct HiAppEvent_AppEventGroup *appEventGroups, int i, int j)
+{
+ if (strcmp(appEventGroups[i].appEventInfos[j].domain, DOMAIN_OS) == 0 &&
+ strcmp(appEventGroups[i].appEventInfos[j].name, EVENT_APP_FREEZE) == 0) {
+ Json::Value params;
+ Json::Reader reader(Json::Features::strictMode());
+ Json::FastWriter writer;
+ if (reader.parse(appEventGroups[i].appEventInfos[j].params, params)) {
+ FreezeEventOutput(params, writer);
+ }
+ }
+}
+// [End FreezeEvent_OnReceive]
+// [Start PssLeakEvent_OnReceive]
+static void OnReceivePssLeakEvent(const struct HiAppEvent_AppEventGroup *appEventGroups, int i, int j)
+{
+ if (strcmp(appEventGroups[i].appEventInfos[j].domain, DOMAIN_OS) == 0 &&
+ strcmp(appEventGroups[i].appEventInfos[j].name, EVENT_RESOURCE_OVERLIMIT) == 0) {
+ Json::Value params;
+ Json::Reader reader(Json::Features::strictMode());
+ Json::FastWriter writer;
+ if (reader.parse(appEventGroups[i].appEventInfos[j].params, params)) {
+ auto time = params["time"].asInt64();
+ auto pid = params["pid"].asInt();
+ auto uid = params["uid"].asInt();
+ auto resourceType = params["resourceType"].asString();
+ auto bundleName = params["bundle_name"].asString();
+ auto bundleVersion = params["bundle_version"].asString();
+ auto memory = writer.write(params["memory"]);
+ auto externalLog = writer.write(params["external_log"]);
+ std::string logOverLimit = params["log_over_limit"].asBool() ? "true" : "false";
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.time=%{public}lld", time);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.pid=%{public}d", pid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.uid=%{public}d", uid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.resource_type=%{public}s",
+ resourceType.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_name=%{public}s",
+ bundleName.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_version=%{public}s",
+ bundleVersion.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.memory=%{public}s", memory.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.external_log=%{public}s",
+ externalLog.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.log_over_limit=%{public}d",
+ logOverLimit.c_str());
+ }
+ }
+}
+// [End PssLeakEvent_OnReceive]
+// [Start AsanEvent_OnReceive]
+static void OnReceiveAsanEvent(const struct HiAppEvent_AppEventGroup *appEventGroups, int i, int j)
+{
+ if (strcmp(appEventGroups[i].appEventInfos[j].domain, DOMAIN_OS) == 0 &&
+ strcmp(appEventGroups[i].appEventInfos[j].name, EVENT_ADDRESS_SANITIZER) == 0) {
+ Json::Value params;
+ Json::Reader reader(Json::Features::strictMode());
+ Json::FastWriter writer;
+ if (reader.parse(appEventGroups[i].appEventInfos[j].params, params)) {
+ auto time = params["time"].asInt64();
+ auto bundleVersion = params["bundle_version"].asString();
+ auto bundleName = params["bundle_name"].asString();
+ auto pid = params["pid"].asInt();
+ auto uid = params["uid"].asInt();
+ auto type = params["type"].asString();
+ auto boolFlag = params["log_over_limit"].asBool();
+ std::string logOverLimit = params["log_over_limit"].asBool() ? "true" : "false";
+ auto externalLog = writer.write(params["external_log"]);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.time=%{public}lld", time);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_version=%{public}s",
+ bundleVersion.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_name=%{public}s",
+ bundleName.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.pid=%{public}d", pid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.uid=%{public}d", uid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.type=%{public}s", type.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.external_log=%{public}s",
+ externalLog.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.log_over_limit=%{public}s",
+ logOverLimit.c_str());
+ }
+ }
+}
+// [End AsanEvent_OnReceive]
+// [Start TimeOutEvent_OnReceive]
+static void OnReceiveTimeOutEvent(const struct HiAppEvent_AppEventGroup *appEventGroups, int i, int j)
+{
+ if (strcmp(appEventGroups[i].appEventInfos[j].domain, DOMAIN_OS) == 0 &&
+ strcmp(appEventGroups[i].appEventInfos[j].name, EVENT_MAIN_THREAD_JANK) == 0) {
+ Json::Value params;
+ Json::Reader reader(Json::Features::strictMode());
+ Json::FastWriter writer;
+ if (reader.parse(appEventGroups[i].appEventInfos[j].params, params)) {
+ auto time = params["time"].asInt64();
+ auto pid = params["pid"].asInt();
+ auto uid = params["uid"].asInt();
+ auto bundleName = params["bundle_name"].asString();
+ auto bundleVersion = params["bundle_version"].asString();
+ auto beginTime = params["begin_time"].asInt64();
+ auto endTime = params["end_time"].asInt64();
+ auto externalLog = writer.write(params["external_log"]);
+ auto logOverLimit = params["logOverLimit"].asBool();
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.time=%{public}lld", time);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.pid=%{public}d", pid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.uid=%{public}d", uid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_name=%{public}s",
+ bundleName.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_version=%{public}s",
+ bundleVersion.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.begin_time=%{public}lld", beginTime);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.end_time=%{public}lld", endTime);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.external_log=%{public}s",
+ externalLog.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.log_over_limit=%{public}d",
+ logOverLimit);
+ }
+ }
+}
+// [End TimeOutEvent_OnReceive]
+// [Start EventSub_OnReceive_All]
+static void OnReceive(const char *domain, const struct HiAppEvent_AppEventGroup *appEventGroups, uint32_t groupLen)
+{
+ for (int i = 0; i < groupLen; ++i) {
+ for (int j = 0; j < appEventGroups[i].infoLen; ++j) {
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.WatcherType=OnReceive");
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.domain=%{public}s",
+ appEventGroups[i].appEventInfos[j].domain);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.name=%{public}s",
+ appEventGroups[i].appEventInfos[j].name);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.eventType=%{public}d",
+ appEventGroups[i].appEventInfos[j].type);
+ // 处理打点事件
+ OnReceiveDottingEvent(appEventGroups, i, j);
+ // 处理崩溃事件
+ OnReceiveCrashEvent(appEventGroups, i, j);
+ // 处理卡死事件
+ OnReceiveFreezeEvent(appEventGroups, i, j);
+ // 处理内存泄漏事件
+ OnReceivePssLeakEvent(appEventGroups, i, j);
+ // 处理ASAN事件
+ OnReceiveAsanEvent(appEventGroups, i, j);
+ // 处理主线程卡顿事件
+ OnReceiveTimeOutEvent(appEventGroups, i, j);
+ }
+ }
+}
+// [End EventSub_OnReceive_All]
+// [Start AppEvent_OnTrigger]
+static void OnTriggerDottingEvent(std::string domain, std::string name, Json::Value eventInfo)
+{
+ if (domain == "button" && name == "click") {
+ auto clickTime = eventInfo["click_time"].asInt64();
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.click_time=%{public}lld", clickTime);
+ }
+}
+// [End AppEvent_OnTrigger]
+// [Start CrashEvent_OnTrigger]
+static void OnTriggerCrashEvent(std::string domain, std::string name, Json::Value eventInfo, Json::FastWriter writer)
+{
+ if (domain == DOMAIN_OS && name == EVENT_APP_CRASH) {
+ auto time = eventInfo["time"].asInt64();
+ auto crashType = eventInfo["crash_type"].asString();
+ auto foreground = eventInfo["foreground"].asBool();
+ auto bundleVersion = eventInfo["bundle_version"].asString();
+ auto bundleName = eventInfo["bundle_name"].asString();
+ auto pid = eventInfo["pid"].asInt();
+ auto uid = eventInfo["uid"].asInt();
+ auto uuid = eventInfo["uuid"].asString();
+ auto exception = writer.write(eventInfo["exception"]);
+ auto hilogSize = eventInfo["hilog"].size();
+ auto externalLog = writer.write(eventInfo["external_log"]);
+ auto logOverLimit = eventInfo["log_over_limit"].asBool();
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.time=%{public}lld", time);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.crash_type=%{public}s", crashType.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.foreground=%{public}d", foreground);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_version=%{public}s",
+ bundleVersion.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_name=%{public}s", bundleName.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.pid=%{public}d", pid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.uid=%{public}d", uid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.uuid=%{public}s", uuid.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.exception=%{public}s", exception.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.hilog.size=%{public}d", hilogSize);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.external_log=%{public}s",
+ externalLog.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.log_over_limit=%{public}d", logOverLimit);
+ }
+}
+// [End CrashEvent_OnTrigger]
+// [Start FreezeEvent_OnTrigger]
+static void OnTriggerFreezeEvent(std::string domain, std::string name, Json::Value eventInfo, Json::FastWriter writer)
+{
+ if (domain == DOMAIN_OS && name == EVENT_APP_FREEZE) {
+ auto time = eventInfo["time"].asInt64();
+ auto foreground = eventInfo["foreground"].asBool();
+ auto bundleVersion = eventInfo["bundle_version"].asString();
+ auto bundleName = eventInfo["bundle_name"].asString();
+ auto processName = eventInfo["process_name"].asString();
+ auto pid = eventInfo["pid"].asInt();
+ auto uid = eventInfo["uid"].asInt();
+ auto uuid = eventInfo["uuid"].asString();
+ auto exception = writer.write(eventInfo["exception"]);
+ auto hilogSize = eventInfo["hilog"].size();
+ auto handleSize = eventInfo["event_handler"].size();
+ auto handleSize3s = eventInfo["event_handler_size_3s"].asString();
+ auto handleSize6s = eventInfo["event_handler_size_6s"].asString();
+ auto peerBindSize = eventInfo["peer_binder"].size();
+ auto threadSize = eventInfo["threads"].size();
+ auto memory = writer.write(eventInfo["memory"]);
+ auto externalLog = writer.write(eventInfo["external_log"]);
+ auto logOverLimit = eventInfo["log_over_limit"].asBool();
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.time=%{public}lld", time);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.foreground=%{public}d", foreground);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_version=%{public}s",
+ bundleVersion.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_name=%{public}s", bundleName.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.process_name=%{public}s",
+ processName.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.pid=%{public}d", pid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.uid=%{public}d", uid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.uuid=%{public}s", uuid.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.exception=%{public}s", exception.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.hilog.size=%{public}d", hilogSize);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.event_handler.size=%{public}d", handleSize);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.event_handler_3s.size=%{public}s",
+ handleSize3s.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.event_handler_6s.size=%{public}s",
+ handleSize6s.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.peer_binder.size=%{public}d", peerBindSize);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.threads.size=%{public}d", threadSize);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.memory=%{public}s", memory.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.external_log=%{public}s",
+ externalLog.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.log_over_limit=%{public}d", logOverLimit);
+ }
+}
+// [End FreezeEvent_OnTrigger]
+// [Start PssLeakEvent_OnTrigger]
+static void OnTriggerPssLeakEvent(std::string domain, std::string name, Json::Value eventInfo, Json::FastWriter writer)
+{
+ if (domain == DOMAIN_OS && name == EVENT_RESOURCE_OVERLIMIT) {
+ auto time = eventInfo["time"].asInt64();
+ auto pid = eventInfo["pid"].asInt();
+ auto uid = eventInfo["uid"].asInt();
+ auto resourceType = eventInfo["resourceType"].asString();
+ auto bundleName = eventInfo["bundle_name"].asString();
+ auto bundleVersion = eventInfo["bundle_version"].asString();
+ auto memory = writer.write(eventInfo["memory"]);
+ auto externalLog = writer.write(eventInfo["external_log"]);
+ std::string logOverLimit = eventInfo["log_over_limit"].asBool() ? "true" : "false";
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.time=%{public}lld", time);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.pid=%{public}d", pid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.uid=%{public}d", uid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.resource_type=%{public}s",
+ resourceType.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_name=%{public}s", bundleName.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_version=%{public}s",
+ bundleVersion.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.memory=%{public}s", memory.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.external_log=%{public}s",
+ externalLog.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.log_over_limit=%{public}d",
+ logOverLimit.c_str());
+ }
+}
+// [End PssLeakEvent_OnTrigger]
+// [Start AsanEvent_OnTrigger]
+static void OnTriggerAsanEvent(std::string domain, std::string name, Json::Value eventInfo, Json::FastWriter writer)
+{
+ if (domain == DOMAIN_OS && name == EVENT_ADDRESS_SANITIZER) {
+ auto time = eventInfo["time"].asInt64();
+ auto bundleVersion = eventInfo["bundle_version"].asString();
+ auto bundleName = eventInfo["bundle_name"].asString();
+ auto pid = eventInfo["pid"].asInt();
+ auto uid = eventInfo["uid"].asInt();
+ auto asanType = eventInfo["type"].asString();
+ auto externalLog = writer.write(eventInfo["external_log"]);
+ std::string logOverLimit = eventInfo["log_over_limit"].asBool() ? "true" : "false";
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.time=%{public}lld", time);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_version=%{public}s",
+ bundleVersion.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.bundle_name=%{public}s", bundleName.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.pid=%{public}d", pid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.uid=%{public}d", uid);
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.crash_type=%{public}s", asanType.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.external_log=%{public}s",
+ externalLog.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.params.log_over_limit=%{public}s",
+ logOverLimit.c_str());
+ }
+}
+// [End AsanEvent_OnTrigger]
+// [Start EventSub_OnTake_All]
+// 开发者可以自行实现获取已监听到事件的回调函数,其中events指针指向内容仅在该函数内有效。
+static void OnTake(const char *const *events, uint32_t eventLen)
+{
+ Json::Reader reader(Json::Features::strictMode());
+ Json::FastWriter writer;
+ for (int i = 0; i < eventLen; ++i) {
+ Json::Value eventInfo;
+ if (reader.parse(events[i], eventInfo)) {
+ auto domain = eventInfo["domain_"].asString();
+ auto name = eventInfo["name_"].asString();
+ auto type = eventInfo["type_"].asInt();
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.WatcherType=OnTrigger");
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.domain=%{public}s", domain.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.name=%{public}s", name.c_str());
+ OH_LOG_INFO(LogType::LOG_APP, "HiAppEvent eventInfo.eventType=%{public}d", type);
+ // 处理打点事件
+ OnTriggerDottingEvent(domain, name, eventInfo);
+ // 处理崩溃事件
+ OnTriggerCrashEvent(domain, name, eventInfo, writer);
+ // 处理卡死事件
+ OnTriggerFreezeEvent(domain, name, eventInfo, writer);
+ // 处理内存泄漏事件
+ OnTriggerPssLeakEvent(domain, name, eventInfo, writer);
+ // 处理ASAN事件
+ OnTriggerAsanEvent(domain, name, eventInfo, writer);
+ }
+ }
+}
+// [End EventSub_OnTake_All]
+// [Start EventSub_OnTrigger]
+// 开发者可以自行实现订阅回调函数,以便对获取到的事件打点数据进行自定义处理。
+static void OnTrigger(int row, int size)
+{
+ // 接收回调后,获取指定数量的已接收事件。
+ OH_HiAppEvent_TakeWatcherData(eventWatcherT, row, OnTake);
+}
+// [End EventSub_OnTrigger]
+// [Start EventSub_RegisterWatcher_All]
+static napi_value RegisterWatcher(napi_env env, napi_callback_info info)
+{
+ // 开发者自定义观察者名称,系统根据不同的名称来识别不同的观察者。
+ eventWatcherT = OH_HiAppEvent_CreateWatcher("onTriggerWatcher");
+ eventWatcherR = OH_HiAppEvent_CreateWatcher("onReceiverWatcher");
+ // 设置订阅的事件名称为click, EVENT_APP_CRASH。
+ const char *names[] = {"click", EVENT_APP_CRASH, EVENT_APP_FREEZE, EVENT_RESOURCE_OVERLIMIT,
+ EVENT_ADDRESS_SANITIZER, EVENT_MAIN_THREAD_JANK};
+ int namesSize = sizeof(names) / sizeof(names[0]);
+ // 开发者订阅感兴趣的应用事件
+ OH_HiAppEvent_SetAppEventFilter(eventWatcherT, "button", 0, names, namesSize);
+ OH_HiAppEvent_SetAppEventFilter(eventWatcherT, DOMAIN_OS, 0, names, namesSize);
+ // 开发者设置已实现的回调函数,需OH_HiAppEvent_SetTriggerCondition设置的条件满足方可触发。
+ OH_HiAppEvent_SetWatcherOnTrigger(eventWatcherT, OnTrigger);
+ // 开发者可以设置订阅触发回调的条件,此处是设置新增事件打点数量为1个时,触发onTrigger回调。
+ OH_HiAppEvent_SetTriggerCondition(eventWatcherT, 1, 0, 0);
+ // 使观察者开始监听订阅的事件。
+ OH_HiAppEvent_AddWatcher(eventWatcherT);
+ // 开发者订阅感兴趣的应用事件
+ OH_HiAppEvent_SetAppEventFilter(eventWatcherR, "button", 0, names, namesSize);
+ OH_HiAppEvent_SetAppEventFilter(eventWatcherR, DOMAIN_OS, 0, names, namesSize);
+ // 开发者设置已实现的回调函数,观察者接收到事件后回立即触发OnReceive回调。
+ OH_HiAppEvent_SetWatcherOnReceive(eventWatcherR, OnReceive);
+ // 使观察者开始监听订阅的事件。
+ OH_HiAppEvent_AddWatcher(eventWatcherR);
+ return {};
+}
+// [End EventSub_RegisterWatcher_All]
+// [Start EventSub_RemoveWatcher_All]
+static napi_value RemoveWatcher(napi_env env, napi_callback_info info)
+{
+ // 使观察者停止监听事件
+ OH_HiAppEvent_RemoveWatcher(eventWatcherT);
+ OH_HiAppEvent_RemoveWatcher(eventWatcherR);
+ return {};
+}
+// [End EventSub_RemoveWatcher_All]
+// [Start EventSub_DestroyWatcher_All]
+static napi_value DestroyWatcher(napi_env env, napi_callback_info info)
+{
+ // 销毁创建的观察者,并置appEventWatcher为nullptr。
+ OH_HiAppEvent_DestroyWatcher(eventWatcherT);
+ OH_HiAppEvent_DestroyWatcher(eventWatcherR);
+ eventWatcherT = nullptr;
+ eventWatcherR = nullptr;
+ return {};
+}
+// [End EventSub_DestroyWatcher_All]
+// [Start AppEvent_WriteAppEvent]
+static napi_value WriteAppEvent(napi_env env, napi_callback_info info)
+{
+ auto params = OH_HiAppEvent_CreateParamList();
+ OH_HiAppEvent_AddInt64Param(params, "click_time", time(nullptr));
+ OH_HiAppEvent_Write("button", "click", EventType::BEHAVIOR, params);
+ OH_HiAppEvent_DestroyParamList(params);
+ OH_LOG_INFO(LogType::LOG_APP, "writeEvent C++ success");
+ return {};
+}
+// [End AppEvent_WriteAppEvent]
+// [Start AsanEvent_AddressTest]
+static napi_value AddressTest(napi_env env, napi_callback_info info)
+{
+ // 任意实数
+ int num = 1;
+ int length = 10;
+ // 构造数组越界写入
+ int a[length];
+ a[length] = num;
+ return {};
+}
+// [End AsanEvent_AddressTest]
+// [Start EventSub_Init_All]
+static napi_value Init(napi_env env, napi_value exports)
+{
+ napi_property_descriptor desc[] = {
+ {"registerWatcher", nullptr, RegisterWatcher, nullptr, nullptr, nullptr, napi_default, nullptr},
+ {"writeAppEvent", nullptr, WriteAppEvent, nullptr, nullptr, nullptr, napi_default, nullptr},
+ {"addressTest", nullptr, AddressTest, nullptr, nullptr, nullptr, napi_default, nullptr}
+ };
+ napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
+ return exports;
+}
+// [End EventSub_Init_All]
+static napi_module demoModule = {
+ .nm_version = 1,
+ .nm_flags = 0,
+ .nm_filename = nullptr,
+ .nm_register_func = Init,
+ .nm_modname = "entry",
+ .nm_priv = ((void *)0),
+ .reserved = {0},
+};
+
+extern "C" __attribute__((constructor)) void RegisterEntryModule(void) { napi_module_register(&demoModule); }
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/cpp/types/libentry/Index.d.ts b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/cpp/types/libentry/Index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..12176f2ef6915d43401d314d832d7d04e6ac07cb
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/cpp/types/libentry/Index.d.ts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start EventSub_Index.d.ts_All]
+export const registerWatcher: () => void;
+export const writeAppEvent: () => void;
+export const addressTest: () => void;
+// [End EventSub_Index.d.ts_All]
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/cpp/types/libentry/oh-package.json5 b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/cpp/types/libentry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..88838fa0b2042f057b1d730054d5698b61c7fb58
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/cpp/types/libentry/oh-package.json5
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "libentry.so",
+ "types": "./Index.d.ts",
+ "version": "1.0.0",
+ "description": "Please describe the basic information."
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/ets/entryability/EntryAbility.ets b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..9492bd555025a78ed85e3eafb74f337c4fb3defa
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,353 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start EventSub_EntryAbility_Header]
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hiAppEvent, hilog, hidebug } from '@kit.PerformanceAnalysisKit';
+import { BusinessError } from '@kit.BasicServicesKit';
+import { window } from '@kit.ArkUI';
+// [End EventSub_EntryAbility_Header]
+// [Start EventSub_Capi_Header]
+import testNapi from 'libentry.so';
+// [End EventSub_Capi_Header]
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ // [Start AppEvent_ArkTS_Add_Watcher]
+ // 添加按钮事件观察者
+ hiAppEvent.addWatcher({
+ // 开发者可以自定义观察者名称,系统会使用名称来标识不同的观察者
+ name: 'appEventWatcher',
+ // 开发者可以订阅感兴趣的应用事件,此处是订阅了按钮事件
+ appEventFilters: [{
+ domain: 'button'
+ }],
+ // 开发者可以设置订阅回调触发的条件,此处是设置为事件打点数量满足1个
+ triggerCondition: {
+ row: 1
+ },
+ // 开发者可以自行实现订阅回调函数,以便对订阅获取到的事件打点数据进行自定义处理
+ onTrigger: (curRow: number, curSize: number, holder: hiAppEvent.AppEventPackageHolder) => {
+ // 返回的holder对象为null,表示订阅过程发生异常,因此在记录错误日志后直接返回
+ if (holder == null) {
+ hilog.error(0x0000, 'testTag', `HiAppEvent holder is null`);
+ return;
+ }
+ hilog.info(0x0000, 'testTag', `HiAppEvent onTrigger: curRow=%{public}d, curSize=%{public}d`, curRow, curSize);
+ let eventPkg: hiAppEvent.AppEventPackage | null = null;
+ // 根据设置阈值大小(默认为512KB)去获取订阅事件包,直到将订阅数据全部取出
+ // 返回的事件包对象为null,表示当前订阅数据已被全部取出,此次订阅回调触发结束
+ while ((eventPkg = holder.takeNext()) != null) {
+ // 开发者可以对事件包中的事件打点数据进行自定义处理,此处是将事件打点数据打印在日志中
+ hilog.info(0x0000, 'testTag', `readEvent ArkTS Success`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventPkg.packageId=%{public}d`, eventPkg.packageId);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventPkg.row=%{public}d`, eventPkg.row);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventPkg.size=%{public}d`, eventPkg.size);
+ for (const eventInfo of eventPkg.data) {
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventPkg.info=%{public}s`, eventInfo);
+ }
+ }
+ }
+ });
+ // [End AppEvent_ArkTS_Add_Watcher]
+ // [Start Crash&FreezeEvent_ArkTS_Add_Event]
+ // 开发者完成参数键值对赋值
+ let params: Record = {
+ 'testData': 100,
+ };
+ // 开发者可以设置事件的自定义参数
+ hiAppEvent.setEventParam(params, hiAppEvent.domain.OS, hiAppEvent.event.APP_CRASH).then(() => {
+ }).catch((err: BusinessError) => {
+ hilog.error(0x0000, 'testTag', `HiAppEvent code: ${err.code}, message: ${err.message}`);
+ });
+ hiAppEvent.setEventParam(params, hiAppEvent.domain.OS, hiAppEvent.event.APP_FREEZE).then(() => {
+ }).catch((err: BusinessError) => {
+ hilog.error(0x0000, 'testTag', `HiAppEvent code: ${err.code}, message: ${err.message}`);
+ });
+ // [End Crash&FreezeEvent_ArkTS_Add_Event]
+ // [Start CrashEvent_ArkTS_Add_Watcher]
+ // 添加崩溃事件观察者
+ hiAppEvent.addWatcher({
+ // 开发者可以自定义观察者名称,系统会使用名称来标识不同的观察者
+ name: 'crashEventWatcher',
+ // 开发者可以订阅感兴趣的系统事件,此处是订阅了崩溃事件
+ appEventFilters: [
+ {
+ domain: hiAppEvent.domain.OS,
+ names: [hiAppEvent.event.APP_CRASH]
+ }
+ ],
+ // 开发者可以自行实现订阅实时回调函数,以便对订阅获取到的事件数据进行自定义处理
+ onReceive: (domain: string, appEventGroups: Array) => {
+ hilog.info(0x0000, 'testTag', `HiAppEvent onReceive: domain=${domain}`);
+ for (const eventGroup of appEventGroups) {
+ // 开发者可以根据事件集合中的事件名称区分不同的系统事件
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventName=${eventGroup.name}`);
+ for (const eventInfo of eventGroup.appEventInfos) {
+ // 开发者可以对事件集合中的事件数据进行自定义处理,此处是将事件数据打印在日志中
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.domain=${eventInfo.domain}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.name=${eventInfo.name}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.eventType=${eventInfo.eventType}`);
+ // 开发者可以获取到崩溃事件发生的时间戳
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.time=${eventInfo.params['time']}`);
+ // 开发者可以获取到崩溃事件发生的崩溃类型
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.crash_type=${eventInfo.params['crash_type']}`);
+ // 开发者可以获取到崩溃应用的前后台状态
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.foreground=${eventInfo.params['foreground']}`);
+ // 开发者可以获取到崩溃应用的版本信息
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.bundle_version=${eventInfo.params['bundle_version']}`);
+ // 开发者可以获取到崩溃应用的包名
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.bundle_name=${eventInfo.params['bundle_name']}`);
+ // 开发者可以获取到崩溃应用的进程id
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.pid=${eventInfo.params['pid']}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.uid=${eventInfo.params['uid']}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.uuid=${eventInfo.params['uuid']}`);
+ // 开发者可以获取到崩溃事件发生的异常类型、异常原因和异常调用栈
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.exception=${JSON.stringify(eventInfo.params['exception'])}`);
+ // 开发者可以获取到崩溃事件发生时日志信息
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.hilog.size=${eventInfo.params['hilog'].length}`);
+ // 开发者可以获取到崩溃事件发生时的故障日志文件
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.external_log=${JSON.stringify(eventInfo.params['external_log'])}`);
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.log_over_limit=${eventInfo.params['log_over_limit']}`);
+ // 开发者可以获取到崩溃事件的自定义数据test_data
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.test_data=${eventInfo.params['testData']}`);
+ }
+ }
+ }
+ });
+ // [End CrashEvent_ArkTS_Add_Watcher]
+ // [Start FreezeEvent_ArkTS_Add_Watcher]
+ // 添加卡死事件观察者
+ hiAppEvent.addWatcher({
+ // 开发者可以自定义观察者名称,系统会使用名称来标识不同的观察者
+ name: 'freezeEventWatcher',
+ // 开发者可以订阅感兴趣的系统事件,此处是订阅了卡死事件
+ appEventFilters: [
+ {
+ domain: hiAppEvent.domain.OS,
+ names: [hiAppEvent.event.APP_FREEZE]
+ }
+ ],
+ // 开发者可以自行实现订阅实时回调函数,以便对订阅获取到的事件数据进行自定义处理
+ onReceive: (domain: string, appEventGroups: Array) => {
+ hilog.info(0x0000, 'testTag', `HiAppEvent onReceive: domain=${domain}`);
+ for (const eventGroup of appEventGroups) {
+ // 开发者可以根据事件集合中的事件名称区分不同的系统事件
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventName=${eventGroup.name}`);
+ for (const eventInfo of eventGroup.appEventInfos) {
+ // 开发者可以对事件集合中的事件数据进行自定义处理,此处是将事件数据打印在日志中
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.domain=${eventInfo.domain}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.name=${eventInfo.name}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.eventType=${eventInfo.eventType}`);
+ // 开发者可以获取到卡死事件发生的时间戳
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.time=${eventInfo.params['time']}`);
+ // 开发者可以获取到卡死应用的前后台状态
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.foreground=${eventInfo.params['foreground']}`);
+ // 开发者可以获取到卡死应用的版本信息
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.bundle_version=${eventInfo.params['bundle_version']}`);
+ // 开发者可以获取到卡死应用的包名
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.bundle_name=${eventInfo.params['bundle_name']}`);
+ // 开发者可以获取到卡死应用的进程名称
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.process_name=${eventInfo.params['process_name']}`);
+ // 开发者可以获取到卡死应用的进程id
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.pid=${eventInfo.params['pid']}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.uid=${eventInfo.params['uid']}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.uuid=${eventInfo.params['uuid']}`);
+ // 开发者可以获取到卡死事件发生的异常类型、异常原因
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.exception=${JSON.stringify(eventInfo.params['exception'])}`);
+ // 开发者可以获取到卡死事件发生时日志信息
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.hilog.size=${eventInfo.params['hilog'].length}`);
+ // 开发者可以获取到卡死事件发生时主线程未处理消息
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.event_handler.size=${eventInfo.params['event_handler'].length}`);
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.event_handler_size_3s=${eventInfo.params['event_handler_size_3s']}`);
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.event_handler_size_6s=${eventInfo.params['event_handler_size_6s']}`);
+ // 开发者可以获取到卡死事件发生时同步binder调用信息
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.peer_binder.size=${eventInfo.params['peer_binder'].length}`);
+ // 开发者可以获取到卡死事件发生时全量线程调用栈
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.threads.size=${eventInfo.params['threads'].length}`);
+ // 开发者可以获取到卡死事件发生时内存信息
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.memory=${JSON.stringify(eventInfo.params['memory'])}`);
+ // 开发者可以获取到卡死事件发生时的故障日志文件
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.external_log=${JSON.stringify(eventInfo.params['external_log'])}`);
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.log_over_limit=${eventInfo.params['log_over_limit']}`);
+ // 开发者可以获取到卡死事件的自定义数据test_data
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.test_data=${eventInfo.params['testData']}`);
+ }
+ }
+ }
+ });
+ // [End FreezeEvent_ArkTS_Add_Watcher]
+ // [Start PssleakEvent_ArkTS_Add_Watcher]
+ // 添加资源泄露事件观察者
+ hiAppEvent.addWatcher({
+ // 开发者可以自定义观察者名称,系统会使用名称来标识不同的观察者
+ name: 'pssleakwatcher',
+ // 开发者可以订阅感兴趣的系统事件,此处是订阅了资源泄漏事件
+ appEventFilters: [
+ {
+ domain: hiAppEvent.domain.OS,
+ names: [hiAppEvent.event.RESOURCE_OVERLIMIT]
+ }
+ ],
+ // 开发者可以自行实现订阅实时回调函数,以便对订阅获取到的事件数据进行自定义处理
+ onReceive: (domain: string, appEventGroups: Array) => {
+ hilog.info(0x0000, 'testTag', `HiAppEvent onReceive: domain=${domain}`);
+ for (const eventGroup of appEventGroups) {
+ // 开发者可以根据事件集合中的事件名称区分不同的系统事件
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventName=${eventGroup.name}`);
+ for (const eventInfo of eventGroup.appEventInfos) {
+ // 开发者可以获取到资源泄漏事件发生时内存信息
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.memory=${JSON.stringify(eventInfo)}`);
+ }
+ }
+ }
+ });
+ // [End PssleakEvent_ArkTS_Add_Watcher]
+ // [Start AsanEvent_ArkTS_Add_Watcher]
+ // 添加踩地址事件观察者
+ hiAppEvent.addWatcher({
+ // 开发者可以自定义观察者名称,系统会使用名称来标识不同的观察者
+ name: 'addressSanitizerWatcher',
+ // 开发者可以订阅感兴趣的系统事件,此处是订阅了踩内存事件
+ appEventFilters: [
+ {
+ domain: hiAppEvent.domain.OS,
+ names: [hiAppEvent.event.ADDRESS_SANITIZER]
+ }
+ ],
+ // 开发者可以自行实现订阅系统事件回调函数,以便对订阅获取到的事件数据进行自定义处理
+ onReceive: (domain: string, appEventGroups: Array) => {
+ hilog.info(0x0000, 'testTag', `HiAppEvent onReceive: domain=${domain}`);
+ for (const eventGroup of appEventGroups) {
+ // 开发者可以根据事件集合中的事件名称区分不同的系统事件
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventName=${eventGroup.name}`);
+ for (const eventInfo of eventGroup.appEventInfos) {
+ // 开发者可以对事件集合中的事件数据进行自定义处理,此处是将事件数据打印在日志中
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.domain=${eventInfo.domain}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.name=${eventInfo.name}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.eventType=${eventInfo.eventType}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.time=${eventInfo.params['time']}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.bundle_version=${eventInfo.params['bundle_version']}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.bundle_name=${eventInfo.params['bundle_name']}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.pid=${eventInfo.params['pid']}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.uid=${eventInfo.params['uid']}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.type=${eventInfo.params['type']}`);
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.external_log=${JSON.stringify(eventInfo.params['external_log'])}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.log_over_limit=${eventInfo.params['log_over_limit']}`);
+ }
+ }
+ }
+ });
+ // [End AsanEvent_ArkTS_Add_Watcher]
+ // [Start TimeOutEvent_ArkTS_Add_Watcher]
+ // 添加主线程超时事件观察者
+ hiAppEvent.addWatcher({
+ // 开发者可以自定义观察者名称,系统会使用名称来标识不同的观察者
+ name: 'timeOutWatcher',
+ // 开发者可以订阅感兴趣的系统事件,此处是订阅了主线程超时事件
+ appEventFilters: [
+ {
+ domain: hiAppEvent.domain.OS,
+ names: [hiAppEvent.event.MAIN_THREAD_JANK]
+ }
+ ],
+ // 开发者可以自行实现订阅实时回调函数,以便对订阅获取到的事件数据进行自定义处理
+ onReceive: (domain: string, appEventGroups: Array) => {
+ hilog.info(0x0000, 'testTag', `HiAppEvent onReceive: domain=${domain}`);
+ for (const eventGroup of appEventGroups) {
+ // 开发者可以根据事件集合中的事件名称区分不同的系统事件
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventName=${eventGroup.name}`);
+ for (const eventInfo of eventGroup.appEventInfos) {
+ // 开发者可以对事件集合中的事件数据进行自定义处理,此处是将事件数据打印在日志中
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.domain=${eventInfo.domain}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.name=${eventInfo.name}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.eventType=${eventInfo.eventType}`);
+ // 开发者可以获取到主线程超时事件发生的时间戳
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.time=${eventInfo.params['time']}`);
+ // 开发者可以获取到主线程超时应用的版本信息
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.bundle_version=${eventInfo.params['bundle_version']}`);
+ // 开发者可以获取到主线程超时应用的包名
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.bundle_name=${eventInfo.params['bundle_name']}`);
+ // 开发者可以获取到主线程超时应用的pid、uid
+ hilog.info(0x0000, 'testTag', ` eventInfo.params.pid=${eventInfo.params['pid']}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.uid=${eventInfo.params['uid']}`);
+ // 开发者可以获取主线程处理开始和结束时间
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.begin_time=${eventInfo.params['begin_time']}`);
+ hilog.info(0x0000, 'testTag', `HiAppEvent eventInfo.params.end_time=${eventInfo.params['end_time']}`);
+ // 开发者可以获取到主线程超时事件发生时的故障日志文件
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.external_log=${JSON.stringify(eventInfo.params['external_log'])}`);
+ hilog.info(0x0000, 'testTag',
+ `HiAppEvent eventInfo.params.log_over_limit=${eventInfo.params['log_over_limit']}`);
+ }
+ }
+ }
+ });
+ // [End TimeOutEvent_ArkTS_Add_Watcher]
+ // [Start EventSub_Call_Capi_Function]
+ // 调用C++观察者
+ testNapi.registerWatcher();
+ // [End EventSub_Call_Capi_Function]
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+};
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..29feaca7669174be5c2b0e2366529ee94ab7e726
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/ets/pages/Index.ets b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..3084053dbfb8371d7cce34d85666cd50aea3d628
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start EventSub_Header]
+import { BusinessError } from '@kit.BasicServicesKit';
+import { hiAppEvent, hilog } from '@kit.PerformanceAnalysisKit';
+// [End EventSub_Header]
+// [Start PssleakEvent_Header]
+import hidebug from '@ohos.hidebug';
+// [End PssleakEvent_Header]
+// [Start EventSub_Index_Capi_Header]
+import testNapi from 'libentry.so';
+// [End EventSub_Index_Capi_Header]
+@Entry
+@Component
+struct Index {
+ @State leakedArray: string[][] = [];
+
+ build() {
+ Row() {
+ Column() {
+ // [Start AppEvent_ArkTS_Button]
+ Button($r('app.string.WriteEventArkTS_Button'))
+ // [StartExclude AppEvent_ArkTS_Button]
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('80%')
+ .height('5%')
+ // [EndExclude AppEvent_ArkTS_Button]
+ .onClick(() => {
+ // 在按钮点击函数中进行事件打点,以记录按钮点击事件
+ let eventParams: Record = {'clickTime': 100};
+ let eventInfo: hiAppEvent.AppEventInfo = {
+ // 事件领域定义
+ domain: 'button',
+ // 事件名称定义
+ name: 'click',
+ // 事件类型定义
+ eventType: hiAppEvent.EventType.BEHAVIOR,
+ // 事件参数定义
+ params: eventParams,
+ };
+ hiAppEvent.write(eventInfo).then(() => {
+ hilog.info(0x0000, 'testTag', `writeEvent ArkTS success`);
+ }).catch((err: BusinessError) => {
+ hilog.error(0x0000, 'testTag', `HiAppEvent err.code: ${err.code}, err.message: ${err.message}`);
+ });
+ })
+ // [End AppEvent_ArkTS_Button]
+ // [Start CrashEvent_Button]
+ Button($r('app.string.Crash_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('80%')
+ .height('5%')
+ .onClick(() => {
+ // 在按钮点击函数中构造一个crash场景,触发应用崩溃事件
+ JSON.parse('');
+ })
+ // [End CrashEvent_Button]
+ // [Start PssleakEvent_Button]
+ Button($r('app.string.Pssleak_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('80%')
+ .height('5%')
+ .onClick(() => {
+ // 设置一个简单的资源泄漏场景
+ hidebug.setAppResourceLimit('pss_memory', 1024, true);
+ for (let i = 0; i < 20 * 1024; i++) {
+ this.leakedArray.push(new Array(1).fill('leak'));
+ }
+ })
+ // [End PssleakEvent_Button]
+ // [Start TimeOutEvent_Button]
+ Button($r('app.string.TimeOut_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('80%')
+ .height('5%')
+ .onClick(() => {
+ let t = Date.now();
+ while (Date.now() - t <= 350) {
+ }
+ })
+ // [End TimeOutEvent_Button]
+ }
+ .width('50%')
+
+ Column() {
+ // [Start AppEvent_CPP_Button]
+ Button($r('app.string.WriteEventCPP_Button'))
+ // [StartExclude AppEvent_CPP_Button]
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('80%')
+ .height('5%')
+ // [EndExclude AppEvent_CPP_Button]
+ .onClick(() => {
+ testNapi.writeAppEvent();
+ })
+ // [End AppEvent_CPP_Button]
+ // [Start FreezeEvent_Button]
+ Button($r('app.string.Freeze_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('80%')
+ .height('5%')
+ .onClick(() => {
+ setTimeout(() => {
+ while (true) {
+ }
+ }, 1000)
+ })
+ // [End FreezeEvent_Button]
+ // [Start AsanEvent_Button]
+ Button($r('app.string.AsanEvent_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('80%')
+ .height('5%')
+ .onClick(() => {
+ testNapi.addressTest();
+ })
+ // [End AsanEvent_Button]
+ }
+ .width('50%')
+ }
+ .height('100%')
+ }
+}
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/module.json5 b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9f7f873fbc51484895e18fcfd60b2498521aecb0
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/module.json5
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/element/color.json b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/element/string.json b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..3a434d5a3c1ebeba93429c665379ef216500e65e
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,44 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "EventSub"
+ },
+ {
+ "name": "WriteEventArkTS_Button",
+ "value": "writeEvent ArkTS"
+ },
+ {
+ "name": "Crash_Button",
+ "value": "appCrash ArkTS&C++"
+ },
+ {
+ "name": "Pssleak_Button",
+ "value": "pssleak ArkTS&C++"
+ },
+ {
+ "name": "TimeOut_Button",
+ "value": "timeOut350 ArkTS&C++"
+ },
+ {
+ "name": "WriteEventCPP_Button",
+ "value": "writeEvent C++"
+ },
+ {
+ "name": "Freeze_Button",
+ "value": "appFreeze ArkTS&C++"
+ },
+ {
+ "name": "AsanEvent_Button",
+ "value": "appAsanEvent ArkTS&C++"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/media/background.png b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/media/background.png differ
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/media/foreground.png b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/media/foreground.png differ
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/media/layered_image.json b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/media/startIcon.png b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/profile/backup_config.json b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/profile/main_pages.json b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/en_US/element/string.json b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..3a434d5a3c1ebeba93429c665379ef216500e65e
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,44 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "EventSub"
+ },
+ {
+ "name": "WriteEventArkTS_Button",
+ "value": "writeEvent ArkTS"
+ },
+ {
+ "name": "Crash_Button",
+ "value": "appCrash ArkTS&C++"
+ },
+ {
+ "name": "Pssleak_Button",
+ "value": "pssleak ArkTS&C++"
+ },
+ {
+ "name": "TimeOut_Button",
+ "value": "timeOut350 ArkTS&C++"
+ },
+ {
+ "name": "WriteEventCPP_Button",
+ "value": "writeEvent C++"
+ },
+ {
+ "name": "Freeze_Button",
+ "value": "appFreeze ArkTS&C++"
+ },
+ {
+ "name": "AsanEvent_Button",
+ "value": "appAsanEvent ArkTS&C++"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/zh_CN/element/string.json b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..135de82be37eb2c8bbd8dc536275877670cc3e3f
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,44 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "模块描述"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "事件订阅"
+ },
+ {
+ "name": "WriteEventArkTS_Button",
+ "value": "writeEvent ArkTS"
+ },
+ {
+ "name": "Crash_Button",
+ "value": "appCrash ArkTS&C++"
+ },
+ {
+ "name": "Pssleak_Button",
+ "value": "pssleak ArkTS&C++"
+ },
+ {
+ "name": "TimeOut_Button",
+ "value": "timeOut350 ArkTS&C++"
+ },
+ {
+ "name": "WriteEventCPP_Button",
+ "value": "writeEvent C++"
+ },
+ {
+ "name": "Freeze_Button",
+ "value": "appFreeze ArkTS&C++"
+ },
+ {
+ "name": "AsanEvent_Button",
+ "value": "appAsanEvent ArkTS&C++"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/mock/Libentry.mock.ets b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/mock/Libentry.mock.ets
new file mode 100644
index 0000000000000000000000000000000000000000..37c4693badee0bced9f50f020403147ada0e8d44
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/mock/Libentry.mock.ets
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+const nativeMock: Record = {
+ 'add': (a: number, b: number) => {
+ return a + b;
+ },
+};
+
+export default nativeMock;
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/mock/mock-config.json5 b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..25f4db9dcf89e656abe1a6776fe21cd00fc94dac
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/mock/mock-config.json5
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "libentry.so": {
+ "source": "src/mock/Libentry.mock.ets"
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/hvigor/hvigor-config.json5 b/PerformanceAnalysisKit/HiAppEvent/EventSub/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..a2c44fdf8f9ac103168672568ff000ac395a2edc
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/hvigor/hvigor-config.json5
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "modelVersion": "5.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/hvigorfile.ts b/PerformanceAnalysisKit/HiAppEvent/EventSub/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..79d8761856e2996edc0649eca63b96b2c883b28a
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/oh-package.json5 b/PerformanceAnalysisKit/HiAppEvent/EventSub/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b7f346f7ddb2fc98ac428c55207a63ff89ea1c70
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "modelVersion": "5.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.18",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/ohosTest.md b/PerformanceAnalysisKit/HiAppEvent/EventSub/ohosTest.md
new file mode 100644
index 0000000000000000000000000000000000000000..fe414f3988573487d87ccc43d7f6fcf8e95e9d37
--- /dev/null
+++ b/PerformanceAnalysisKit/HiAppEvent/EventSub/ohosTest.md
@@ -0,0 +1,6 @@
+# EventSub测试用例归档
+
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 |
+| ------------ | ------------ | ------------ | ------------ | -------- | -------- |
+| 拉起应用 | 设备正常运行 | | 成功拉起应用 | 否 | Pass |
+| 主页按钮点击 | 位于主页 | 依次点击按钮 | 输出预期日志 | 否 | Pass |
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/HiAppEvent/EventSub/screenshots/Screenshot_20250219094941818.jpeg b/PerformanceAnalysisKit/HiAppEvent/EventSub/screenshots/Screenshot_20250219094941818.jpeg
new file mode 100644
index 0000000000000000000000000000000000000000..7ad5f104644e23b295bace3bfea4c9274effc341
Binary files /dev/null and b/PerformanceAnalysisKit/HiAppEvent/EventSub/screenshots/Screenshot_20250219094941818.jpeg differ
diff --git a/PerformanceAnalysisKit/Hilog/.gitignore b/PerformanceAnalysisKit/Hilog/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/.gitignore
@@ -0,0 +1,12 @@
+/node_modules
+/oh_modules
+/local.properties
+/.idea
+**/build
+/.hvigor
+.cxx
+/.clangd
+/.clang-format
+/.clang-tidy
+**/.test
+/.appanalyzer
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/AppScope/app.json5 b/PerformanceAnalysisKit/Hilog/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..bf1020b33496325f02644731457f67dea8e0a7af
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "bundleName": "com.samples.hilog",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/PerformanceAnalysisKit/Hilog/AppScope/resources/base/element/string.json b/PerformanceAnalysisKit/Hilog/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..ffde311434c2bd7a86d8e057d860177635dd44cc
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "HiLog"
+ }
+ ]
+}
diff --git a/PerformanceAnalysisKit/Hilog/AppScope/resources/base/media/app_icon.png b/PerformanceAnalysisKit/Hilog/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3
Binary files /dev/null and b/PerformanceAnalysisKit/Hilog/AppScope/resources/base/media/app_icon.png differ
diff --git a/PerformanceAnalysisKit/Hilog/README_zh.md b/PerformanceAnalysisKit/Hilog/README_zh.md
new file mode 100644
index 0000000000000000000000000000000000000000..326dbd0f0d23d00cd3fbbb9585ea36c863a0d51d
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/README_zh.md
@@ -0,0 +1,89 @@
+# 使用HiLog打印日志
+
+### 介绍
+
+本示例主要展示了使用HiLog打印日志相关的功能,在应用开发过程中,可在关键代码处输出日志信息。在运行应用后,通过查看日志信息来分析应用执行情况(如应用是否正常运行、代码运行时序、运行逻辑分支是否正常等)。
+
+HiLog日志系统,提供给系统框架、服务、以及应用,用于打印日志,记录用户操作、系统运行状态等。
+
+该工程中的展示的代码详细描述可查如下链接:
+
+- [使用HiLog打印日志(ArkTS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hilog-guidelines-arkts.md)
+
+- [使用HiLog打印日志(C/C++)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hilog-guidelines-ndk.md)
+
+### 效果预览
+
+| 主页 |
+| :----------------------------------------------------------: |
+|
|
+
+#### 使用说明
+
+##### 1.Hilog(ArkTS)使用说明
+
+1.在应用侧主界面,点击"HiLog ArkTS"按钮;
+
+2.在DevEco界面切换到"Log"窗口,日志过滤选择"No filters",搜索内容设置为"testTag"。此时窗口仅显示符合条件的日志,打印日志结果为:
+
+```
+01-16 14:46:54.316 2997-2997 A0ff00/testTag com.sampl...logarkts I hilog_info_test
+01-16 14:46:54.316 2997-2997 A0ff00/testTag com.sampl...logarkts D hilog_debug_test
+01-16 14:46:54.316 2997-2997 A0ff00/testTag com.sampl...logarkts W hilog_warn_test
+01-16 14:46:54.316 2997-2997 A0ff00/testTag com.sampl...logarkts F hilog_fatal_test
+01-16 14:46:54.316 2997-2997 A0ff00/testTag com.sampl...logarkts E hilog_error_test
+01-16 14:46:54.316 2997-2997 A0ff00/testTag com.sampl...logarkts I A log with a domainID of 0xFF00 and a label of testTag can print logs at the Info level or higher.
+```
+
+##### 2.HiLog(C++)使用说明
+
+1.在主界面,点击"HiLog C++"按钮;
+
+2.切换到"Log"窗口,日志过滤选择"No filters",搜索内容设置为"Failed to test"。此时窗口显示报错的日志,打印日志结果为"Failed to test"。
+
+### 工程目录
+
+```
+entry/src/main
+├─cpp
+│ ├─CMakeLists.txt //导入so链接
+│ └─napi_init.cpp //功能函数
+│
+└─ets
+ └─pages
+ └─Index.ets //主页
+
+```
+
+### 具体实现
+
+1.ArkTS实现时只需在按钮的点击事件中添加各种类型日志的打印函数
+
+2.C++实现时在napi_init.cpp添加具有打印功能的函数,在主页按钮中增加一个单击事件,并调用功能函数打印一条日志。
+
+### 相关权限
+
+不涉及。
+
+### 依赖
+
+不涉及。
+
+### 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备:华为手机。
+2. HarmonyOS系统:HarmonyOS 5.0.2 Release及以上。
+3. HarmonyOS SDK版本:HarmonyOS 5.0.2 Release及以上。
+4. 本示例需要使用DevEco Studio(5.0.3.910)及以上版本才可编译运行。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo PerformanceAnalysisKit/Hilog/ > .git/info/sparse-checkout
+git remote add origin https://gitee.com/harmonyos_samples/guide-snippets.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/build-profile.json5 b/PerformanceAnalysisKit/Hilog/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..98e34a6fed92767fb66a928752305c15921d9bef
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/build-profile.json5
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.2(14)",
+ "targetSdkVersion": "5.0.2(14)",
+ "runtimeOS": "HarmonyOS",
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/.gitignore b/PerformanceAnalysisKit/Hilog/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/build-profile.json5 b/PerformanceAnalysisKit/Hilog/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..2f39b314b0463d185785cab37bd4e36dcf91dbc7
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/build-profile.json5
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ "externalNativeOptions": {
+ "path": "./src/main/cpp/CMakeLists.txt",
+ "arguments": "",
+ "cppFlags": "",
+ "abiFilters": [
+ "x86_64",
+ "arm64-v8a"
+ ]
+ }
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ },
+ "nativeLib": {
+ "debugSymbol": {
+ "strip": true,
+ "exclude": []
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/hvigorfile.ts b/PerformanceAnalysisKit/Hilog/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e042e3f963ab27941d3b34f1f027da9933b81df1
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/PerformanceAnalysisKit/Hilog/entry/obfuscation-rules.txt b/PerformanceAnalysisKit/Hilog/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..fdbb5b9852d7dd5f39bddaeb21ab5ee1f3346749
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/obfuscation-rules.txt
@@ -0,0 +1,22 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/oh-package.json5 b/PerformanceAnalysisKit/Hilog/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..d55b3e8de9d84c6b79c43869a2b2f0948633f7ec
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/oh-package.json5
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {
+ "libentry.so": "file:./src/main/cpp/types/libentry"
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/cpp/CMakeLists.txt b/PerformanceAnalysisKit/Hilog/entry/src/main/cpp/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..08fade9bb8b366cb86b74a738ee2463526255dac
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/main/cpp/CMakeLists.txt
@@ -0,0 +1,16 @@
+# the minimum version of CMake.
+cmake_minimum_required(VERSION 3.5.0)
+project(CPP)
+
+set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+
+if(DEFINED PACKAGE_FIND_FILE)
+ include(${PACKAGE_FIND_FILE})
+endif()
+
+include_directories(${NATIVERENDER_ROOT_PATH}
+ ${NATIVERENDER_ROOT_PATH}/include)
+
+add_library(entry SHARED napi_init.cpp)
+target_link_libraries(entry PUBLIC libace_napi.z.so)
+target_link_libraries(entry PUBLIC libhilog_ndk.z.so)
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/cpp/napi_init.cpp b/PerformanceAnalysisKit/Hilog/entry/src/main/cpp/napi_init.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f7efb4e1ce06180480c9adc391607bf978ca20d2
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/main/cpp/napi_init.cpp
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start HiLog_CPP_Callback]
+#include "napi/native_api.h"
+// [StartExclude HiLog_CPP_Callback]
+// [Start HiLog_CPP_Header]
+#include "hilog/log.h"
+#undef LOG_DOMAIN
+#undef LOG_TAG
+#define LOG_DOMAIN 0x3200 // 全局domain宏,标识业务领域
+#define LOG_TAG "MY_TAG" // 全局tag宏,标识模块日志tag
+// [End HiLog_CPP_Header]
+// [EndExclude HiLog_CPP_Callback]
+
+void MyHiLog(const LogType type, const LogLevel level, const unsigned int domain, const char *tag, const char *msg)
+{
+ // user-defined to handle your log, such as redirect/filter
+ // 注意: 回调函数里面不允许再调用hilog接口打印日志,不然会死循环
+}
+
+static napi_value HiLogTest(napi_env env, napi_callback_info info)
+{
+ OH_LOG_SetCallback(MyHiLog);
+// [StartExclude HiLog_CPP_Callback]
+// [Start HiLog_CPP_Log_Error]
+ OH_LOG_ERROR(LOG_APP, "Failed to test");
+// [End HiLog_CPP_Log_Error]
+// [EndExclude HiLog_CPP_Callback]
+ return {};
+}
+// [End HiLog_CPP_Callback]
+EXTERN_C_START
+static napi_value Init(napi_env env, napi_value exports)
+{
+ napi_property_descriptor desc[] = {
+ { "HiLogTest", nullptr, HiLogTest, nullptr, nullptr, nullptr, napi_default, nullptr }
+ };
+ napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
+ return exports;
+}
+EXTERN_C_END
+
+static napi_module demoModule = {
+ .nm_version = 1,
+ .nm_flags = 0,
+ .nm_filename = nullptr,
+ .nm_register_func = Init,
+ .nm_modname = "entry",
+ .nm_priv = ((void*)0),
+ .reserved = { 0 },
+};
+
+extern "C" __attribute__((constructor)) void RegisterEntryModule(void)
+{
+ napi_module_register(&demoModule);
+}
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/cpp/types/libentry/Index.d.ts b/PerformanceAnalysisKit/Hilog/entry/src/main/cpp/types/libentry/Index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..38cfeee0f849bc795cd14ae2292d0096d4c03b13
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/main/cpp/types/libentry/Index.d.ts
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export const HiLogTest: () => void;
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/cpp/types/libentry/oh-package.json5 b/PerformanceAnalysisKit/Hilog/entry/src/main/cpp/types/libentry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..88838fa0b2042f057b1d730054d5698b61c7fb58
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/main/cpp/types/libentry/oh-package.json5
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "libentry.so",
+ "types": "./Index.d.ts",
+ "version": "1.0.0",
+ "description": "Please describe the basic information."
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/ets/entryability/EntryAbility.ets b/PerformanceAnalysisKit/Hilog/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0e490e3a4f8d3d18d7e4671881aab868c7c5dde9
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+};
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/PerformanceAnalysisKit/Hilog/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..29feaca7669174be5c2b0e2366529ee94ab7e726
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/ets/pages/Index.ets b/PerformanceAnalysisKit/Hilog/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..db2a084d1a8cf07eaf7acc1c542928488c0e3ead
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start HiLog_ArkTS]
+import { hilog } from '@kit.PerformanceAnalysisKit';
+// [StartExclude HiLog_ArkTS]
+import testNapi from 'libentry.so';
+// [EndExclude HiLog_ArkTS]
+@Entry
+@Component
+struct Index {
+ build() {
+ Row() {
+ Column() {
+ // 添加按钮,以响应用户点击
+ Button($r('app.string.HiLogArkTS_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('40%')
+ .height('5%')
+ // 按钮绑定onClick事件,点击时打印日志,注意realse hap包默认无法打印debug级别日志
+ .onClick(() => {
+ hilog.info(0xFF00, 'testTag', 'hilog_info_test');
+ hilog.debug(0xFF00, 'testTag', 'hilog_debug_test');
+ hilog.warn(0xFF00, 'testTag', 'hilog_warn_test');
+ hilog.fatal(0xFF00, 'testTag', 'hilog_fatal_test');
+ hilog.error(0xFF00, 'testTag', 'hilog_error_test');
+ //isLoggable是用来判断,domainID和tag是否满足目前的日志级别打印,建议对返回值进行判断
+ let ret = hilog.isLoggable(0xFF00, 'testTag', hilog.LogLevel.INFO);
+ if (ret) {
+ hilog.info(0xFF00, 'testTag',
+ 'A log with a domainID of 0xFF00 and a label of testTag can print logs at the Info level or higher.');
+ }
+ })
+// [StartExclude HiLog_ArkTS]
+ Button($r('app.string.HiLogCPP_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('40%')
+ .height('5%')
+ .onClick(() => {
+ testNapi.HiLogTest();
+ })
+// [EndExclude HiLog_ArkTS]
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
+// [End HiLog_ArkTS]
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/module.json5 b/PerformanceAnalysisKit/Hilog/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9f7f873fbc51484895e18fcfd60b2498521aecb0
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/main/module.json5
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/element/color.json b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/element/string.json b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..5250737a934da4c67468eddbc0f5450e0a216882
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,24 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "Hilog"
+ },
+ {
+ "name": "HiLogArkTS_Button",
+ "value": "HiLog ArkTS"
+ },
+ {
+ "name": "HiLogCPP_Button",
+ "value": "HiLog C++"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/media/background.png b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/media/background.png differ
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/media/foreground.png b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/media/foreground.png differ
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/media/layered_image.json b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/media/startIcon.png b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/profile/backup_config.json b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/profile/main_pages.json b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/resources/en_US/element/string.json b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..5250737a934da4c67468eddbc0f5450e0a216882
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,24 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "Hilog"
+ },
+ {
+ "name": "HiLogArkTS_Button",
+ "value": "HiLog ArkTS"
+ },
+ {
+ "name": "HiLogCPP_Button",
+ "value": "HiLog C++"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/main/resources/zh_CN/element/string.json b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..2b53d3178a02d340eff90ab5d9f271af1107ecd1
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,24 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "模块描述"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "Hilog"
+ },
+ {
+ "name": "HiLogArkTS_Button",
+ "value": "HiLog ArkTS"
+ },
+ {
+ "name": "HiLogCPP_Button",
+ "value": "HiLog C++"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/mock/Libentry.mock.ets b/PerformanceAnalysisKit/Hilog/entry/src/mock/Libentry.mock.ets
new file mode 100644
index 0000000000000000000000000000000000000000..37c4693badee0bced9f50f020403147ada0e8d44
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/mock/Libentry.mock.ets
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+const nativeMock: Record = {
+ 'add': (a: number, b: number) => {
+ return a + b;
+ },
+};
+
+export default nativeMock;
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/entry/src/mock/mock-config.json5 b/PerformanceAnalysisKit/Hilog/entry/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..25f4db9dcf89e656abe1a6776fe21cd00fc94dac
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/entry/src/mock/mock-config.json5
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "libentry.so": {
+ "source": "src/mock/Libentry.mock.ets"
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/hvigor/hvigor-config.json5 b/PerformanceAnalysisKit/Hilog/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..a2c44fdf8f9ac103168672568ff000ac395a2edc
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/hvigor/hvigor-config.json5
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "modelVersion": "5.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/PerformanceAnalysisKit/Hilog/hvigorfile.ts b/PerformanceAnalysisKit/Hilog/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..79d8761856e2996edc0649eca63b96b2c883b28a
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/PerformanceAnalysisKit/Hilog/oh-package.json5 b/PerformanceAnalysisKit/Hilog/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b7f346f7ddb2fc98ac428c55207a63ff89ea1c70
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "modelVersion": "5.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.18",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/PerformanceAnalysisKit/Hilog/ohosTest.md b/PerformanceAnalysisKit/Hilog/ohosTest.md
new file mode 100644
index 0000000000000000000000000000000000000000..dbd9ae1104aa54f79cce9bba6e0c1f3b9678448d
--- /dev/null
+++ b/PerformanceAnalysisKit/Hilog/ohosTest.md
@@ -0,0 +1,8 @@
+# Hilog测试用例归档
+
+## 用例表
+
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 |
+| ------------ | ------------ | ------------------------------ | ------------ | -------- | -------- |
+| 拉起应用 | 设备正常运行 | | 成功拉起应用 | 否 | Pass |
+| 主页按钮点击 | 位于主页 | 按readme的使用说明依次点击按钮 | 输出预期日志 | 否 | Pass |
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/Hilog/screenshots/Screenshot_20250219094412587.jpeg b/PerformanceAnalysisKit/Hilog/screenshots/Screenshot_20250219094412587.jpeg
new file mode 100644
index 0000000000000000000000000000000000000000..3b59a0831253071c972e85d7844e6a5a7b0dd534
Binary files /dev/null and b/PerformanceAnalysisKit/Hilog/screenshots/Screenshot_20250219094412587.jpeg differ
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/.gitignore b/PerformanceAnalysisKit/PerformanceAnalysisTool/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/.gitignore
@@ -0,0 +1,12 @@
+/node_modules
+/oh_modules
+/local.properties
+/.idea
+**/build
+/.hvigor
+.cxx
+/.clangd
+/.clang-format
+/.clang-tidy
+**/.test
+/.appanalyzer
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/AppScope/app.json5 b/PerformanceAnalysisKit/PerformanceAnalysisTool/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b7c5ff9405cabf3ae674f418453df6325d1c78fc
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "bundleName": "com.samples.performanceanalysistool",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/AppScope/resources/base/element/string.json b/PerformanceAnalysisKit/PerformanceAnalysisTool/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..d3d3d59b4a9553a2d1d4ee049eb97d05178641ca
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "PerformanceAnalysisTool"
+ }
+ ]
+}
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/AppScope/resources/base/media/app_icon.png b/PerformanceAnalysisKit/PerformanceAnalysisTool/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3
Binary files /dev/null and b/PerformanceAnalysisKit/PerformanceAnalysisTool/AppScope/resources/base/media/app_icon.png differ
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/README_zh.md b/PerformanceAnalysisKit/PerformanceAnalysisTool/README_zh.md
new file mode 100644
index 0000000000000000000000000000000000000000..b1cfb7a9fb99086f2bcb3f8a139475716fa4c90a
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/README_zh.md
@@ -0,0 +1,212 @@
+# 性能分析工具
+
+### 介绍
+
+本示例主要展示了使用性能分析的各个工具接口:
+
+HiTraceMeter提供系统性能打点接口。开发者通过在关键代码位置调用HiTraceMeter接口提供的API接口,能够有效跟踪进程轨迹、查看系统性能。
+
+HiTraceChain是基于云计算分布式跟踪调用链思想,在端侧业务流程(涉及跨线程、跨进程、跨设备)中的一种轻量级实现。hiTraceChain在业务控制面流程中,生成和传递唯一跟踪标识,在业务流程中输出的各类信息中(包括应用事件、系统时间、日志等)记录该跟踪标识。在调试、问题定位过程中,开发者可以通过该唯一跟踪标识将本次业务流程端到端的各类信息快速关联起来。
+
+HiChecker可以作为应用开发阶段使用的检测工具,用于检测代码运行过程中部分易忽略的问题,如应用线程出现耗时调用、应用进程中元能力资源泄露等问题。开发者可以通过日志记录或进程crash等形式查看具体问题并进行修改,提升应用的使用体验。
+
+HiDebug对外提供系统调试相关功能的接口,包括应用进程的静态堆内存(native heap)信息、应用进程内存占用PSS(Proportional Set Size)信息的获取等,也可完成虚拟机内存切片导出,虚拟机CPU Profiling采集等操作。
+
+HiCollie模块对外提供检测业务线程卡死、卡顿,以及上报卡死事件的能力。
+
+该工程中的展示的代码详细描述可查如下链接:
+
+- [使用HiTraceMeter跟踪性能(ArkTS/JS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hitracemeter-guidelines-arkts.md)
+
+- [使用HiTraceMeter跟踪性能(C/C++)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hitracemeter-guidelines-ndk.md)
+
+- [使用HiTraceChain打点(ArkTS/JS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hitracechain-guidelines-arkts.md)
+
+- [使用HiTraceChain打点(C/C++)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hitracechain-guidelines-ndk.md)
+
+- [使用HiChecker检测问题(ArkTS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hichecker-guidelines-arkts.md)
+
+- [使用HiDebug获取调试信息(ArkTS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hidebug-guidelines-arkts.md)
+
+- [使用HiDebug获取调试信息(C/C++)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hidebug-guidelines-ndk.md)
+
+- [使用HiCollie检测业务线程卡死卡顿问题(C/C++)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/dfx/hicollie-guidelines-ndk.md)
+
+### 效果预览
+
+| 主页 |
+| :----------------------------------------------------------: |
+|
|
+
+#### 使用说明
+
+##### 1.HiTraceMeter(ArkTS)使用说明
+
+1.在主界面点击按钮;DevEco Studio Terminal 中执行如下命令:
+
+```
+PS D:\xxx\xxx> hdc shell
+$ hitrace --trace_begin app
+```
+
+2.执行抓取trace命令后,先在设备中点击几次HiTraceMeter ArkTS按钮,继续在Terminal窗口执行命令:
+
+```
+$ hitrace --trace_dump | grep tracing_mark_write
+$ hitrace --trace_finish
+```
+
+3.成功输出如下数据即为成功:
+
+```
+<...>-3310 (-------) [005] .... 351382.921936: tracing_mark_write: S|3310|H:myTraceTest 1001
+<...>-3310 (-------) [005] .... 351382.922233: tracing_mark_write: C|3310|H:myTestCount 1
+<...>-3310 (-------) [005] .... 351382.922138: tracing_mark_write: S|3310|H:myTraceTest 1002
+<...>-3310 (-------) [005] .... 351382.922233: tracing_mark_write: C|3310|H:myTestCount 2
+<...>-3310 (-------) [005] .... 351382.922165: tracing_mark_write: F|3310|H:myTestCount 1001
+<...>-3310 (-------) [005] .... 351382.922175: tracing_mark_write: F|3310|H:myTestCount 1002
+```
+
+##### 2.HiTraceMeter(C++)使用说明
+
+1.将编译好的hap包推送到设备上安装,在DevEco Studio Terminal中执行命令:
+
+```
+PS D:\xxx\xxx> hdc shell
+$ hitrace --trace_begin app
+```
+
+2.执行抓取trace命令后,先在设备中点击几次HiTraceMeter C++按钮,然后在Terminal窗口执行命令:
+
+```
+$ hitrace --trace_dump | grep tracing_mark_write
+```
+
+3.成功输出如下数据即为成功:
+
+```
+<...>-2477 (-------) [001] .... 396.427165: tracing_mark_write: S|2477|H:hitraceTest 123
+<...>-2477 (-------) [001] .... 396.427196: tracing_mark_write: F|2477|H:hitraceTest 123
+```
+
+##### 3.HiTraceChain(ArkTS)使用说明
+
+1.在主界面点击HiTraceChain ArkTS按钮,然后切换到"Log"窗口,日志过滤选择"No filters",搜索内容设置为"HiTraceBegin"。查找输出如下的数据:
+
+```
+[a92ab145c9421d5, 0, 0] HiTraceBegin name:Write a new app event flags:0x01.
+```
+
+2.再搜索形如"[a92ab145c9421d5, 0, 0]"字样的内容,即可查看所有该业务的分布式跟踪信息:
+
+```
+[a92ab145c9421d5, 0, 0] HiTraceBegin name:Write a new app event flags:0x01.
+[a92ab145c9421d5, 0, 0] pid[24256] first get g_tagsProperty: 0
+[a92ab145c9421d5, 0, 0] [event_manager.cpp(835)-(100000:100000:scope)] id: 0, log: {types: Click, node: Button, prcd: Down, state: READY, prcd: Up, state: SUCCEED}
+[a92ab145c9421d5, 0, 0] [event_manager.cpp(1817)-(100000:100000:scope)] Consumed new event id=5591 in ace_container, lastEventInfo: id:5590
+```
+
+##### 4.HiTraceChain(C++)使用说明
+
+1.在主界面点击HiTraceChain C++按钮,切换到"Log"窗口,日志过滤选择"No filters",搜索内容设置为"hitraceTest"。成功输出如下数据即为成功:
+
+```
+HiTraceBegin name:hitraceTest flags:0x00.
+```
+
+##### 5.HiChecker(ArkTS)使用说明
+
+1.先在DevEco Studio Terminal 中执行如下命令:
+
+```
+PS D:\xxx\xxx> hdc shell
+$ hilog|grep -i hichecker
+```
+
+2.hichecker功能调用写在应用启动时,启动应用时(注意要先执行上一步,如已经启动可以重新启动应用),Log窗口有如下调用栈信息说明检测成功,成功的数据如下所示:
+
+```
+01-05 19:40:22.837 7782 7782 I C02d0b/HICHECKER: HiChecker caution with RULE_CAUTION_PRINT_LOG.
+01-05 19:40:22.837 7782 7782 I C02d0b/HICHECKER: CautionMsg:trigger:RULE_THREAD_CHECK_SLOW_PROCESS,Trigger: pid = 7782, tid = 7782
+01-05 19:40:22.837 7782 7782 I C02d0b/HICHECKER: StackTrace:
+01-05 19:40:22.837 7782 7782 I C02d0b/HICHECKER: Tid:7782, Name:m.example.arkts
+01-05 19:40:22.837 7782 7782 I C02d0b/HICHECKER: #00 pc 00002bad /system/lib/platformsdk/libhichecker.so(OHOS::HiviewDFX::HiChecker::NotifySlowProcess(std::__h::basic_string, std::__h::allocator> const&)+48)(d13fb7fce5b5364c7a3994c95f66c6c2)
+01-05 19:40:22.837 7782 7782 I C02d0b/HICHECKER: #01 pc 000707cf /system/lib/platformsdk/libimage_napi.z.so(fd73ffee97d631ca6aebf63145d4abf5)
+01-05 19:40:22.837 7782 7782 I C02d0b/HICHECKER: #02 pc 00073b4b /system/lib/platformsdk/libimage_napi.z.so(fd73ffee97d631ca6aebf63145d4abf5)
+......
+```
+
+##### 6.HiDebug(ArkTS)使用说明
+
+1.在主界面,点击HiDebug ArkTS按钮;切换到"Log"窗口,日志过滤选择"No filters",搜索内容设置为"testTag"。成功输出如下数据即为成功:
+
+```
+GetSystemCpuUsage: 0.069260
+```
+
+##### 7.HiDebug(C++)使用说明
+
+1.在主界面,点击HiDebug C++按钮;切换到"Log"窗口,日志过滤选择"No filters",搜索内容设置为"testTag"。成功输出如下数据即为成功:
+
+```
+GetSystemCpuUsage: 0.078654
+```
+
+##### 8.HiCollie(C++)使用说明
+
+1.应用刚启动10s内,不进行卡顿检测,等待10s,再在主界面依次点击"testHiCollieJankNDK"按钮和"testHiCollieStuckNDK",切换到"Log"窗口,日志过滤选择"No filters",搜索内容设置为"testTag"。成功输出如下数据即为成功:
+
+```
+OH_HiCollie_Init_JankDetection: 0
+OH_HiCollie_Init_StuckDetection: 0
+```
+
+生成栈文件目录地址:/data/app/el2/100/log/应用bundle name/watchdog/BUSSINESS_THREAD_JANK_XXX.txt。
+
+### 工程目录
+
+```
+entry/src/main
+├─cpp
+│ ├─CMakeLists.txt //导入so链接
+│ └─napi_init.cpp //C++功能函数
+└─ets
+ └─entryability
+ │ └─EntryAbility.ets //生命周期
+ └─pages
+ └─Index.ets //主页
+```
+
+### 具体实现
+
+1. ArkTS项目可以在"@kit.PerformanceAnalysisKit"中导入对应模块即可在各种场景下调用对应函数,如在index.ets中直接调用,或者在EntryAbility.ets函数中在应用的各个生命周期内添加功能函数以实现应用自动在“启动”或“结束”时进行性能分析。
+1. C++项目可以在CMakeLists.txt里的target_link_libraries中添加对应功能的包,在napi_init.cpp中添加注册自定义C++功能函数(还需在index.d.ts中声明)后,即可在各种场景下通过"libentry.so"库自定义一个对象来调用注册声明的测试函数即可。
+
+### 相关权限
+
+不涉及。
+
+### 依赖
+
+不涉及。
+
+### 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备:华为手机。
+2. HarmonyOS系统:HarmonyOS 5.0.2 Release及以上。
+3. HarmonyOS SDK版本:HarmonyOS 5.0.2 Release及以上。
+4. 本示例需要使用DevEco Studio(5.0.3.910)及以上版本才可编译运行。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo PerformanceAnalysisKit/PerformanceAnalysisTool/ > .git/info/sparse-checkout
+git remote add origin https://gitee.com/harmonyos_samples/guide-snippets.git
+git pull origin master
+```
+
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/build-profile.json5 b/PerformanceAnalysisKit/PerformanceAnalysisTool/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9c284a291dc2cd15abf8025431e67aa253f01b81
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/build-profile.json5
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.2(14)",
+ "targetSdkVersion": "5.0.2(14)",
+ "runtimeOS": "HarmonyOS",
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/.gitignore b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/build-profile.json5 b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..1e2ece10194943f2a5059c7bf3f7771b1b2c3d4e
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/build-profile.json5
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ "externalNativeOptions": {
+ "path": "./src/main/cpp/CMakeLists.txt",
+ "arguments": "",
+ "cppFlags": "",
+ "abiFilters": ["arm64-v8a", "x86_64"]
+ }
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ },
+ "nativeLib": {
+ "debugSymbol": {
+ "strip": true,
+ "exclude": []
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/hvigorfile.ts b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/obfuscation-rules.txt b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..fdbb5b9852d7dd5f39bddaeb21ab5ee1f3346749
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/obfuscation-rules.txt
@@ -0,0 +1,22 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/oh-package.json5 b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..118bdd4fe7699368a010e04c24f5bfc887cf1298
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/oh-package.json5
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {
+ "libentry.so": "file:./src/main/cpp/types/libentry"
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/cpp/CMakeLists.txt b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/cpp/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..caf71c703b92402613471f35e7b162e0978dd7e8
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/cpp/CMakeLists.txt
@@ -0,0 +1,16 @@
+# the minimum version of CMake.
+cmake_minimum_required(VERSION 3.5.0)
+project(CPP2)
+
+set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+
+if(DEFINED PACKAGE_FIND_FILE)
+ include(${PACKAGE_FIND_FILE})
+endif()
+
+include_directories(${NATIVERENDER_ROOT_PATH}
+ ${NATIVERENDER_ROOT_PATH}/include)
+
+add_library(entry SHARED napi_init.cpp)
+target_link_libraries(entry PUBLIC libace_napi.z.so libohhidebug.so libhitrace_ndk.z.so libhilog_ndk.z.so
+ libohhicollie.so)
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/cpp/napi_init.cpp b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/cpp/napi_init.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4cb7ea50efdad4aee8a7cda211a3a0a5f00152c2
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/cpp/napi_init.cpp
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start napi_Header]
+#include "napi/native_api.h"
+#include "hitrace/trace.h"
+#include "hilog/log.h"
+#include "hidebug/hidebug.h"
+#include "hicollie/hicollie.h"
+#include
+#include
+#include
+#include
+
+#undef LOG_TAG
+#define LOG_TAG "testTag"
+// [End napi_Header]
+// [Start HiCollie]
+static OH_HiCollie_BeginFunc beginFunc_; // 定义回调函数对象
+static OH_HiCollie_EndFunc endFunc_; // 定义回调函数对象
+HiCollie_DetectionParam param{.sampleStackTriggerTime = 150, .reserved = 0}; // 定义结构体
+int64_t g_lastWatchTime = 0; // 记录上次卡死检测时间
+const int64_t CHECK_INTERNAL_TIME = 3000; // 设置卡死检测间隔
+std::shared_ptr> isReport = std::make_shared>(false); // 设置上报卡死事件标志位
+int g_count = 0; // 记录第一次初始化
+bool g_needReport = false; // 根据实际场景,设置是否上报标志
+
+// 定义回调函数
+void InitBeginFunc(const char *eventName)
+{
+ std::string str(eventName);
+ OH_LOG_INFO(LogType::LOG_APP, "InitBeginFunc eventName: %{public}s", str.c_str());
+}
+void InitEndFunc(const char *eventName)
+{
+ std::string str(eventName);
+ OH_LOG_INFO(LogType::LOG_APP, "OH_HiCollie_EndFunc eventName: %{public}s", str.c_str());
+}
+// 定义子线程回调函数
+void TestJankDetection()
+{
+ beginFunc_ = InitBeginFunc; // 初始化回调函数
+ endFunc_ = InitEndFunc;
+ int initResult = OH_HiCollie_Init_JankDetection(&beginFunc_, &endFunc_, param); // 初始化线程卡顿监控函数
+ OH_LOG_INFO(LogType::LOG_APP, "OH_HiCollie_Init_JankDetection: %{public}d", initResult); // 成功结果:0
+ int countOuter = 0;
+ const int loopLimit = 2; //循环次数限制
+ const int sleepTime = 350 * 1000; //睡眠时间350ms,模拟任务线程处理事件卡顿场景
+ while (countOuter < loopLimit) {
+ beginFunc_("TestBegin"); // 设置处理开始回调函数,监控线程任务执行开始时长
+ usleep(sleepTime);
+ endFunc_("TestEnd"); // 设置处理结束回调函数,监控线程任务执行结束时长
+ countOuter++;
+ }
+}
+
+static napi_value TestHiCollieJankNdk(napi_env env, napi_callback_info info)
+{
+ std::thread threadObj(TestJankDetection); // 创建子线程
+ threadObj.join(); // 执行回调函数
+ return 0;
+}
+
+int64_t GetCurrentTime()
+{
+ return std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch())
+ .count();
+}
+
+bool ReportEvent()
+{
+ if ((GetCurrentTime() - g_lastWatchTime) > CHECK_INTERNAL_TIME) {
+ return true;
+ }
+ return false;
+}
+
+void TestTask()
+{
+ if (g_needReport && ReportEvent()) {
+ bool temp = isReport->load();
+ int reportResult = OH_HiCollie_Report(&temp);
+ OH_LOG_INFO(LogType::LOG_APP, "OH_HiCollie_Report: %{public}d", reportResult); // 成功结果:0
+ OH_LOG_INFO(LogType::LOG_APP, "OH_HiCollie_Report isReport: %{public}d", temp);
+ g_needReport = false;
+ }
+ int64_t now = GetCurrentTime();
+ int64_t halfCheckInterval = CHECK_INTERNAL_TIME / 2;
+ if ((now - g_lastWatchTime) >= (halfCheckInterval)) {
+ g_lastWatchTime = now;
+ }
+}
+
+// 定义子线程回调函数
+void TestStuckDetection()
+{
+ int initResult = -1;
+ if (g_count == 0) {
+ initResult = OH_HiCollie_Init_StuckDetection(TestTask); // 初始化线程卡死监控函数
+ OH_LOG_INFO(LogType::LOG_APP, "OH_HiCollie_Init_StuckDetection: %{public}d", initResult); // 成功结果:0
+ g_count++;
+ }
+}
+static napi_value TestHiCollieStuckNdk(napi_env env, napi_callback_info info)
+{
+ std::thread threadObj(TestStuckDetection); // 创建子线程
+ threadObj.join(); // 执行回调函数
+ return 0;
+}
+// [End HiCollie]
+// [Start HiTraceMeterNDK]
+static napi_value TestHiTraceMeterNDK(napi_env env, napi_callback_info info)
+{
+ // 测试标记数
+ int testNum = 123;
+ // 需要开启异步时间片跟踪的地方
+ OH_HiTrace_StartAsyncTrace("hitraceTest", testNum);
+ // 需要结束异步时间片跟踪的地方(此处为示例,开启点和结束点按实际需求放在需要的地方)
+ OH_HiTrace_FinishAsyncTrace("hitraceTest", testNum);
+ return 0;
+}
+// [End HiTraceMeterNDK]
+// [Start HiTraceChainNDK]
+static napi_value TestHiTraceChainNDK(napi_env env, napi_callback_info info)
+{
+ // 需要开启分布式跟踪的地方
+ OH_HiTrace_BeginChain("hitraceTest", HITRACE_FLAG_DEFAULT);
+ // 需要结束分布式跟踪的地方(此处为示例,开启点和结束点按实际需求放在需要的地方)
+ OH_HiTrace_EndChain();
+ return 0;
+}
+// [End HiTraceChainNDK]
+// [Start TestHidebugNdk]
+static napi_value TestHidebugNdk(napi_env env, napi_callback_info info)
+{
+ double cpuUsage = OH_HiDebug_GetSystemCpuUsage();
+ OH_LOG_INFO(LogType::LOG_APP, "GetSystemCpuUsage: %{public}f", cpuUsage);
+ return 0;
+}
+// [End TestHidebugNdk]
+EXTERN_C_START
+// [Start Init_All]
+static napi_value Init(napi_env env, napi_value exports)
+{
+ napi_property_descriptor desc[] = {
+ { "testHidebugNdk", nullptr, TestHidebugNdk, nullptr, nullptr, nullptr, napi_default, nullptr },
+ { "testHiTraceMeterNDK", nullptr, TestHiTraceMeterNDK, nullptr, nullptr, nullptr, napi_default, nullptr },
+ { "testHiTraceChainNDK", nullptr, TestHiTraceChainNDK, nullptr, nullptr, nullptr, napi_default, nullptr },
+ { "testHiCollieJankNdk", nullptr, TestHiCollieJankNdk, nullptr, nullptr, nullptr, napi_default, nullptr },
+ { "testHiCollieStuckNdk", nullptr, TestHiCollieStuckNdk, nullptr, nullptr, nullptr, napi_default, nullptr }
+ };
+ napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
+ return exports;
+}
+// [End Init_All]
+EXTERN_C_END
+
+static napi_module demoModule = {
+ .nm_version = 1,
+ .nm_flags = 0,
+ .nm_filename = nullptr,
+ .nm_register_func = Init,
+ .nm_modname = "entry",
+ .nm_priv = ((void*)0),
+ .reserved = { 0 },
+};
+
+extern "C" __attribute__((constructor)) void RegisterEntryModule(void)
+{
+ napi_module_register(&demoModule);
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/cpp/types/libentry/Index.d.ts b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/cpp/types/libentry/Index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..80cf8933153351d6b66fd5cf60931e88765dde21
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/cpp/types/libentry/Index.d.ts
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start Project_Index.d.ts]
+export const testHiCollieJankNdk: () => void;
+export const testHiCollieStuckNdk: () => void;
+export const testHiTraceMeterNDK: () => void;
+export const testHiTraceChainNDK: () => void;
+export const testHidebugNdk: () => void;
+// [End Project_Index.d.ts]
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/cpp/types/libentry/oh-package.json5 b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/cpp/types/libentry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..6abf3b7c20f22c62aaac6a995a25cae672f73f35
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/cpp/types/libentry/oh-package.json5
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "libentry.so",
+ "types": "./Index.d.ts",
+ "version": "1.0.0",
+ "description": "Please describe the basic information."
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/ets/entryability/EntryAbility.ets b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..bc49539458b021f759d9440c4d3edc25dd93ffa9
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start HiChecker]
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hichecker, hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+import { image } from '@kit.ImageKit';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ // 添加检测规则,规则意义见检测模式API参考
+ hichecker.addCheckRule(hichecker.RULE_CAUTION_PRINT_LOG|hichecker.RULE_THREAD_CHECK_SLOW_PROCESS);
+ let filePath: string = this.context.cacheDir + '/test.JPG';
+ const imageSourceApi: image.ImageSource = image.createImageSource(filePath);
+ const imagePackerApi = image.createImagePacker();
+ let packOpts: image.PackingOption = { format:"image/jpeg", quality:98 };
+ imagePackerApi.packing(imageSourceApi, packOpts);
+ // 以上5行通过image子系统触发检测规则
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+};
+// [End HiChecker]
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b1e212947256c5533c7b06285a597c94f840a6e3
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/ets/pages/Index.ets b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c51910f37d7543e18ff3510fc7b22f111f276b59
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start Project_Header]
+import { hilog, hiTraceMeter, hiTraceChain, hidebug, hiAppEvent } from '@kit.PerformanceAnalysisKit';
+import { BusinessError } from '@kit.BasicServicesKit';
+import testNapi from 'libentry.so';
+// [End Project_Header]
+// [Start testHidebug]
+function testHidebug(event?: ClickEvent) {
+ try {
+ hilog.info(0x0000, 'testTag', `getSystemCpuUsage ${hidebug.getSystemCpuUsage()}`);
+ } catch (err) {
+ hilog.error(0x0000, 'testTag', `error message is ${(err as BusinessError).message}`);
+ }
+}
+// [End testHidebug]
+@Entry
+@Component
+struct Index {
+ build() {
+ Row() {
+ Column() {
+ // [Start HiTraceMeterArkTS_Button]
+ Button($r('app.string.HiTraceMeterArkTS_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('60%')
+ .height('5%')
+ .onClick(() => {
+ let traceCount = 0;
+ // 第一个跟踪任务开始
+ hiTraceMeter.startTrace("myTraceTest", 1001);
+ // 开始计数任务
+ traceCount++;
+ hiTraceMeter.traceByValue("myTestCount", traceCount);
+ // 业务流程
+ console.log(`myTraceTest running, taskid: 1001`);
+ // 第二个跟踪任务开始,同时第一个跟踪的同名任务还没结束,出现了并行执行,对应接口的taskId需要不同。
+ hiTraceMeter.startTrace("myTraceTest", 1002);
+ // 开始计数任务
+ traceCount++;
+ hiTraceMeter.traceByValue("myTestCount", traceCount);
+ // 业务流程
+ console.log(`myTraceTest running, taskid: 1002`);
+ // 结束taskId为1001的跟踪任务
+ hiTraceMeter.finishTrace("myTraceTest", 1001);
+ // 结束taskId为1002的跟踪任务
+ hiTraceMeter.finishTrace("myTraceTest", 1002);
+ })
+ // [End HiTraceMeterArkTS_Button]
+ // [Start HiTraceChainArkTS_Button]
+ Button($r('app.string.HiTraceChainArkTS_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('60%')
+ .height('5%')
+ .onClick(() => {
+ try {
+ // 业务开始前,开启分布式跟踪。
+ let traceId = hiTraceChain.begin("Write a new app event", hiTraceChain.HiTraceFlag.INCLUDE_ASYNC);
+ // 在按钮点击函数中进行事件打点,以记录按钮点击事件
+ let eventParams: Record = { 'click_time': 100 };
+ let eventInfo: hiAppEvent.AppEventInfo = {
+ // 事件领域定义
+ domain: "button",
+ // 事件名称定义
+ name: "click",
+ // 事件类型定义
+ eventType: hiAppEvent.EventType.BEHAVIOR,
+ // 事件参数定义
+ params: eventParams,
+ };
+ hiAppEvent.write(eventInfo).then(() => {
+ hilog.info(0x0000, 'testTag', `Succeed to write an app event`);
+ // 业务结束,关闭分布式跟踪。
+ hiTraceChain.end(traceId);
+ }).catch((err: BusinessError) => {
+ hilog.error(0x0000, 'testTag', `HiAppEvent err.code: ${err.code}, err.message: ${err.message}`);
+ })
+ } catch (err) {
+ console.error(`error message is ${(err as BusinessError).message}`);
+ }
+ })
+ // [End HiTraceChainArkTS_Button]
+ // [Start HiDebugArkTS_Button]
+ Button($r('app.string.HiDebugArkTS_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('60%')
+ .height('5%')
+ // 添加点击事件
+ .onClick(testHidebug);
+ // [End HiDebugArkTS_Button]
+ Button($r('app.string.HiCheckerArkTS_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('60%')
+ .height('5%')
+ }
+ .width('50%')
+
+ Column() {
+ Button($r('app.string.HiTraceMeterCPP_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('60%')
+ .height('5%')
+ .onClick(() => {
+ hilog.info(0x0000, 'testTag', 'HiTraceMeter C++', testNapi.testHiTraceMeterNDK());
+ })
+ // [Start HiTraceChainCPP_Button]
+ Button($r('app.string.HiTraceChainCPP_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('60%')
+ .height('5%')
+ .onClick(() => {
+ hilog.info(0x0000, 'testTag', 'HiTraceChain C++', testNapi.testHiTraceChainNDK());
+ })
+ // [End HiTraceChainCPP_Button]
+ // [Start HiDebugCPP_Button]
+ Button($r('app.string.HiDebugCPP_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('60%')
+ .height('5%')
+ // 添加点击事件,触发testHidebugNdk方法。
+ .onClick(testNapi.testHidebugNdk);
+ // [End HiDebugCPP_Button]
+ // [Start HiCollie_Buttons]
+ Button($r('app.string.TestHiCollieJankNdk_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('60%')
+ .height('5%')
+ // 添加点击事件,触发testHiCollieJankNdk方法
+ .onClick(testNapi.testHiCollieJankNdk);
+
+ Button($r('app.string.TestHiCollieStuckNdk_Button'))
+ .type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('60%')
+ .height('5%')
+ // 添加点击事件,触发testHiCollieStuckNdk方法
+ .onClick(testNapi.testHiCollieStuckNdk);
+ // [End HiCollie_Buttons]
+ }
+ .width('50%')
+ }
+ .height('100%')
+ }
+}
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/module.json5 b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..4144486d1af4c03b0d767cce1cda86fc0d697f91
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/module.json5
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/element/color.json b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/element/string.json b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..4596ea75d36df620d81e1edd6cd22e6a475579fe
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,52 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "PerformanceAnalysis"
+ },
+ {
+ "name": "HiTraceMeterArkTS_Button",
+ "value": "HiTraceMeter ArkTS"
+ },
+ {
+ "name": "HiCheckerArkTS_Button",
+ "value": "HiChecker ArkTS"
+ },
+ {
+ "name": "HiTraceMeterCPP_Button",
+ "value": "HiTraceMeter C++"
+ },
+ {
+ "name": "HiDebugArkTS_Button",
+ "value": "HiDebug ArkTS"
+ },
+ {
+ "name": "HiTraceChainArkTS_Button",
+ "value": "HiTraceChain ArkTS"
+ },
+ {
+ "name": "HiTraceChainCPP_Button",
+ "value": "HiTraceChain C++"
+ },
+ {
+ "name": "HiDebugCPP_Button",
+ "value": "HiDebug C++"
+ },
+ {
+ "name": "TestHiCollieJankNdk_Button",
+ "value": "testHiCollieJankNdk"
+ },
+ {
+ "name": "TestHiCollieStuckNdk_Button",
+ "value": "testHiCollieStuckNdk"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/media/background.png b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/media/background.png differ
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/media/foreground.png b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/media/foreground.png differ
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/media/layered_image.json b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/media/startIcon.png b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/profile/backup_config.json b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/profile/main_pages.json b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/en_US/element/string.json b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..81ad948420a1099cf45347304b9cfa78259a3d2a
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,52 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "PerformanceAnalysis"
+ },
+ {
+ "name": "HiTraceMeterArkTS_Button",
+ "value": "HiTraceMeter ArkTS"
+ },
+ {
+ "name": "HiTraceChainArkTS_Button",
+ "value": "HiTraceChain ArkTS"
+ },
+ {
+ "name": "HiDebugArkTS_Button",
+ "value": "HiDebug ArkTS"
+ },
+ {
+ "name": "HiCheckerArkTS_Button",
+ "value": "HiChecker ArkTS"
+ },
+ {
+ "name": "HiTraceMeterCPP_Button",
+ "value": "HiTraceMeter C++"
+ },
+ {
+ "name": "HiTraceChainCPP_Button",
+ "value": "HiTraceChain C++"
+ },
+ {
+ "name": "HiDebugCPP_Button",
+ "value": "HiDebug C++"
+ },
+ {
+ "name": "TestHiCollieJankNdk_Button",
+ "value": "testHiCollieJankNdk"
+ },
+ {
+ "name": "TestHiCollieStuckNdk_Button",
+ "value": "testHiCollieStuckNdk"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/zh_CN/element/string.json b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..b6d9094a1dec50d45253440d187ba073e440a313
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,52 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "模块描述"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "性能分析"
+ },
+ {
+ "name": "HiTraceMeterArkTS_Button",
+ "value": "HiTraceMeter ArkTS"
+ },
+ {
+ "name": "HiTraceChainArkTS_Button",
+ "value": "HiTraceChain ArkTS"
+ },
+ {
+ "name": "HiDebugArkTS_Button",
+ "value": "HiDebug ArkTS"
+ },
+ {
+ "name": "HiCheckerArkTS_Button",
+ "value": "HiChecker ArkTS"
+ },
+ {
+ "name": "HiTraceMeterCPP_Button",
+ "value": "HiTraceMeter C++"
+ },
+ {
+ "name": "HiTraceChainCPP_Button",
+ "value": "HiTraceChain C++"
+ },
+ {
+ "name": "HiDebugCPP_Button",
+ "value": "HiDebug C++"
+ },
+ {
+ "name": "TestHiCollieJankNdk_Button",
+ "value": "testHiCollieJankNdk"
+ },
+ {
+ "name": "TestHiCollieStuckNdk_Button",
+ "value": "testHiCollieStuckNdk"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/hvigor/hvigor-config.json5 b/PerformanceAnalysisKit/PerformanceAnalysisTool/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..43beb743cbd25c3507b1cf8a744bf8197b3bf2fb
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/hvigor/hvigor-config.json5
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "modelVersion": "5.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/hvigorfile.ts b/PerformanceAnalysisKit/PerformanceAnalysisTool/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2a5e543f190732c159beb574dfc9fa37bc94e156
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/oh-package.json5 b/PerformanceAnalysisKit/PerformanceAnalysisTool/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..952ab183532e81c9c50e5de1e64393704e1e48fe
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "modelVersion": "5.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.18",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/ohosTest.md b/PerformanceAnalysisKit/PerformanceAnalysisTool/ohosTest.md
new file mode 100644
index 0000000000000000000000000000000000000000..ceb8bc593156530ee1566d31ac1b16c3b1e68cf0
--- /dev/null
+++ b/PerformanceAnalysisKit/PerformanceAnalysisTool/ohosTest.md
@@ -0,0 +1,8 @@
+# 性能分析工具测试用例归档
+
+## 用例表
+
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 |
+| ------------ | ------------ | ------------------------------ | ------------ | -------- | -------- |
+| 拉起应用 | 设备正常运行 | | 成功拉起应用 | 否 | Pass |
+| 主页按钮点击 | 位于主页 | 按readme的使用说明依次点击按钮 | 输出预期日志 | 否 | Pass |
\ No newline at end of file
diff --git a/PerformanceAnalysisKit/PerformanceAnalysisTool/screenshots/Screenshot_20241217162307411.jpeg b/PerformanceAnalysisKit/PerformanceAnalysisTool/screenshots/Screenshot_20241217162307411.jpeg
new file mode 100644
index 0000000000000000000000000000000000000000..d56ad50fa9534d3e4e1b079fd941e3ab741358d0
Binary files /dev/null and b/PerformanceAnalysisKit/PerformanceAnalysisTool/screenshots/Screenshot_20241217162307411.jpeg differ