⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setbudget.cpp

📁 一个很棒的网络控制系统仿真软件
💻 CPP
字号:
#ifndef SET_BUDGET#define SET_BUDGET#include "gettask.cpp"void updateWCETTimer(double diff, Task* task) {  bool found = false;  TimerNode* tn = (TimerNode*) rtsys->timerQ->getFirst();  while (tn!=NULL && !found) {    Timer* t = tn->getTimer();    if (t->wcetORtimer && (t->task == task)) {      found = true;      rtsys->timerQ->removeNode(tn);      t->time += diff;      rtsys->timerQ->insertSorted(tn);    } else {      tn = (TimerNode*) tn->getNext();    }  }}// set budget of specific taskvoid ttSetBudget(double budget, char *nameOfTask) {    Task* task = getTask(nameOfTask);  if (task == NULL) {    char buf[200];    sprintf(buf, "ttSetBudget: Non-existent task '%s'!", nameOfTask);    MEX_ERROR(buf);    return;  }    if (budget < -EPS) {    MEX_ERROR("ttSetBudget: Negative budget!");    return;  }  if (task->currentJob == NULL) {    char buf[200];    sprintf(buf, "ttSetBudget: No running job of task '%s'!", nameOfTask);    MEX_ERROR(buf);    return;  }  double diff = budget - task->currentJob->budget;  task->currentJob->budget = budget;    // Update WCET overrun timer  if (task->exectimeORhandler != NULL) {    updateWCETTimer(diff, task);  }}// set budget of calling taskvoid ttSetBudget(double budget) {  if (rtsys->executing == NULL) {    MEX_ERROR("ttSetBudget: No running task!");    return;  }  ttSetBudget(budget, rtsys->executing->name);}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -