double resp_time(Iter highest, Iter end, double bound) { typedef typename std::iterator_traits<Iter>::value_type Type; double r = 0; // rt, used for the internal loop double r_old = 0; // used for the internal loop double r_latest = 0; // the greatest rt among all instances int k = 0; // instance number Iter task = end-1; // task under analysis // starting point: r^0 for (Iter x = highest; x!=end; ++x) r += x->get_wcet(); // for_each(highest, end, [&r](Type a) { // r += a.get_wcet(); // }); do { k++; while (r_old < r) { r_old = r; r = k * task->get_wcet() + workload(highest, task, 0, r_old); if (r > bound) throw RespTimeTooLarge(toString(r)); } r_latest = std::max(r_latest, r - (k-1) * task->get_period()); if (r > k * task->get_period()) r+=task->get_wcet(); } while (r > k * task->get_period()); return r_latest; }
static std::vector<shared_ptr<Data>> makeDataWorkload(size_t count, const NameGenerator& genName = SimpleNameGenerator()) { std::vector<shared_ptr<Data>> workload(count); for (size_t i = 0; i < count; ++i) { Name name = genName(i); workload[i] = makeData(name); } return workload; }
int main() { boost::filesystem::create_directory(TEST_DIR1); boost::asio::dir_monitor dm(io_service); dm.add_directory(TEST_DIR1); dm.async_monitor([&](const boost::system::error_code &ec, const boost::asio::dir_monitor_event &ev) { event_handler(dm, ec, ev); }); boost::asio::io_service::work workload(io_service); io_service.run(); }
void doit(const char *file) { ipt_vis workload(file); if(!workload.working) return; // cant do anything // print out what we have parsed // std::cout << workload << std::endl; if(workload.output_method == "curses") { start_curses(); // Only terminate via ^C etc. getmaxyx(stdscr,screen_max_rows,screen_max_cols); } while(workload.get_samples()) { workload.render_samples(); if(workload.output_method == "curses") { clrtobot(); // rest of the screen refresh(); (void) handle_input(); } } }