static int itomap2430_sharp01_panel_enable(void) { DBGENTER(1); DBGLEAVE(1); return 0; }
void RRScheduler::addTask(AbsRTTask* task, const std::string &p) { DBGENTER(_RR_SCHED_DBG_LEV); AbsRTTask *mytask = dynamic_cast<AbsRTTask *>(task); if (mytask == 0) throw RRSchedExc("Cannot add a AbsRTTask to RR"); RRModel *model = new RRModel(mytask); if (find(task) != NULL) throw RRSchedExc("Element already present"); _tasks[task] = model; int slice = 0; DBGPRINT_2("Slice parameter: ", p); if (p == "") slice = defaultSlice; else { stringstream ss(p); ss >> slice; } DBGPRINT_2("Slice set to: ", slice); model->setRRSlice(slice); }
RRScheduler::RRScheduler(int defSlice) : Scheduler(), defaultSlice(defSlice), _rrEvt(this, &RRScheduler::round) { DBGENTER(_RR_SCHED_DBG_LEV); DBGPRINT_2("DEFAULT SLICE = ", defaultSlice); //register_handler(_rrEvt, this, &RRScheduler::round); }
unsigned long int CPU::getFrequencySwitching() { DBGENTER(_KERNEL_DBG_LEV); DBGPRINT("frequencySwitching=" << frequencySwitching); return frequencySwitching; }
void Grub::releasing_ready() { DBGENTER(_SERVER_DBG_LEV); status = READY; _idleEvt.drop(); DBGPRINT("FROM RELEASING TO READY"); }
void Server::onDispatch(Event *e) { DBGENTER(_SERVER_DBG_LEV); AbsRTTask *newExe = sched_->getFirst(); DBGPRINT("Current situation"); DBGPRINT_2("newExe: ", taskname(newExe)); DBGPRINT_2("currExe_: ", taskname(currExe_)); if (newExe != currExe_) { if (currExe_ != NULL) currExe_->deschedule(); currExe_ = newExe; if (newExe != NULL) newExe->schedule(); //sched_->notify(newExe); } DBGPRINT_2("Now Running: ", taskname(newExe)); if (currExe_ == NULL) { sched_->notify(NULL); executing_releasing(); kernel->suspend(this); kernel->dispatch(); } }
void RRScheduler::round(Event *) { DBGENTER(_RR_SCHED_DBG_LEV); RRModel* model = dynamic_cast<RRModel *>(_queue.front()); if (model == 0) throw RRSchedExc("Cannot find task"); if (model->isRoundExpired()) { DBGPRINT("Round expired"); _queue.erase(model); if (model->isActive()) { model->setInsertTime(SIMUL.getTime()); _queue.insert(model); } } // if it is not active... ? RRModel* first = dynamic_cast<RRModel *>(_queue.front()); // if (first == 0) throw RRSchedExc("Cannot find task"); if (first != 0) { Tick slice = first->getRRSlice(); if (slice == 0) _rrEvt.drop(); else { if (first != model || first->isRoundExpired()) { _rrEvt.drop(); _rrEvt.post(SIMUL.getTime() + slice); } } } if (_kernel) { DBGPRINT("informing the kernel"); _kernel->dispatch(); } }
void Server::addTask(AbsRTTask &task, const string ¶ms) { DBGENTER(_SERVER_DBG_LEV); task.setKernel(this); tasks.push_back(&task); DBGPRINT_2("Calling sched->addTask, with params = ", params); sched_->addTask(&task, params); }
void Grub::executing_releasing() { DBGENTER(_SERVER_DBG_LEV); updateBudget(); status = RELEASING; if (SIMUL.getTime() < Tick(vtime.get_value())) _idleEvt.post(Tick(vtime.get_value())); else _idleEvt.post(SIMUL.getTime()); }
void ThreInstr::schedule() { DBGENTER(_INSTR_DBG_LEV); DBGPRINT("Scheduling ThreInstr named: " << getName()); _endEvt.post(SIMUL.getTime()); }
void Server::onSched(Event *) { DBGENTER(_SERVER_DBG_LEV); assert(status == READY); ready_executing(); dispatch(); }
static void innovator1610_panel_cleanup(void) { DBGENTER(1); omap_free_gpio(15); omap_free_gpio(14); DBGLEAVE(1); }
void Grub::ready_executing() { DBGENTER(_SERVER_DBG_LEV); status = EXECUTING; Tick extra = supervisor->get_capacity(); //cout << "Extra: " << extra << endl; cap.set_value(cap.get_value() + double(extra)); startAccounting(); }
void Grub::recharging_ready() { DBGENTER(_SERVER_DBG_LEV); cap.set_value(Q); d = SIMUL.getTime() + P; setAbsDead(d); vtime.set_value(SIMUL.getTime()); status = READY; }
void Grub::executing_recharging() { DBGENTER(_SERVER_DBG_LEV); updateBudget(); status = RECHARGING; if (getDeadline() < SIMUL.getTime()) _rechargingEvt.post(SIMUL.getTime()); else _rechargingEvt.post(getDeadline()); }
static void innovator1610_panel_disable(void) { DBGENTER(1); /* set GPIO13, GPIO14 and GPIO15 low */ omap_set_gpio_dataout(14, 0); omap_set_gpio_dataout(15, 0); DBGLEAVE(1); }
void Grub::releasing_idle() { DBGENTER(_SERVER_DBG_LEV); if (double(SIMUL.getTime()) > vtime.get_value()) { Tick extra = Tick(getUtil() * (double(SIMUL.getTime()) - vtime.get_value())); supervisor->set_capacity(extra); } status = IDLE; supervisor->set_idle(this); }
void Server::suspend(AbsRTTask *task) { DBGENTER(_SERVER_DBG_LEV); sched_->extract(task); if (getProcessor(task) != NULL) { task->deschedule(); currExe_ = NULL; sched_->notify(NULL); } }
static int innovator1610_panel_enable(void) { DBGENTER(1); /* set GPIO14 and GPIO15 high */ omap_set_gpio_dataout(14, 1); omap_set_gpio_dataout(15, 1); DBGLEAVE(1); return 0; }
static void client_exec_cleanup_file(fireexecd_client_t *cli, const char *path) { // backups to restore process after script execution char **envtmp = environ; uid_t euid = geteuid(); uid_t ruid = getuid(); DBGENTER(cli?cli->pid:0, "client_exec_cleanup_file"); if (!path) { DBGERR("[n/a]\t\e[01;40;101mERROR:\e[0;0m asked to execute a cleanup file, but no path was provided. Aborting.\n"); DBGLEAVE(cli?cli->pid:0, "client_exec_cleanup_file"); goto unlink; }
void Server::onEnd(AbsRTTask *t) { DBGENTER(_SERVER_DBG_LEV); assert(status == EXECUTING); sched_->extract(t); currExe_ = NULL; sched_->notify(NULL); // round robin case dispatch(); }
void RRScheduler::addTask(AbsRTTask *task) throw(RRSchedExc) { DBGENTER(_RR_SCHED_DBG_LEV); RRModel *model = new RRModel(task); if (find(task) != NULL) throw RRSchedExc("Element already present"); _tasks[task] = model; model->setRRSlice(defaultSlice); DBGPRINT_2("Default slice set: ", defaultSlice); }
void Server::onDesched(Event *) { DBGENTER(_SERVER_DBG_LEV); // I cannot assume it is still executing, maybe it is already // in recharging status (bacause of previous onEnd(task)) if (status == EXECUTING) { executing_ready(); // signal the task currExe_->deschedule(); currExe_ = NULL; sched_->notify(NULL); } }
void Grub::idle_ready() { //cout << "IDLE-READY" << endl; DBGENTER(_SERVER_DBG_LEV); assert (status == IDLE); status = READY; cap.set_value(Q); d = SIMUL.getTime() + P; DBGPRINT_2("new deadline ",d); setAbsDead(d); vtime.set_value(SIMUL.getTime()); supervisor->set_active(this); DBGPRINT_2("Going to READY at ", SIMUL.getTime()); //cout << "IDLE-READY end" << endl; }
void Server::onRecharging(Event *) { DBGENTER(_SERVER_DBG_LEV); assert(status == RECHARGING); if (sched_->getFirst() != NULL) { recharging_ready(); kernel->onArrival(this); } else { recharging_idle(); currExe_ = NULL; sched_->notify(NULL); } }
void WaitInstr::onEnd() { DBGENTER(_INSTR_DBG_LEV); _father->onInstrEnd(); RTKernel *k = dynamic_cast<RTKernel *>(_father->getKernel()); if (k == NULL) throw BaseExc("Kernel not found!"); k->requestResource(_father, _res, _numberOfRes); _waitEvt.process(); }
void RRScheduler::notify(AbsRTTask* task) { DBGENTER(_RR_SCHED_DBG_LEV); _rrEvt.drop(); if (task != NULL) { RRModel* model = dynamic_cast<RRModel *>(find(task)); if (model == 0) throw RRSchedExc("Cannot find task"); if (model->getRRSlice() > 0) { _rrEvt.post(SIMUL.getTime() + model->getRRSlice()); DBGPRINT_2("rrEvt post at time ", SIMUL.getTime() + model->getRRSlice()); } } }
void SignalInstr::onEnd() { DBGENTER(_INSTR_DBG_LEV); _endEvt.drop(); _signalEvt.process(); _father->onInstrEnd(); RTKernel *k = dynamic_cast<RTKernel *>(_father->getKernel()); if (k == 0) { throw BaseExc("SignalInstr has no kernel set!"); } else k->releaseResource(_father, _res, _numberOfRes); }
fireexecd_client_t *client_new(pid_t pid, const char *cmdpath, const char *profile, const char *name) { DBGENTER(pid, "client_new"); fireexecd_client_t *cli = malloc(sizeof(fireexecd_client_t)); if(!cli) { DBGLEAVE(pid, "client_new"); return NULL; } cli->cmdpath = strdup(cmdpath); if(!cli->cmdpath) { free(cli); DBGLEAVE(pid, "client_new"); return NULL; } cli->profile = profile ? strdup(profile) : NULL; if(profile && !cli->profile) { free(cli->cmdpath); free(cli); DBGLEAVE(pid, "client_new"); return NULL; } cli->name = name ? strdup(name) : NULL; if(name && !cli->name) { free(cli->profile); free(cli->cmdpath); free(cli); DBGLEAVE(pid, "client_new"); return NULL; } cli->pid = pid; cli->handler = 0; cli->regtime = 0; cli->status = UNDEFINED; cli->pol = EXECHELP_DEFAULT_POLICY; DBGLEAVE(pid, "client_new"); return cli; }
Server::Server(const string &name, const string &s) : Entity(name), arr(0), last_arr(0), status(IDLE), dline(0), abs_dline(0), tasks(), last_exec_time(0), kernel(0), sched_(0), currExe_(0), _bandExEvt(Event::_DEFAULT_PRIORITY + 4), _dlineMissEvt(Event::_DEFAULT_PRIORITY + 6), _rechargingEvt(Event::_DEFAULT_PRIORITY - 1), _dispatchEvt(Event::_DEFAULT_PRIORITY + 5) { DBGENTER(_SERVER_DBG_LEV); string s_name = parse_util::get_token(s); // only for passing to the factory vector<string> p = parse_util::split_param(parse_util::get_param(s)); // create the scheduler DBGPRINT_2("SCHEDULER: ", s_name); DBGPRINT("PARAMETERS: "); for (int i=0; i<p.size(); ++i) DBGPRINT(p[i]); auto_ptr<Scheduler> curr = FACT(Scheduler).create(s_name, p); sched_ = curr.release(); if (!sched_) throw ParseExc("Server::Server()", s); sched_->setKernel(this); // register all event handlers register_handler(_bandExEvt, this, &Server::onBudgetExhausted); register_handler(_dlineMissEvt, this, &Server::onDlineMiss); register_handler(_rechargingEvt, this, &Server::onRecharging); register_handler(_schedEvt, this, &Server::onSched); register_handler(_deschedEvt, this, &Server::onDesched); register_handler(_dispatchEvt, this, &Server::onDispatch); }