+void process::receive()
+{
+ message* msg;
+ m_host_t from;
+ while (comm.recv(msg, from)) {
+ switch (msg->get_type()) {
+ case message::INFO:
+ // fixme: update neighbor
+ break;
+ case message::CREDIT:
+ expected_load += msg->get_amount();
+ break;
+ case message::LOAD:
+ load += msg->get_amount();
+ break;
+ }
+ delete msg;
+ }
+}
+
+void process::compute()
+{
+ double duration = opt::comp_cost(load);
+ m_task_t task = MSG_task_create("computation", duration, 0.0, NULL);
+ DEBUG2("Compute %g flop%s.", duration, duration > 1 ? "s" : "");
+ MSG_task_execute(task);
+ MSG_task_destroy(task);
+}
+
+void process::finalize()
+{
+ // fixme
+}
+
+void process::print_loads(e_xbt_log_priority_t logp)
+{
+ if (!LOG_ISENABLED(logp))
+ return;
+ std::ostringstream oss;
+ if (neigh.empty()) {
+ oss << "no neighbor!";
+ } else {
+ std::transform(neigh.begin(), neigh.end() - 1,
+ std::ostream_iterator<double>(oss, ", "),
+ std::mem_fun_ref(&neighbor::get_load));
+ oss << neigh.back().get_load();
+ }
+ LOG1(logp, "Neighbor loads: %s", oss.str().c_str());
+}
+