From 08b30b0697ff1e1bff330de8c5a9ea7420f79697 Mon Sep 17 00:00:00 2001 From: link <18727210873@163.com> Date: Mon, 16 Jun 2025 14:36:14 +0800 Subject: [PATCH 1/3] =?UTF-8?q?perfmonitor=E8=B5=84=E6=96=99=E8=A1=A5?= =?UTF-8?q?=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js-apis-arkui-performancemonitor-sys.md | 68 +++++++++++++++++-- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/zh-cn/application-dev/reference/apis-arkui/js-apis-arkui-performancemonitor-sys.md b/zh-cn/application-dev/reference/apis-arkui/js-apis-arkui-performancemonitor-sys.md index 025c52d4b84..e11ae5a29d0 100644 --- a/zh-cn/application-dev/reference/apis-arkui/js-apis-arkui-performancemonitor-sys.md +++ b/zh-cn/application-dev/reference/apis-arkui/js-apis-arkui-performancemonitor-sys.md @@ -1,6 +1,6 @@ # @ohos.arkui.performanceMonitor (性能监测)(系统接口) -用户操作场景提供性能相关指标监测能力,目前仅包含响应时延、完成时延、丢帧。 +提供用户操作场景性能相关指标监测能力,在场景开始和结束时分别调用begin和end接口,即可获得该场景相关性能指标,目前仅包含响应时延、完成时延、丢帧。 > **说明:** > @@ -18,7 +18,7 @@ import { performanceMonitor } from '@kit.ArkUI'; ## ActionType -用户场景触发模式枚举。 +用户场景(通常为具有动效的场景)触发模式枚举。 **系统能力:** SystemCapability.ArkUI.ArkUI.Full @@ -29,11 +29,26 @@ import { performanceMonitor } from '@kit.ArkUI'; | FIRST_MOVE | 2 | 用户首次滑动事件触发。 | +## SourceType12+ + +用户场景触发源类型枚举。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +| 名称 | 值 | 说明 | +| -- | -- | -- | +| PERF_TOUCH_EVENT | 0 | 触摸屏事件。 | +| PERF_MOUSE_EVENT | 1 | 鼠标事件。 | +| PERF_TOUCHPAD_EVENT | 2 | 触摸板事件。 | +| PERF_JOYSTICK_EVENT | 3 | 摇杆事件。 | +| PERF_KEY_EVENT | 4 | 键盘事件。 | + + ## performanceMonitor.begin begin(scene: string, startInputType: ActionType, note?: string): void -用户场景开始。 +用于标记用户场景开始,用户场景开始时调用此接口。 **系统能力:** SystemCapability.ArkUI.ArkUI.Full @@ -47,6 +62,8 @@ begin(scene: string, startInputType: ActionType, note?: string): void | note | string| 否 | 用户场景重要信息。 | **示例:** + +用户点击图标启动应用场景动效开始点,由离手事件LAST_UP触发。 ```ts performanceMonitor.begin("LAUNCHER_APP_LAUNCH_FROM_ICON", performanceMonitor.ActionType.LAST_UP, "APP_START_BEGIN"); ``` @@ -56,7 +73,7 @@ performanceMonitor.begin("LAUNCHER_APP_LAUNCH_FROM_ICON", performanceMonitor.Act end(scene: string): void -用户场景结束 +用于标记用户场景结束,用户场景结束时调用此接口。 **系统能力:** SystemCapability.ArkUI.ArkUI.Full @@ -66,6 +83,47 @@ end(scene: string): void | scene | string | 是 | 用户场景id,与begin配对。 | **示例:** + +用户点击图标应用场景动效结束点 ```ts performanceMonitor.end("LAUNCHER_APP_LAUNCH_FROM_ICON"); - ``` \ No newline at end of file + ``` + +## performanceMonitor.recordInputEventTime12+ + +recordInputEventTime(type: ActionType, sourceType: sourceType, time: number): void + +记录动效场景开始前,用户输入触发事件类型与时间。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**参数:** +| 参数名 | 类型 | 必填 | 说明 | +| -- | -- | -- | -- | +| type | [ActionType](#actiontype)| 是 | 用户场景触发模式。 | +| sourceType | [SourceType](#sourcetype12) | 是 | 用户场景触发源。 | +| time | number | 是 | 场景触发时间。 | + +**错误码:** + +以下错误码详细介绍请参考[通用错误码](../errorcode-universal.md)。 + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 202 | not system application. | + +**示例:** + +```ts +import { systemDateTime, BusinessError } from '@kit.BasicServicesKit'; +import { performanceMonitor } from '@kit.ArkUI'; + +let time = systemDateTime.getTime(false); +try { + performanceMonitor.recordInputEventTime(performanceMonitor.ActionType.LAST_UP, performanceMonitor.SourceType.PERF_MOUSE_EVENT, time); +} catch (paramError) { + let code: number = (paramError as BusinessError).code; + let message: string = (paramError as BusinessError).message; + console.error(`error.code: ${code}, error.message: ${message}`); +} +``` \ No newline at end of file -- Gitee From 263fde99387bd299978f82a27710eac9501b1bbc Mon Sep 17 00:00:00 2001 From: link <18727210873@163.com> Date: Fri, 20 Jun 2025 07:04:54 +0000 Subject: [PATCH 2/3] =?UTF-8?q?Revert=20"perfmonitor=E8=B5=84=E6=96=99?= =?UTF-8?q?=E8=A1=A5=E5=85=85"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 08b30b0697ff1e1bff330de8c5a9ea7420f79697. --- .../js-apis-arkui-performancemonitor-sys.md | 68 ++----------------- 1 file changed, 5 insertions(+), 63 deletions(-) diff --git a/zh-cn/application-dev/reference/apis-arkui/js-apis-arkui-performancemonitor-sys.md b/zh-cn/application-dev/reference/apis-arkui/js-apis-arkui-performancemonitor-sys.md index e11ae5a29d0..025c52d4b84 100644 --- a/zh-cn/application-dev/reference/apis-arkui/js-apis-arkui-performancemonitor-sys.md +++ b/zh-cn/application-dev/reference/apis-arkui/js-apis-arkui-performancemonitor-sys.md @@ -1,6 +1,6 @@ # @ohos.arkui.performanceMonitor (性能监测)(系统接口) -提供用户操作场景性能相关指标监测能力,在场景开始和结束时分别调用begin和end接口,即可获得该场景相关性能指标,目前仅包含响应时延、完成时延、丢帧。 +用户操作场景提供性能相关指标监测能力,目前仅包含响应时延、完成时延、丢帧。 > **说明:** > @@ -18,7 +18,7 @@ import { performanceMonitor } from '@kit.ArkUI'; ## ActionType -用户场景(通常为具有动效的场景)触发模式枚举。 +用户场景触发模式枚举。 **系统能力:** SystemCapability.ArkUI.ArkUI.Full @@ -29,26 +29,11 @@ import { performanceMonitor } from '@kit.ArkUI'; | FIRST_MOVE | 2 | 用户首次滑动事件触发。 | -## SourceType12+ - -用户场景触发源类型枚举。 - -**系统能力:** SystemCapability.ArkUI.ArkUI.Full - -| 名称 | 值 | 说明 | -| -- | -- | -- | -| PERF_TOUCH_EVENT | 0 | 触摸屏事件。 | -| PERF_MOUSE_EVENT | 1 | 鼠标事件。 | -| PERF_TOUCHPAD_EVENT | 2 | 触摸板事件。 | -| PERF_JOYSTICK_EVENT | 3 | 摇杆事件。 | -| PERF_KEY_EVENT | 4 | 键盘事件。 | - - ## performanceMonitor.begin begin(scene: string, startInputType: ActionType, note?: string): void -用于标记用户场景开始,用户场景开始时调用此接口。 +用户场景开始。 **系统能力:** SystemCapability.ArkUI.ArkUI.Full @@ -62,8 +47,6 @@ begin(scene: string, startInputType: ActionType, note?: string): void | note | string| 否 | 用户场景重要信息。 | **示例:** - -用户点击图标启动应用场景动效开始点,由离手事件LAST_UP触发。 ```ts performanceMonitor.begin("LAUNCHER_APP_LAUNCH_FROM_ICON", performanceMonitor.ActionType.LAST_UP, "APP_START_BEGIN"); ``` @@ -73,7 +56,7 @@ performanceMonitor.begin("LAUNCHER_APP_LAUNCH_FROM_ICON", performanceMonitor.Act end(scene: string): void -用于标记用户场景结束,用户场景结束时调用此接口。 +用户场景结束 **系统能力:** SystemCapability.ArkUI.ArkUI.Full @@ -83,47 +66,6 @@ end(scene: string): void | scene | string | 是 | 用户场景id,与begin配对。 | **示例:** - -用户点击图标应用场景动效结束点 ```ts performanceMonitor.end("LAUNCHER_APP_LAUNCH_FROM_ICON"); - ``` - -## performanceMonitor.recordInputEventTime12+ - -recordInputEventTime(type: ActionType, sourceType: sourceType, time: number): void - -记录动效场景开始前,用户输入触发事件类型与时间。 - -**系统能力:** SystemCapability.ArkUI.ArkUI.Full - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -- | -- | -- | -- | -| type | [ActionType](#actiontype)| 是 | 用户场景触发模式。 | -| sourceType | [SourceType](#sourcetype12) | 是 | 用户场景触发源。 | -| time | number | 是 | 场景触发时间。 | - -**错误码:** - -以下错误码详细介绍请参考[通用错误码](../errorcode-universal.md)。 - -| 错误码ID | 错误信息 | -| ------- | -------- | -| 202 | not system application. | - -**示例:** - -```ts -import { systemDateTime, BusinessError } from '@kit.BasicServicesKit'; -import { performanceMonitor } from '@kit.ArkUI'; - -let time = systemDateTime.getTime(false); -try { - performanceMonitor.recordInputEventTime(performanceMonitor.ActionType.LAST_UP, performanceMonitor.SourceType.PERF_MOUSE_EVENT, time); -} catch (paramError) { - let code: number = (paramError as BusinessError).code; - let message: string = (paramError as BusinessError).message; - console.error(`error.code: ${code}, error.message: ${message}`); -} -``` \ No newline at end of file + ``` \ No newline at end of file -- Gitee From 30ff10a205149d2b36dc5a7fd7abd81fd7643d60 Mon Sep 17 00:00:00 2001 From: link <18727210873@163.com> Date: Fri, 20 Jun 2025 06:23:10 +0000 Subject: [PATCH 3/3] =?UTF-8?q?update=20zh-cn/application-dev/reference/ap?= =?UTF-8?q?is-arkui/js-apis-arkui-perfor=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js-apis-arkui-performancemonitor-sys.md | 68 +++++++++++++++++-- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/zh-cn/application-dev/reference/apis-arkui/js-apis-arkui-performancemonitor-sys.md b/zh-cn/application-dev/reference/apis-arkui/js-apis-arkui-performancemonitor-sys.md index 025c52d4b84..e11ae5a29d0 100644 --- a/zh-cn/application-dev/reference/apis-arkui/js-apis-arkui-performancemonitor-sys.md +++ b/zh-cn/application-dev/reference/apis-arkui/js-apis-arkui-performancemonitor-sys.md @@ -1,6 +1,6 @@ # @ohos.arkui.performanceMonitor (性能监测)(系统接口) -用户操作场景提供性能相关指标监测能力,目前仅包含响应时延、完成时延、丢帧。 +提供用户操作场景性能相关指标监测能力,在场景开始和结束时分别调用begin和end接口,即可获得该场景相关性能指标,目前仅包含响应时延、完成时延、丢帧。 > **说明:** > @@ -18,7 +18,7 @@ import { performanceMonitor } from '@kit.ArkUI'; ## ActionType -用户场景触发模式枚举。 +用户场景(通常为具有动效的场景)触发模式枚举。 **系统能力:** SystemCapability.ArkUI.ArkUI.Full @@ -29,11 +29,26 @@ import { performanceMonitor } from '@kit.ArkUI'; | FIRST_MOVE | 2 | 用户首次滑动事件触发。 | +## SourceType12+ + +用户场景触发源类型枚举。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +| 名称 | 值 | 说明 | +| -- | -- | -- | +| PERF_TOUCH_EVENT | 0 | 触摸屏事件。 | +| PERF_MOUSE_EVENT | 1 | 鼠标事件。 | +| PERF_TOUCHPAD_EVENT | 2 | 触摸板事件。 | +| PERF_JOYSTICK_EVENT | 3 | 摇杆事件。 | +| PERF_KEY_EVENT | 4 | 键盘事件。 | + + ## performanceMonitor.begin begin(scene: string, startInputType: ActionType, note?: string): void -用户场景开始。 +用于标记用户场景开始,用户场景开始时调用此接口。 **系统能力:** SystemCapability.ArkUI.ArkUI.Full @@ -47,6 +62,8 @@ begin(scene: string, startInputType: ActionType, note?: string): void | note | string| 否 | 用户场景重要信息。 | **示例:** + +用户点击图标启动应用场景动效开始点,由离手事件LAST_UP触发。 ```ts performanceMonitor.begin("LAUNCHER_APP_LAUNCH_FROM_ICON", performanceMonitor.ActionType.LAST_UP, "APP_START_BEGIN"); ``` @@ -56,7 +73,7 @@ performanceMonitor.begin("LAUNCHER_APP_LAUNCH_FROM_ICON", performanceMonitor.Act end(scene: string): void -用户场景结束 +用于标记用户场景结束,用户场景结束时调用此接口。 **系统能力:** SystemCapability.ArkUI.ArkUI.Full @@ -66,6 +83,47 @@ end(scene: string): void | scene | string | 是 | 用户场景id,与begin配对。 | **示例:** + +用户点击图标应用场景动效结束点 ```ts performanceMonitor.end("LAUNCHER_APP_LAUNCH_FROM_ICON"); - ``` \ No newline at end of file + ``` + +## performanceMonitor.recordInputEventTime12+ + +recordInputEventTime(type: ActionType, sourceType: sourceType, time: number): void + +记录动效场景开始前,用户输入触发事件类型与时间。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**参数:** +| 参数名 | 类型 | 必填 | 说明 | +| -- | -- | -- | -- | +| type | [ActionType](#actiontype)| 是 | 用户场景触发模式。 | +| sourceType | [SourceType](#sourcetype12) | 是 | 用户场景触发源。 | +| time | number | 是 | 场景触发时间。 | + +**错误码:** + +以下错误码详细介绍请参考[通用错误码](../errorcode-universal.md)。 + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 202 | not system application. | + +**示例:** + +```ts +import { systemDateTime, BusinessError } from '@kit.BasicServicesKit'; +import { performanceMonitor } from '@kit.ArkUI'; + +let time = systemDateTime.getTime(false); +try { + performanceMonitor.recordInputEventTime(performanceMonitor.ActionType.LAST_UP, performanceMonitor.SourceType.PERF_MOUSE_EVENT, time); +} catch (paramError) { + let code: number = (paramError as BusinessError).code; + let message: string = (paramError as BusinessError).message; + console.error(`error.code: ${code}, error.message: ${message}`); +} +``` \ No newline at end of file -- Gitee