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