From 947acf096d0c9a5ce5f777d399dc16ea841846b7 Mon Sep 17 00:00:00 2001 From: cee_mac <2710242656@qq.com> Date: Thu, 23 Nov 2023 16:08:49 +0800 Subject: [PATCH] fix qos level shift in user and kernel Signed-off-by: cee_mac <2710242656@qq.com> --- interfaces/inner_api/qos.h | 4 ++-- services/include/qos_interface.h | 2 +- services/src/qos_policy.cpp | 7 +------ test/unittest/phone/qos_interface_test.cpp | 3 +-- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/interfaces/inner_api/qos.h b/interfaces/inner_api/qos.h index 7639850..c74ff55 100644 --- a/interfaces/inner_api/qos.h +++ b/interfaces/inner_api/qos.h @@ -19,7 +19,7 @@ namespace OHOS { namespace QOS { enum class QosLevel { - QOS_BACKGROUND = 1, + QOS_BACKGROUND, QOS_UTILITY, QOS_DEFAULT, QOS_USER_INITIATED, @@ -53,4 +53,4 @@ int ResetQosForOtherThread(int tid); } // namespace QOS } // namespace OHOS -#endif // QOS_MANAGER_INTERFACES_INNER_API_QOS_H \ No newline at end of file +#endif // QOS_MANAGER_INTERFACES_INNER_API_QOS_H diff --git a/services/include/qos_interface.h b/services/include/qos_interface.h index ed73126..f32df50 100644 --- a/services/include/qos_interface.h +++ b/services/include/qos_interface.h @@ -135,7 +135,7 @@ enum QosPolicyType { struct QosPolicyDatas { int policyType; unsigned int policyFlag; - struct QosPolicyData policys[NR_QOS + 1]; + struct QosPolicyData policys[NR_QOS]; }; enum QosCtrlCmdid { diff --git a/services/src/qos_policy.cpp b/services/src/qos_policy.cpp index 1663d96..dccc335 100644 --- a/services/src/qos_policy.cpp +++ b/services/src/qos_policy.cpp @@ -28,7 +28,6 @@ static struct QosPolicyDatas g_defaultQosPolicy = { {0, 0, 0, 1024, 0}, {0, 0, 0, 1024, 0}, {0, 0, 0, 1024, 0}, - {0, 0, 0, 1024, 0}, } }; @@ -36,7 +35,6 @@ static struct QosPolicyDatas g_foregroundQosPolicy = { .policyType = QOS_POLICY_FRONT, .policyFlag = QOS_FLAG_ALL, .policys = { - {0, 0, 0, 1024, 0}, {10, 10, 0, 200, 0}, {5, 5, 0, 250, 0}, {0, 0, 0, 1024, 0}, @@ -57,7 +55,6 @@ static struct QosPolicyDatas g_backgroundQosPolicy = { .policyType = QOS_POLICY_BACK, .policyFlag = QOS_FLAG_ALL & ~QOS_FLAG_RT, .policys = { - {0, 0, 0, 1024, 0}, {15, 15, 0, 150, 0}, {10, 10, 0, 200, 0}, {5, 5, 0, 250, 0}, @@ -77,7 +74,6 @@ static struct QosPolicyDatas g_systemServerQosPolicy = { .policyType = QOS_POLICY_SYSTEM_SERVER, .policyFlag = QOS_FLAG_ALL, .policys = { - {0, 0, 0, 1024, 0}, {10, 10, 0, 200, 0}, {5, 5, 0, 250, 0}, {0, 0, 0, 1024, 0}, @@ -98,7 +94,6 @@ static struct QosPolicyDatas g_focusQosPolicy = { .policyType = QOS_POLICY_FOCUS, .policyFlag = QOS_FLAG_ALL, .policys = { - {0, 0, 0, 1024, 0}, {10, 10, 0, 200, 0}, {5, 5, 0, 250, 0}, {0, 0, 0, 1024, 0}, @@ -154,4 +149,4 @@ void QosPolicy::Init() CONCUR_LOGI("set qos policy finish"); } } -} \ No newline at end of file +} diff --git a/test/unittest/phone/qos_interface_test.cpp b/test/unittest/phone/qos_interface_test.cpp index bf4fa39..e45def5 100644 --- a/test/unittest/phone/qos_interface_test.cpp +++ b/test/unittest/phone/qos_interface_test.cpp @@ -247,7 +247,6 @@ static struct QosPolicyDatas g_defaultQosPolicy = { {0, 0, 0, 1024, 0}, {0, 0, 0, 1024, 0}, {0, 0, 0, 1024, 0}, - {0, 0, 0, 1024, 0}, } }; @@ -264,4 +263,4 @@ HWTEST_F(QosInterfaceTest, QosPolicyTest, TestSize.Level1) } } } -} \ No newline at end of file +} -- Gitee