10 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simu);
17 process::process(int argc, char *argv[])
19 if (argc < 2 || !(std::istringstream(argv[1]) >> load))
20 throw std::invalid_argument("bad or missing initial load");
21 neigh.assign(argv + 2, argv + argc);
22 e_xbt_log_priority_t logp = xbt_log_priority_verbose;
23 if (!LOG_ISENABLED(logp))
25 LOG1(logp, "My initial load is: %g", load);
26 std::ostringstream oss;
27 oss << neigh.size() << " neighbor";
29 oss << (neigh.size() > 1 ? "s: " : ": ");
30 std::transform(neigh.begin(), neigh.end() - 1,
31 std::ostream_iterator<std::string>(oss, ", "),
32 std::mem_fun_ref(&neighbor::getName));
33 oss << neigh.back().getName();
35 LOG1(logp, "Got %s.", oss.str().c_str());
39 void process::print_loads(e_xbt_log_priority_t logp)
41 if (!LOG_ISENABLED(logp))
43 std::ostringstream oss;
45 oss << "no neighbor!";
47 std::transform(neigh.begin(), neigh.end() - 1,
48 std::ostream_iterator<double>(oss, ", "),
49 std::mem_fun_ref(&neighbor::getLoad));
50 oss << neigh.back().getLoad();
52 LOG1(logp, "Neighbor loads: %s", oss.str().c_str());
58 MSG_process_sleep(100.0); // xxx
60 * while (there is something to do) {
63 * compute load balancing;
64 * send tasks to neighbors;
69 * - definition of load on heterogeneous hosts ?
70 * - how to detect convergence ?
71 * - how to manage link failures ?
74 // xxx: shall we retrieve pending tasks?