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_INTERFACES_INNER_API_QOS_H 17 #define QOS_MANAGER_INTERFACES_INNER_API_QOS_H 18 19 namespace OHOS { 20 namespace QOS { 21 enum class QosLevel { 22 QOS_BACKGROUND, 23 QOS_UTILITY, 24 QOS_DEFAULT, 25 QOS_USER_INITIATED, 26 QOS_DEADLINE_REQUEST, 27 QOS_USER_INTERACTIVE, 28 QOS_KEY_BACKGROUND, 29 QOS_MAX, 30 }; 31 32 class QosController { 33 public: 34 static QosController& GetInstance(); 35 36 int SetThreadQosForOtherThread(enum QosLevel level, int tid); 37 int ResetThreadQosForOtherThread(int tid); 38 int GetThreadQosForOtherThread(enum QosLevel &level, int tid); 39 40 private: 41 QosController() = default; 42 ~QosController() = default; 43 44 QosController(const QosController&) = delete; 45 QosController& operator=(const QosController&) = delete; 46 QosController(QosController&&) = delete; 47 QosController& operator=(const QosController&&) = delete; 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 int GetThreadQos(enum QosLevel &level); 55 int GetQosForOtherThread(enum QosLevel &level, int tid); 56 } // namespace QOS 57 } // namespace OHOS 58 59 #endif // QOS_MANAGER_INTERFACES_INNER_API_QOS_H 60