Lines Matching refs:task

115 void QueueHandler::Submit(QueueTask* task)
118 FFRT_COND_DO_ERR((task == nullptr), return, "input invalid, serial task is nullptr");
120 // if qos not specified, qos of the queue is inherited by task
121 if (task->GetQos() == qos_inherit || task->GetQos() == qos_default) {
122 task->SetQos(qos_);
125 uint64_t gid = task->gid;
127 FFRTTraceRecord::TaskSubmit(&(task->createTime), &(task->fromTid));
130 task->fromTid = ExecuteCtx::Cur()->tid;
133 int ret = queue_->Push(task);
135 FFRT_LOGD("submit task[%lu] into %s", gid, name_.c_str());
147 if (task->GetDelay() == 0) {
148 FFRT_LOGD("task [%llu] activate %s", gid, name_.c_str());
149 TransferTask(task);
151 FFRT_LOGD("task [%llu] with delay [%llu] activate %s", gid, task->GetDelay(), name_.c_str());
153 queue_->Push(task);
181 FFRT_LOGD("cancel task %s failed, task may have been executed", name);
187 int QueueHandler::Cancel(QueueTask* task)
191 FFRT_COND_DO_ERR((task == nullptr), return INACTIVE, "input invalid, serial task is nullptr");
193 int ret = queue_->Remove(task);
195 FFRT_LOGD("cancel task[%llu] %s succ", task->gid, task->label.c_str());
196 task->Notify();
197 task->Destroy();
199 FFRT_LOGD("cancel task[%llu] %s failed, task may have been executed", task->gid, task->label.c_str());
207 for (QueueTask* task = inTask; task != nullptr; task = nextTask) {
209 SetTimeoutMonitor(task);
210 QueueMonitor::GetInstance().UpdateQueueInfo(GetQueueId(), task->gid);
212 // run user task
213 FFRT_LOGD("run task [gid=%llu], queueId=%u", task->gid, GetQueueId());
214 auto f = reinterpret_cast<ffrt_function_header_t*>(task->func_storage);
215 FFRT_SERIAL_QUEUE_TASK_EXECUTE_MARKER(task->gid);
216 FFRTTraceRecord::TaskExecute(&(task->executeTime));
224 FFRTTraceRecord::TaskDone<ffrt_queue_task>(task->GetQos(), task);
228 reinterpret_cast<EventHandlerAdapterQueue*>(queue_.get())->PushHistoryTask(task, triggerTime, completeTime);
232 task->Notify();
233 RemoveTimeoutMonitor(task);
235 // run task batch
236 nextTask = task->GetNextTask();
243 task->DecDeleteRef();
249 QueueTask* task = queue_->Pull();
250 if (task != nullptr) {
251 TransferTask(task);
255 void QueueHandler::TransferTask(QueueTask* task)
257 auto entry = &task->fq_we;
259 reinterpret_cast<EventHandlerAdapterQueue*>(queue_.get())->SetCurrentRunningTask(task);
262 FFRT_READY_MARKER(task->gid); // ffrt queue task ready to enque
263 if (!sch->InsertNode(&entry->node, task->GetQos())) {
264 FFRT_LOGE("failed to insert task [%llu] into %s", task->gid, name_.c_str());
279 void QueueHandler::SetTimeoutMonitor(QueueTask* task)
285 task->IncDeleteRef();
288 timeoutWe_->cb = ([this, task](WaitEntry* timeoutWe_) {
289 if (!task->GetFinishStatus()) {
290 RunTimeOutCallback(task);
293 task->DecDeleteRef();
303 task->DecDeleteRef();
305 FFRT_LOGW("failed to set watchdog for task gid=%llu in %s with timeout [%llu us] ", task->gid,
311 FFRT_LOGD("set watchdog of task gid=%llu of %s succ", task->gid, name_.c_str());
314 void QueueHandler::RemoveTimeoutMonitor(QueueTask* task)
328 void QueueHandler::RunTimeOutCallback(QueueTask* task)
338 name_ << "], queueId:[" << GetQueueId() << "], serial task gid:[" << task->gid << "], task name:["
339 << task->label << "], execution time exceeds[" << timeout_ << "] us";