• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef QOS_MANAGER_H
17 #define QOS_MANAGER_H
18 
19 namespace OHOS {
20 namespace QOS {
21 enum class QosLevel {
22     qos_background = 1,
23     qos_utility,
24     qos_default,
25     qos_user_initiated,
26     qos_deadline_request,
27     qos_user_interactive,
28 };
29 
30 class QosController {
31 public:
32     static QosController& GetInstance();
33 
34     int SetThreadQosForOtherThread(enum QosLevel level, int tid);
35     int ResetThreadQosForOtherThread(int tid);
36 
37 private:
38     QosController() = default;
39     ~QosController() = default;
40 
41     QosController(const QosController&) = delete;
42     QosController& operator=(const QosController&) = delete;
43     QosController(QosController&&) = delete;
44     QosController& operator=(const QosController&&) = delete;
45 
46     int SetPolicy();
47     bool policyStatus_ = false;
48 };
49 
50 int SetThreadQos(enum QosLevel level);
51 int SetQosForOtherThread(enum QosLevel level, int tid);
52 int ResetThreadQos();
53 int ResetQosForOtherThread(int tid);
54 
55 } // namespace QOS
56 } // namespace OHOS
57 
58 #endif // QOS_MANAGER_H