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 #include "eu/cpu_manager_strategy.h" 16 #include "eu/scpu_monitor.h" 17 18 namespace ffrt { IntoSleep(const QoS & qos)19void SCPUMonitor::IntoSleep(const QoS& qos) 20 { 21 WorkerCtrl& workerCtrl = ctrlQueue[static_cast<int>(qos)]; 22 workerCtrl.lock.lock(); 23 workerCtrl.sleepingWorkerNum++; 24 workerCtrl.executionNum--; 25 workerCtrl.lock.unlock(); 26 } 27 IntoPollWait(const QoS & qos)28void SCPUMonitor::IntoPollWait(const QoS& qos) 29 { 30 WorkerCtrl& workerCtrl = ctrlQueue[static_cast<int>(qos)]; 31 std::lock_guard lk(workerCtrl.lock); 32 workerCtrl.pollWaitFlag = true; 33 } 34 Notify(const QoS & qos,TaskNotifyType notifyType)35void SCPUMonitor::Notify(const QoS& qos, TaskNotifyType notifyType) 36 { 37 GetOps().HandleTaskNotity(qos, this, notifyType); 38 } 39 WorkerInit()40void SCPUMonitor::WorkerInit() 41 { 42 return; 43 } 44 }