当前位置: 首页>>代码示例>>C++>>正文


C++ MSG_function_register函数代码示例

本文整理汇总了C++中MSG_function_register函数的典型用法代码示例。如果您正苦于以下问题:C++ MSG_function_register函数的具体用法?C++ MSG_function_register怎么用?C++ MSG_function_register使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了MSG_function_register函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: run_mra_simulation

/**
 * @param  platform_file   The path/name of the platform file.
 * @param  deploy_file     The path/name of the deploy file.
 * @param  mra_config_file  The path/name of the configuration file.
 * @param  vc_file_name   The volunteer computing configuration file.
 */
static msg_error_t run_mra_simulation (const char* platform_file, const char* deploy_file, const char* mra_config_file, const char* vc_file_name)
{
    msg_error_t  res_mra = MSG_OK;

    read_mra_config_file (mra_config_file);

    MSG_create_environment (platform_file);

    read_bandwidth (platform_file);

    init_mra_vc (vc_file_name);

    // for tracing purposes..
    TRACE_category_with_color ("MRA_MAP", "1 0 0");
    TRACE_category_with_color ("MRA_REDUCE", "0 0 1");

    MSG_function_register ("master_mra", master_mra);
    MSG_function_register ("worker_mra", worker_mra);
    MSG_launch_application (deploy_file);

    init_mr_mra_config (mra_config_file);

    res_mra = MSG_main ();

    free_mra_global_mem ();

    return res_mra;
}
开发者ID:MRSG-MRA,项目名称:MRA,代码行数:34,代码来源:simcore_mra-struct3.c

示例2: main

/** Main function */
int main(int argc, char *argv[])
{
    msg_error_t res = MSG_OK;

    /* Argument checking */
    MSG_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_function_register("policeman", policeman);
    MSG_launch_application(argv[2]);

    /* Run the simulation */
    mutex = xbt_mutex_init();
    cond = xbt_cond_init();
    res = MSG_main();
    XBT_INFO("Simulation time %g", MSG_get_clock());
    xbt_cond_destroy(cond);
    xbt_mutex_destroy(mutex);

    if (res == MSG_OK)
        return 0;
    else
        return 1;
}                               /* end_of_main */
开发者ID:ricardojrdez,项目名称:simgrid,代码行数:35,代码来源:migration.c

示例3: main

/** Main function */
int main(int argc, char *argv[])
{
  msg_error_t res;
  const char *platform_file;
  const char *application_file;

  MSG_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);
  }
  platform_file = argv[1];
  application_file = argv[2];

  {                             /*  Simulation setting */
    MSG_create_environment(platform_file);
  }
  {                             /*   Application deployment */
    MSG_function_register("master", master);
    MSG_function_register("slave", slave);

    MSG_launch_application(application_file);
  }
  res = MSG_main();

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

  if (res == MSG_OK)
    return 0;
  else
    return 1;
}                               /* end_of_main */
开发者ID:apargupta,项目名称:simgrid,代码行数:34,代码来源:process_join.c

示例4: main

int main(int argc, char *argv[])
{
  MSG_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);
  }
  const char *platform_file = argv[1];
  const char *application_file = argv[2];
  MSG_create_environment(platform_file);
  MSG_function_register("receiver", receiver);
  MSG_function_register("sender", sender);

  MSG_launch_application(application_file);
#ifndef DISABLE_THE_MUTEX
  mutex = xbt_mutex_init();
#endif
  msg_error_t res = MSG_main();
#ifndef DISABLE_THE_MUTEX
  xbt_mutex_destroy(mutex); mutex = NULL;
#endif
  XBT_INFO("Simulation time %g", MSG_get_clock());

  if (res == MSG_OK)
    return 0;
  else
    return 1;
}
开发者ID:apargupta,项目名称:simgrid,代码行数:29,代码来源:mutex_handling.c

示例5: test_all

/** Test function */
MSG_error_t test_all(const char *platform_file,
                     const char *application_file)
{
  MSG_error_t res = MSG_OK;

  {                             /*  Simulation setting */
    MSG_set_channel_number(0);
    MSG_create_environment(platform_file);
  }
  {
    //declaring user categories with RGB colors
    TRACE_category_with_color ("compute", "1 0 0"); //red
    TRACE_category_with_color ("request", "0 1 0"); //green
    TRACE_category_with_color ("data", "0 0 1");    //blue
    TRACE_category_with_color ("finalize", "0 0 0");//black
  }
  {                             /*   Application deployment */
    MSG_function_register("master", master);
    MSG_function_register("slave", slave);
    MSG_launch_application(application_file);
  }
  res = MSG_main();

  XBT_INFO("Simulation time %g", MSG_get_clock());
  return res;
}
开发者ID:rosacris,项目名称:simgrid,代码行数:27,代码来源:categories.c

示例6: main

/** Main function */
int main(int argc, char *argv[])
{
  MSG_init(&argc, argv);
  if (argc < 3) {
    printf("Usage: %s platform_file deployment_file\n", argv[0]);
    exit(1);
  }

  char *platform_file = argv[1];
  char *deployment_file = argv[2];
  MSG_create_environment(platform_file);

  //declaring user variables
  TRACE_host_variable_declare("HDD_capacity");
  TRACE_host_variable_declare("HDD_utilization");

  //register functions and launch deployment
  MSG_function_register("master", master);
  MSG_function_register("slave", master);
  MSG_launch_application(deployment_file);

  MSG_main();

  //get user declared variables
  unsigned int cursor;
  char *variable;
  xbt_dynar_t host_variables = TRACE_get_host_variables ();
  if (host_variables){
    XBT_INFO ("Declared host variables:");
    xbt_dynar_foreach (host_variables, cursor, variable){
      XBT_INFO ("%s", variable);
    }
    xbt_dynar_free (&host_variables);
  }
开发者ID:FlorianPO,项目名称:simgrid,代码行数:35,代码来源:user_variables.c

示例7: main

int main(int argc, char *argv[])
{
  MSG_init(&argc, argv);
  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
             "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);

  MSG_create_environment(argv[1]);

  //declaring user variables
  TRACE_host_variable_declare("HDD_capacity");
  TRACE_host_variable_declare("HDD_utilization");

  //register functions and launch deployment
  MSG_function_register("master", trace_fun);
  MSG_function_register("worker", trace_fun);
  MSG_launch_application(argv[2]);

  MSG_main();

  //get user declared variables
  unsigned int cursor;
  char *variable;
  xbt_dynar_t host_variables = TRACE_get_host_variables ();
  if (host_variables){
    XBT_INFO ("Declared host variables:");
    xbt_dynar_foreach (host_variables, cursor, variable){
      XBT_INFO ("%s", variable);
    }
    xbt_dynar_free (&host_variables);
  }
开发者ID:dindon-sournois,项目名称:simgrid,代码行数:30,代码来源:trace-host-user-variables.c

示例8: main

int main(int argc, char *argv[])
{
  msg_error_t res = MSG_OK;

  MSG_init(&argc, argv);

  MSG_create_environment(argv[1]);

  /* Trace categories */
  TRACE_category_with_color("host0", "0 0 1");
  TRACE_category_with_color("host1", "0 1 0");
  TRACE_category_with_color("host2", "0 1 1");
  TRACE_category_with_color("host3", "1 0 0");
  TRACE_category_with_color("host4", "1 0 1");
  TRACE_category_with_color("host5", "0 0 0");
  TRACE_category_with_color("host6", "1 1 0");
  TRACE_category_with_color("host7", "1 1 1");
  TRACE_category_with_color("host8", "0 1 0");

  /*   Application deployment */
  MSG_function_register("broadcaster", broadcaster);
  MSG_function_register("peer", peer);

  MSG_launch_application(argv[2]);

  res = MSG_main();

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

  return res != MSG_OK;
}
开发者ID:R7R8,项目名称:simgrid,代码行数:31,代码来源:chainsend.c

示例9: main

int main(int argc, char *argv[])
{
  MSG_init(&argc, argv);
  MSG_create_environment("../msg_platform.xml");
  MSG_function_register("coordinator", coordinator);
  MSG_function_register("client", client);
  MSG_launch_application("deploy_mutex.xml");
  MSG_main();
  return 0;
}
开发者ID:Shurakai,项目名称:SimGrid,代码行数:10,代码来源:centralized_mutex.c

示例10: main

/** Main function */
int main(int argc, char *argv[])
{
  msg_error_t res = MSG_OK;
  long i;

  MSG_init(&argc, argv);
  if (argc < 4) {
    printf("Usage: %s platform_file number_of_jobs number_of_slaves\n", argv[0]);
    printf("example: %s msg_platform.xml 10 5\n", argv[0]);
    exit(1);
  }

  MSG_function_register("master", master);
  MSG_function_register("slave", slave);

  MSG_create_environment(argv[1]);

  number_of_jobs = atol(argv[2]);
  number_of_slaves = atol(argv[3]);
  xbt_dynar_t host_dynar = MSG_hosts_as_dynar();
  long number_max = xbt_dynar_length(host_dynar);
  XBT_INFO("Got %ld slaves, %ld tasks to process, and %ld hosts", number_of_slaves, number_of_jobs,number_max);

  msg_host_t *host_table =  xbt_dynar_to_array(host_dynar);
  //xbt_dynar_free(&host_dynar);

  MSG_process_create( "master",
                      master,
                      NULL,
                      host_table[my_random(number_max)]
                      );

  for(i = 0 ; i<number_of_slaves; i++)
  {
    char* name_host = bprintf("slave-%ld",i);
      MSG_process_create( name_host,
                          slave,
                          NULL,
                          host_table[my_random(number_max)]
                          );
      free(name_host);
  }
  xbt_free(host_table);

  res = MSG_main();

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

  if (res == MSG_OK)
    return 0;
  else
    return 1;
}                               /* end_of_main */
开发者ID:Julio-Anjos,项目名称:simgrid,代码行数:54,代码来源:masterslave_arg.c

示例11: main

int main(int argc, char *argv[])
{
  MSG_init(&argc, argv);

  MSG_create_environment("platform.xml");

  MSG_function_register("server", server);
  MSG_function_register("client", client);
  MSG_launch_application("deploy_bugged1.xml");

  MSG_main();
  return 0;
}
开发者ID:R7R8,项目名称:simgrid,代码行数:13,代码来源:bugged1.c

示例12: run

MSG_error_t run(const char *platform_file,const char *application_file)
{

    MSG_error_t res = MSG_OK;

    XBT_INFO("running simulation");

    /*  Simulation setting */
    MSG_create_environment(platform_file);

    /*   Application deployment */
    MSG_function_register("service_cordel",service_cordel);
    MSG_function_register("service_chor",service_chor);
    MSG_function_register("service", service);
    MSG_function_register("broker",broker);
    MSG_function_register("service_controller",service_controller);
    MSG_function_register("broker_controller",broker_controller);
    MSG_function_register("service_chor_controller",service_chor_controller);
    MSG_function_register("service_cordel_controller",service_cordel_controller);
    MSG_launch_application(application_file);


    res = MSG_main();

    return res;
}/* end_of_test_all */
开发者ID:choreos,项目名称:ChoreographySimulator,代码行数:26,代码来源:chor.c

示例13: test_all

/** Test function */
msg_error_t test_all(const char *platform_file)
{
  msg_error_t res = MSG_OK;
  MSG_create_environment(platform_file);
  MSG_function_register("master", master);
  MSG_function_register("slave", slave);
  surf_parse = bypass_deployment;
  MSG_launch_application(NULL);

  res = MSG_main();

  XBT_INFO("Simulation time %g", MSG_get_clock());
  return res;
}                               /* end_of_test_all */
开发者ID:tempbottle,项目名称:simgrid,代码行数:15,代码来源:masterslave_cluster.c

示例14: main

int main(int argc, char *argv[])
{
  MSG_init(&argc, argv);

  MC_automaton_new_propositional_symbol_pointer("cs", &cs);

  MSG_create_environment("../msg_platform.xml");
  MSG_function_register("coordinator", coordinator);
  MSG_function_register("client", client);
  MSG_launch_application("deploy_bugged2_liveness.xml");
  MSG_main();

  return 0;

}
开发者ID:mpoquet,项目名称:simgrid,代码行数:15,代码来源:bugged2_liveness.c

示例15: main

int main(int argc, char *argv[]){
    MSG_init(&argc, argv);

    MSG_create_environment(argv[1]);

    MSG_function_register("scheduler", scheduler);
    MSG_function_register("dispatcher", dispatcher);
    MSG_function_register("tier1", tier1);
    MSG_launch_application(argv[2]);

    msg_error_t res = MSG_main();

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

    return res != MSG_OK;
}
开发者ID:kenenbek,项目名称:CSim2Sim,代码行数:16,代码来源:main.c


注:本文中的MSG_function_register函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。