1/* 2 * Copyright (c) 2022 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 * @file 18 * @kit PerformanceAnalysisKit 19 */ 20 21/** 22 * This module provides the capability to check bad code usage. 23 * 24 * @namespace hichecker 25 * @syscap SystemCapability.HiviewDFX.HiChecker 26 * @since arkts {'1.1':'8','1.2':'20'} 27 * @arkts 1.1&1.2 28 */ 29declare namespace hichecker { 30 /** 31 * The caution rule print log. 32 * 33 * @constant 34 * @syscap SystemCapability.HiviewDFX.HiChecker 35 * @since arkts {'1.1':'8','1.2':'20'} 36 * @arkts 1.1&1.2 37 */ 38 const RULE_CAUTION_PRINT_LOG = 9223372036854775808n; // 1 << 63 39 40 /** 41 * The caution rule trigger crash. 42 * 43 * @constant 44 * @syscap SystemCapability.HiviewDFX.HiChecker 45 * @since arkts {'1.1':'8','1.2':'20'} 46 * @arkts 1.1&1.2 47 */ 48 const RULE_CAUTION_TRIGGER_CRASH = 4611686018427387904n; // 1 << 62 49 50 /** 51 * The thread rule check slow process. 52 * 53 * @constant 54 * @syscap SystemCapability.HiviewDFX.HiChecker 55 * @since arkts {'1.1':'8','1.2':'20'} 56 * @arkts 1.1&1.2 57 */ 58 const RULE_THREAD_CHECK_SLOW_PROCESS = 1n; 59 60 /** 61 * The process rule check ability connection leak. 62 * 63 * @constant 64 * @syscap SystemCapability.HiviewDFX.HiChecker 65 * @since arkts {'1.1':'8','1.2':'20'} 66 * @arkts 1.1&1.2 67 */ 68 const RULE_CHECK_ABILITY_CONNECTION_LEAK = 8589934592n; // 1 << 33 69 70 /** 71 * The process rule check ability Arkui performance 72 * 73 * @constant 74 * @syscap SystemCapability.HiviewDFX.HiChecker 75 * @since arkts {'1.1':'11','1.2':'20'} 76 * @arkts 1.1&1.2 77 */ 78 const RULE_CHECK_ARKUI_PERFORMANCE = 17179869184n; // 1 << 34 79 80 /** 81 * add one or more rule. 82 * 83 * @param { bigint } rule 84 * @syscap SystemCapability.HiviewDFX.HiChecker 85 * @since 8 86 * @deprecated since 9 87 * @useinstead ohos.hichecker/hichecker#addCheckRule 88 */ 89 function addRule(rule: bigint): void; 90 91 /** 92 * remove one or more rule. 93 * 94 * @param { bigint } rule 95 * @syscap SystemCapability.HiviewDFX.HiChecker 96 * @since 8 97 * @deprecated since 9 98 * @useinstead ohos.hichecker/hichecker#removeCheckRule 99 */ 100 function removeRule(rule: bigint): void; 101 102 /** 103 * get added rule 104 * 105 * @returns { bigint } all added thread rule and process rule. 106 * @syscap SystemCapability.HiviewDFX.HiChecker 107 * @since arkts {'1.1':'8','1.2':'20'} 108 * @arkts 1.1&1.2 109 */ 110 function getRule(): bigint; 111 112 /** 113 * whether the query rule is added 114 * 115 * @param { bigint } rule 116 * @returns { boolean } the result of whether the query rule is added. 117 * @syscap SystemCapability.HiviewDFX.HiChecker 118 * @since 8 119 * @deprecated since 9 120 * @useinstead ohos.hichecker/hichecker#containsCheckRule 121 */ 122 function contains(rule: bigint): boolean; 123 124 /** 125 * Add one or more rule. 126 * 127 * @param { bigint } rule 128 * @throws { BusinessError } 401 - the parameter check failed, only one bigint type parameter is needed 129 * @syscap SystemCapability.HiviewDFX.HiChecker 130 * @since arkts {'1.1':'9','1.2':'20'} 131 * @arkts 1.1&1.2 132 */ 133 function addCheckRule(rule: bigint): void; 134 135 /** 136 * Remove one or more rule. 137 * 138 * @param { bigint } rule 139 * @throws { BusinessError } 401 - the parameter check failed, only one bigint type parameter is needed 140 * @syscap SystemCapability.HiviewDFX.HiChecker 141 * @since arkts {'1.1':'9','1.2':'20'} 142 * @arkts 1.1&1.2 143 */ 144 function removeCheckRule(rule: bigint): void; 145 146 /** 147 * Whether the query rule is added 148 * 149 * @param { bigint } rule 150 * @returns { boolean } the result of whether the query rule is added. 151 * @throws { BusinessError } 401 - the parameter check failed, only one bigint type parameter is needed 152 * @syscap SystemCapability.HiviewDFX.HiChecker 153 * @since arkts {'1.1':'9','1.2':'20'} 154 * @arkts 1.1&1.2 155 */ 156 function containsCheckRule(rule: bigint): boolean; 157} 158export default hichecker; 159