diff --git a/services/include/concurrent_task_controller.h b/services/include/concurrent_task_controller.h index 9b5f5e87d7eed8239b7e11f91470036a29fa03e4..d81b3142ddfaa86ca7deebab5ea53edcc05e2bd2 100644 --- a/services/include/concurrent_task_controller.h +++ b/services/include/concurrent_task_controller.h @@ -28,6 +28,8 @@ namespace OHOS { namespace ConcurrentTask { +const int DEFAULT_TASKLOAD = 5000; + class ForegroundAppRecord; class TaskController { @@ -41,7 +43,7 @@ public: void RequestAuth(const Json::Value& payload); void Init(); void Release(); - int CreateNewRtgGrp(int prioType, int rtNum); + int CreateNewRtgGrp(int prioType, int rtNum, int taskload=DEFAULT_TASKLOAD, bool useTaskloadFlag=false); private: void TypeMapInit(); diff --git a/services/src/concurrent_task_controller.cpp b/services/src/concurrent_task_controller.cpp index 8eb42450edc2a5d05d61ea9f1a2475e8fe991fa8..7d85de2380886868f74aa3056416ebe558964c36 100644 --- a/services/src/concurrent_task_controller.cpp +++ b/services/src/concurrent_task_controller.cpp @@ -200,15 +200,19 @@ void TaskController::QueryHardware(int uid, int pid, IntervalReply& queryRs) return; } if (hardwareGrpId_ < 0) { - return; - } + hardwareGrpId_ = CreateNewRtgGrp(PRIO_NORMAL, MAX_KEY_THREADS); + if (hardwareGrpId_ <= 0) + { + CONCUR_LOGI("CreateRsRtgGroup for Hardware failed"); + return; + } + } + queryRs.rtgId = hardwareGrpId_; hardwareTid_ = queryRs.tid; int ret = AddThreadToRtg(hardwareTid_, renderServiceGrpId_, PRIO_RT); if (ret < 0) { - CONCUR_LOGE("uid %{public}d tid %{public}d join hardware group failed.", uid, rsTid_); - return; + CONCUR_LOGE("uid %{public}d tid %{public}d join hardware group failed.", uid, hardwareTid_); } - queryRs.tid = hardwareGrpId_; } void TaskController::QueryExecutorStart(int uid, int pid, IntervalReply& queryRs) @@ -285,7 +289,6 @@ void TaskController::TypeMapInit() void TaskController::TryCreateRsGroup() { renderServiceGrpId_ = TryCreateSystemGroup(); - hardwareGrpId_ = renderServiceGrpId_; } int TaskController::TryCreateSystemGroup() @@ -746,7 +749,7 @@ void TaskController::PrintInfo() } } -int TaskController::CreateNewRtgGrp(int prioType, int rtNum) +int TaskController::CreateNewRtgGrp(int prioType, int rtNum, int taskload, bool userTaskloadFlag) { struct rtg_grp_data grp_data; int ret;