1/* 2 * Copyright (C) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * Provides interfaces to monitor a scene for performance measurement. 18 * 19 * <p>These interfaces are used to monitor the begin, end, and value changes of finger processes that last for at least 3 ms. 20 * 21 * <p>Example: 22 * import "@ohos.arkui.performanceMonitor.d.ts" 23 * To start scene monitoring that is expected to complete within 5 ms: 24 * <pre>{@code 25 * performanceMonitor.begin(string, ActionType, string); 26 * //scene finished 27 * performanceMonitor.end(string); 28 * }</pre> 29 * 30 * <p>Each {@code begin} matches one {@code end}, and they must have the same scene id. 31 * 32 * @namespace performanceMonitor 33 * @syscap SystemCapability.ArkUI.ArkUI.Full 34 * @systemapi 35 * @since 10 36 */ 37declare namespace performanceMonitor { 38 /** 39 * Enumerates the input event type. 40 * 41 * @enum { number } 42 * @syscap SystemCapability.ArkUI.ArkUI.Full 43 * @systemapi 44 * @since 10 45 */ 46 export enum ActionType { 47 /** 48 * The user presses the finger on the screen. 49 * @syscap SystemCapability.ArkUI.ArkUI.Full 50 * @systemapi 51 * @since 10 52 */ 53 LAST_DOWN = 0, 54 55 /** 56 * The user lifts up the finger from the screen. 57 * @syscap SystemCapability.ArkUI.ArkUI.Full 58 * @systemapi 59 * @since 10 60 */ 61 LAST_UP = 1, 62 63 /** 64 * The user first moves the finger after pressing down the screen. 65 * @syscap SystemCapability.ArkUI.ArkUI.Full 66 * @systemapi 67 * @since 10 68 */ 69 FIRST_MOVE = 2 70 } 71 72 /** 73 * Begin monitoring an application scene. 74 * 75 * @param { string } scene Indicates the scene name. 76 * @param { ActionType } startInputType Indicates the scene input event type. 77 * @param { string } note Indicates the app expected info delivered. 78 * @syscap SystemCapability.ArkUI.ArkUI.Full 79 * @systemapi 80 * @since 10 81 */ 82 function begin(scene: string, startInputType: ActionType, note?: string): void; 83 84 /** 85 * End monitoring an application scene. 86 * 87 * @param { string } scene Indicates the scene name. It must be the same with the {@code scene} of start. 88 * @syscap SystemCapability.ArkUI.ArkUI.Full 89 * @systemapi 90 * @since 10 91 */ 92 function end(scene: string): void; 93} 94export default performanceMonitor; 95