Esempio n. 1
0
/** Emitter function  */
int master(int argc, char *argv[])
{
  double task_comp_size = 5E7;
  double task_comm_size = 1E6;

  char mailbox[256];
  msg_task_t task = NULL;
  msg_host_t jupiter = MSG_get_host_by_name("Jupiter");
  sprintf(mailbox, "jupi");

  task = MSG_task_create("task on", task_comp_size, task_comm_size, NULL);
  XBT_INFO("Sending \"%s\"", task->name);
  if (MSG_task_send_with_timeout(task, mailbox, 1) != MSG_OK)
    MSG_task_destroy(task);

  MSG_process_sleep(1);
  MSG_host_off(jupiter);

  task = MSG_task_create("task off", task_comp_size, task_comm_size, NULL);
  XBT_INFO("Sending \"%s\"", task->name);
  if (MSG_task_send_with_timeout(task, mailbox, 1) != MSG_OK)
    MSG_task_destroy(task);

  MSG_host_on(jupiter);
  xbt_swag_t jupi_processes = MSG_host_get_process_list(jupiter);
  void *process;
  xbt_swag_foreach(process, jupi_processes) {
    MSG_process_kill(process);
  }
Esempio n. 2
0
int service_controller(int argc,char *argv[]){
    int count = argc-1;
    char **arg=(char **)calloc(count,sizeof(char*));
    int process_number = atoi(argv[1]);
    m_process_t process_list[process_number];
    arg[0] = strdup("service");
    int i;
    for(i=2;i<argc;i++){
	arg[i-1] = strdup(argv[i]);
    }
    
    XBT_INFO("initializing service: %s",arg[1]);
    for(i=2;i<count;i=i+3)
	XBT_INFO("method:%s,time to exec:  %s,output size: %s",arg[i],arg[i+1],arg[i+2]);

    //create a number of process
    for(i=0;i<process_number;i++){
	process_list[i] = MSG_process_create_with_arguments(arg[0],service,NULL,MSG_host_self(),count,arg);
    }
    MSG_process_sleep(MAX_TIME_SIMULATION);    
    //kill all process in process_list
    for(i=0;i<process_number;i++){
	MSG_process_kill(process_list[i]);
    }
}
Esempio n. 3
0
void MSG_process_kill_from_SIMIX(smx_process_t p)
{
#ifdef HAVE_TRACING
  TRACE_msg_process_kill(p);
#endif
  MSG_process_kill(p);
}
Esempio n. 4
0
static int master(int argc, char *argv[])
{
    xbt_swag_t process_list = MSG_host_get_process_list(MSG_host_self());
    msg_process_t process = NULL;
    MSG_process_sleep(1);
    xbt_swag_foreach(process, process_list) {
        XBT_INFO("Process(pid=%d, ppid=%d, name=%s)", MSG_process_get_PID(process), MSG_process_get_PPID(process),
                 MSG_process_get_name(process));
        if (MSG_process_self_PID() != MSG_process_get_PID(process))
            MSG_process_kill(process);
    }
Esempio n. 5
0
JNIEXPORT void JNICALL
Java_org_simgrid_msg_Process_kill(JNIEnv * env,
                                  jobject jprocess)
{
	/* get the native instances from the java ones */
  msg_process_t process = jprocess_to_native_process(jprocess, env);
  if (!process) {
    jxbt_throw_notbound(env, "process", jprocess);
    return;
  }

	MSG_process_kill(process);
}
Esempio n. 6
0
static int killer(int argc, char *argv[])
{
  XBT_INFO("Hello!");         /* - First start a victim process */
  msg_process_t poor_victim = MSG_process_create("victim", victim, NULL, MSG_host_by_name("Fafard"));
  MSG_process_sleep(10.0);

  XBT_INFO("Resume process"); /* - Resume it from its suspended state */
  MSG_process_resume(poor_victim);

  XBT_INFO("Kill process");   /* - and then kill it */
  MSG_process_kill(poor_victim);

  XBT_INFO("OK, goodbye now.");
  return 0;
}