Beispiel #1
0
/** Receiver function  */
int slave(int argc, char *argv[])
{
  m_task_t task = NULL;
  int res;

  while (1) {
    res = MSG_task_receive(&(task), "master_mailbox");
    if (res != MSG_OK) {
      XBT_INFO("error");
      break;
    }

    char *data = MSG_task_get_data(task);
    if (data && !strcmp(data, "finalize")) {
      MSG_task_destroy(task);
      break;
    }

    XBT_INFO("Executing task %f", MSG_task_get_compute_duration(task));
    MSG_task_execute(task);
    XBT_INFO("End of execution");
    MSG_task_destroy(task);
    task = NULL;
  }
  return 0;
}
Beispiel #2
0
/**
 * @brief  Returns for how long a task is running.
 * @param  task  The task to be probed.
 * @return The amount of seconds since the beginning of the computation.
 */
static int task_time_elapsed (msg_task_t task)
{
    task_info_t  ti;

    ti = (task_info_t) MSG_task_get_data (task);

    return (MSG_task_get_compute_duration (task) - MSG_task_get_remaining_computation (task))
	/ MSG_get_host_speed (config.workers[ti->wid]);
}
Beispiel #3
0
/** Receiver function  */
int slave(int argc, char *argv[])
{
  m_task_t task = NULL;
  int res;

  TRACE_host_variable_set("is_slave", 1);
  while (1) {
    res = MSG_task_receive(&(task), "master_mailbox");

    if (!strcmp(MSG_task_get_name(task), "finalize")) {
      MSG_task_destroy(task);
      break;
    }
    //adding the value returned by MSG_task_get_compute_duration(task)
    //to the variable "task_computation"
    TRACE_host_variable_add("task_computation",
                            MSG_task_get_compute_duration(task));
    MSG_task_execute(task);
    MSG_task_destroy(task);
    task = NULL;
  }
  return 0;
}