Beispiel #1
0
/**
 * \brief Main function.
 */
int main(int argc, char *argv[])
{
#ifdef BENCH_THIS_CODE
    xbt_os_cputimer_t timer = xbt_os_timer_new();
#endif

    MSG_init(&argc, argv);

    char **options = &argv[1];
    const char* platform_file = options[0];
    const char* application_file = options[1];

    MSG_create_environment(platform_file);

    MSG_function_register("node", node);
    MSG_launch_application(application_file);

#ifdef BENCH_THIS_CODE
    xbt_os_cputimer_start(timer);
#endif
    msg_error_t res = MSG_main();
#ifdef BENCH_THIS_CODE
    xbt_os_cputimer_stop(timer);
#endif
    XBT_CRITICAL("Simulated time: %g", MSG_get_clock());

    if (res == MSG_OK)
        return 0;
    else
        return 1;
}
int main(int argc, char **argv)
{
  int i, j;
  xbt_os_timer_t timer = xbt_os_timer_new();

  SD_init(&argc, argv);
  SD_create_environment(argv[1]);

  sg_host_t *hosts = sg_host_list();
  int host_count = sg_host_count();

  /* Random number initialization */
  srand( (int) (xbt_os_time()*1000) );

  do {
    i = rand()%host_count;
    j = rand()%host_count;
  } while(i==j);

  sg_host_t h1 = hosts[i];
  sg_host_t h2 = hosts[j];
  printf("%d\tand\t%d\t\t",i,j);

  xbt_os_cputimer_start(timer);
  SD_route_get_list(h1, h2);
  xbt_os_cputimer_stop(timer);

  printf("%f\n", xbt_os_timer_elapsed(timer) );

  xbt_free(hosts);
  SD_exit();

  return 0;
}
Beispiel #3
0
static void create_environment(xbt_os_timer_t parse_time, const char *platformFile)
{
  try {
    xbt_os_cputimer_start(parse_time);
    SD_create_environment(platformFile);
    xbt_os_cputimer_stop(parse_time);
  }
  catch (std::exception& e) {
    xbt_die("Error while loading %s: %s", platformFile, e.what());
  }
}
Beispiel #4
0
static void create_environment(xbt_os_timer_t parse_time, const char *platformFile)
{
  xbt_ex_t e;
  TRY {
    xbt_os_cputimer_start(parse_time);
    SD_create_environment(platformFile);
    xbt_os_cputimer_stop(parse_time);
  }
  CATCH(e) {
    xbt_die("Error while loading %s: %s", platformFile, e.msg);
  }
}