Exemple #1
0
/** Main function */
int main(int argc, char *argv[])
{
    MSG_error_t res = MSG_OK;

    /* Argument checking */
    MSG_global_init(&argc, argv);
    if (argc < 3) {
        XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
        XBT_CRITICAL("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
                     argv[0]);
        exit(1);
    }

    /* Simulation setting */
    MSG_create_environment(argv[1]);

    /* Application deployment */
    MSG_function_register("emigrant", emigrant);
    MSG_launch_application(argv[2]);

    /* Run the simulation */
    res = MSG_main();
    XBT_INFO("Simulation time %g", MSG_get_clock());
    if (res == MSG_OK)
        res = MSG_clean();

    if (res == MSG_OK)
        return 0;
    else
        return 1;
}                               /* end_of_main */
//Init Msg  From Ruby
static void msg_init(VALUE Class, VALUE args)
{
  char **argv = NULL;
  const char *tmp;
  int argc, type, i;
  VALUE *ptr;
  // Testing The Args Type
  type = TYPE(args);
  if (type != T_ARRAY) {
    rb_raise(rb_eRuntimeError,
             "Bad arguments to msg_init (expecting an array)");
    return;
  }
  ptr = RARRAY_PTR(args);
  argc = RARRAY_LEN(args);
  //  Create C array to hold data_get_struct
  argc++;
  argv = xbt_new0(char *, argc);
  argv[0] = strdup("ruby");
  for (i = 0; i < argc - 1; i++) {
    VALUE value = ptr[i];
    type = TYPE(value);
    //  if (type == T_STRING)
    tmp = RSTRING_PTR(value);
    argv[i + 1] = strdup(tmp);
  }
  // Calling C Msg_Init Method
  MSG_global_init(&argc, argv);

  // Cleanups
  for (i = 0; i < argc; i++)
    free(argv[i]);
  free(argv);
}
Exemple #3
0
int main(int argc, char *argv[])
{   
    MSG_error_t res = MSG_OK;
    MSG_global_init(&argc, argv);


    if (argc != 3) {
        XBT_CRITICAL("Usage: %s platform_file deployment_file \n",
                argv[0]);
        XBT_CRITICAL
            ("example: %s msg_platform.xml msg_deployment.xml \n",
             argv[0]);
        exit(1);
    }
    res = run(argv[1], argv[2]);

    XBT_INFO("Total simulation time: %le", MSG_get_clock());

    MSG_clean();


    if (res == MSG_OK)
        return 0;
    else
        return 1;
} 
/** Main function */
int main(int argc, char *argv[])
{
  MSG_error_t res = MSG_OK;

  MSG_global_init(&argc, argv);
  res = test_all();
  MSG_clean();

  if (res == MSG_OK)
    return 0;
  else
    return 1;
}                               /* end_of_main */
/** Main function */
int main(int argc, char *argv[])
{
  MSG_error_t res = MSG_OK;

  MSG_global_init(&argc,argv);
  if (argc < 3) {
     printf ("Usage: %s platform_file deployment_file\n",argv[0]);
     printf ("example: %s msg_platform.xml msg_deployment.xml\n",argv[0]);
     exit(1);
  }
  res = test_all(argv[1],argv[2]);
  MSG_clean();

  if(res==MSG_OK)
    return 0;
  else
    return 1;
} /* end_of_main */
Exemple #6
0
int main(int argc, char **argv)
{
	int res;
  MSG_global_init(&argc, argv);
  MSG_set_channel_number(MAX_CHANNEL);
  MSG_create_environment(argv[1]);

  MSG_function_register("master", master);
  MSG_function_register("slave", slave);
  surf_parse = surf_parse_bypass_application;
  MSG_launch_application(NULL);

  res = MSG_main();

  XBT_INFO("Simulation time %g", MSG_get_clock());

  MSG_clean();

  if (res == MSG_OK)
    return 0;
  else
    return 1;

}
Exemple #7
0
/** \ingroup msg_simulation
 * \brief Initialize some MSG internal data.
 */
void MSG_global_init_args(int *argc, char **argv)
{
  MSG_global_init(argc, argv);
}