13c3173acSopenharmony_ci/* 23c3173acSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 33c3173acSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 43c3173acSopenharmony_ci * you may not use this file except in compliance with the License. 53c3173acSopenharmony_ci * You may obtain a copy of the License at 63c3173acSopenharmony_ci * 73c3173acSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 83c3173acSopenharmony_ci * 93c3173acSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 103c3173acSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 113c3173acSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 123c3173acSopenharmony_ci * See the License for the specific language governing permissions and 133c3173acSopenharmony_ci * limitations under the License. 143c3173acSopenharmony_ci */ 153c3173acSopenharmony_ci 163c3173acSopenharmony_ci#ifndef QOS_H 173c3173acSopenharmony_ci#define QOS_H 183c3173acSopenharmony_ci/** 193c3173acSopenharmony_ci * @addtogroup QoS 203c3173acSopenharmony_ci * @{ 213c3173acSopenharmony_ci * 223c3173acSopenharmony_ci * @brief QoS provides APIs. 233c3173acSopenharmony_ci * 243c3173acSopenharmony_ci * @since 12 253c3173acSopenharmony_ci */ 263c3173acSopenharmony_ci 273c3173acSopenharmony_ci/** 283c3173acSopenharmony_ci * @file qos.h 293c3173acSopenharmony_ci * 303c3173acSopenharmony_ci * @brief Declares the QoS interfaces in C. 313c3173acSopenharmony_ci * 323c3173acSopenharmony_ci * Quality-of-service (QoS) refers to the priority scheduling attribute of tasks 333c3173acSopenharmony_ci * in OpenHarmony. Developers can use QoS to categorize tasks to be executed to 343c3173acSopenharmony_ci * indicate the degree of their relevance to user interactions, the system can 353c3173acSopenharmony_ci * schedule the time and running order of tasks according to the QoS set by the tasks. 363c3173acSopenharmony_ci * 373c3173acSopenharmony_ci * @library libqos.so 383c3173acSopenharmony_ci * @syscap SystemCapability.Resourceschedule.QoS.Core 393c3173acSopenharmony_ci * @since 12 403c3173acSopenharmony_ci */ 413c3173acSopenharmony_ci#ifdef __cplusplus 423c3173acSopenharmony_ciextern "C" { 433c3173acSopenharmony_ci#endif 443c3173acSopenharmony_ci 453c3173acSopenharmony_ci/** 463c3173acSopenharmony_ci * @brief Describes the level of QoS. 473c3173acSopenharmony_ci * 483c3173acSopenharmony_ci * @since 12 493c3173acSopenharmony_ci */ 503c3173acSopenharmony_citypedef enum QoS_Level { 513c3173acSopenharmony_ci /** 523c3173acSopenharmony_ci * @brief Means the QoS level is background. 533c3173acSopenharmony_ci */ 543c3173acSopenharmony_ci QOS_BACKGROUND = 0, 553c3173acSopenharmony_ci 563c3173acSopenharmony_ci /** 573c3173acSopenharmony_ci * @brief Means the QoS level is utility. 583c3173acSopenharmony_ci */ 593c3173acSopenharmony_ci QOS_UTILITY, 603c3173acSopenharmony_ci 613c3173acSopenharmony_ci /** 623c3173acSopenharmony_ci * @brief Means the QoS level is default. 633c3173acSopenharmony_ci */ 643c3173acSopenharmony_ci QOS_DEFAULT, 653c3173acSopenharmony_ci 663c3173acSopenharmony_ci /** 673c3173acSopenharmony_ci * @brief Means the QoS level is user-initiated. 683c3173acSopenharmony_ci */ 693c3173acSopenharmony_ci QOS_USER_INITIATED, 703c3173acSopenharmony_ci 713c3173acSopenharmony_ci /** 723c3173acSopenharmony_ci * @brief Means the QoS level is user-request. 733c3173acSopenharmony_ci */ 743c3173acSopenharmony_ci QOS_DEADLINE_REQUEST, 753c3173acSopenharmony_ci 763c3173acSopenharmony_ci /** 773c3173acSopenharmony_ci * @brief Means the QoS level is user-interactive. 783c3173acSopenharmony_ci */ 793c3173acSopenharmony_ci QOS_USER_INTERACTIVE, 803c3173acSopenharmony_ci} QoS_Level; 813c3173acSopenharmony_ci 823c3173acSopenharmony_ci/** 833c3173acSopenharmony_ci * @brief Set the QoS level of the current thread. 843c3173acSopenharmony_ci * 853c3173acSopenharmony_ci * @param level Indicates the level to set. Specific level can be referenced {@link QoS_Level}. 863c3173acSopenharmony_ci * @return Returns int32_t, return value == 0, success, otherwise value == -1, failed. 873c3173acSopenharmony_ci * @see QoS_Level 883c3173acSopenharmony_ci * @since 12 893c3173acSopenharmony_ci */ 903c3173acSopenharmony_ciint OH_QoS_SetThreadQoS(QoS_Level level); 913c3173acSopenharmony_ci 923c3173acSopenharmony_ci/** 933c3173acSopenharmony_ci * @brief Cancel the QoS level of the current thread. 943c3173acSopenharmony_ci * 953c3173acSopenharmony_ci * @return Returns int32_t, return value == 0, success, otherwise value == -1, failed. 963c3173acSopenharmony_ci * @see QoS_Level 973c3173acSopenharmony_ci * @since 12 983c3173acSopenharmony_ci */ 993c3173acSopenharmony_ciint OH_QoS_ResetThreadQoS(); 1003c3173acSopenharmony_ci 1013c3173acSopenharmony_ci/** 1023c3173acSopenharmony_ci * @brief Obtains the QoS level of the current thread. 1033c3173acSopenharmony_ci * 1043c3173acSopenharmony_ci * @param level This parameter is the output parameter, 1053c3173acSopenharmony_ci * and the QoS level of the thread as a {@link QoS_Level} is written to this variable. 1063c3173acSopenharmony_ci * @return Returns int32_t, return value == 0, success, otherwise value == -1, failed. 1073c3173acSopenharmony_ci * @see QoS_Level 1083c3173acSopenharmony_ci * @since 12 1093c3173acSopenharmony_ci */ 1103c3173acSopenharmony_ciint OH_QoS_GetThreadQoS(QoS_Level *level); 1113c3173acSopenharmony_ci#ifdef __cplusplus 1123c3173acSopenharmony_ci}; 1133c3173acSopenharmony_ci#endif 1143c3173acSopenharmony_ci#endif //QOS_H 115