From 417840e28b37a43f6724f6ed18800ecdb484d2e8 Mon Sep 17 00:00:00 2001 From: Leibobo <412338663@qq.com> Date: Tue, 21 Nov 2023 11:43:23 +0800 Subject: [PATCH] add new header file Signed-off-by: Leibobo <412338663@qq.com> --- resourceschedule/qos_manager/c/qos.h | 108 +++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 resourceschedule/qos_manager/c/qos.h diff --git a/resourceschedule/qos_manager/c/qos.h b/resourceschedule/qos_manager/c/qos.h new file mode 100644 index 000000000..18e0cb4cd --- /dev/null +++ b/resourceschedule/qos_manager/c/qos.h @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef QOS_H +#define QOS_H +/** + * @addtogroup QoS + * @{ + * + * @brief QoS provides APIs. + * + * @since 11 + */ + +/** + * @file qos.h + * + * @brief Declares the QoS interfaces in C. + * @library libqos.z.so + * @syscap SystemCapability.Resourceschedule.QoS.Core + * @since 11 + */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Describes the level of QoS. + * + * @since 11 + */ +typedef enum QoS_Level { + /** + * @brief Means the QoS level is background. + */ + QOS_BACKGROUND = 0, + + /** + * @brief Means the QoS level is utility. + */ + QOS_UTILITY, + + /** + * @brief Means the QoS level is default. + */ + QOS_DEFAULT, + + /** + * @brief Means the QoS level is user-initiated. + */ + QOS_USER_INITIATED, + + /** + * @brief Means the QoS level is user-request. + */ + QOS_DEADLINE_REQUEST, + + /** + * @brief Means the QoS level is user-interactive. + */ + QOS_USER_INTERACTIVE, +} QoS_Level; + +/** + * @brief Set the QoS level of the current thread. + * + * @param level Indicates the level to set. Specific level can be referenced {@link QoS_Level}. + * @return Returns int32_t, return value == 0, success, otherwise value == -1, failed. + * @see QoS_Level + * @since 11 + */ +int OH_QoS_SetThreadQoS(QoS_Level level); + +/** + * @brief Cancel the QoS level of the current thread. + * + * @return Returns int32_t, return value == 0, success, otherwise value == -1, failed. + * @see QoS_Level + * @since 11 + */ +int OH_QoS_ResetThreadQoS(); + +/** + * @brief Obtains the QoS level of the current thread. + * + * @param level This parameter is the output parameter, + * and the QoS level of the thread as a {@link QoS_Level} is written to this variable. + * @return Returns int32_t, return value == 0, success, otherwise value == -1, failed. + * @see QoS_Level + * @since 11 + */ +int OH_QoS_GetThreadQoS(QoS_Level *level); +#ifdef __cplusplus +}; +#endif +#endif // QOS_H -- Gitee