1# @ohos.arkui.performanceMonitor (性能监测)(系统接口) 2 3用户操作场景提供性能相关指标监测能力,目前仅包含响应时延、完成时延、丢帧。 4 5> **说明:** 6> 7> 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 8> 9> 本模块接口为系统接口。 10 11 12## 导入模块 13 14```ts 15import { performanceMonitor } from '@kit.ArkUI'; 16``` 17 18 19## ActionType 20 21用户场景触发模式枚举。 22 23**系统能力:** SystemCapability.ArkUI.ArkUI.Full 24 25| 名称 | 值 | 说明 | 26| -- | -- | -- | 27| LAST_DOWN | 0 | 用户按压事件触发。 | 28| LAST_UP | 1 | 用户离手事件触发。 | 29| FIRST_MOVE | 2 | 用户首次滑动事件触发。 | 30 31 32## performanceMonitor.begin 33 34begin(scene: string, startInputType: ActionType, note?: string): void 35 36用户场景开始。 37 38 39**系统能力:** SystemCapability.ArkUI.ArkUI.Full 40 41**参数:** 42 43| 参数名 | 类型 | 必填 | 说明 | 44| -- | -- | -- | -- | 45| scene | string | 是 | 用户场景id。 | 46| startInputType | [ActionType](#actiontype)| 是 | 用户场景触发模式。 | 47| note | string| 否 | 用户场景重要信息。 | 48 49**示例:** 50 ```ts 51performanceMonitor.begin("LAUNCHER_APP_LAUNCH_FROM_ICON", performanceMonitor.ActionType.LAST_UP, "APP_START_BEGIN"); 52 ``` 53 54 55## performanceMonitor.end 56 57end(scene: string): void 58 59用户场景结束 60 61**系统能力:** SystemCapability.ArkUI.ArkUI.Full 62 63**参数:** 64| 参数名 | 类型 | 必填 | 说明 | 65| -- | -- | -- | -- | 66| scene | string | 是 | 用户场景id,与begin配对。 | 67 68**示例:** 69 ```ts 70performanceMonitor.end("LAUNCHER_APP_LAUNCH_FROM_ICON"); 71 ```