/* Explicit initialization of the action module is required now*/
MSG_action_init();
- if (argc < 3) {
- printf("Usage: %s platform_file deployment_file [action_files]\n", argv[0]);
- printf
- ("example: %s msg_platform.xml msg_deployment.xml actions # if all actions are in the same file\n",
- argv[0]);
- printf
- ("example: %s msg_platform.xml msg_deployment.xml # if actions are in separate files, specified in deployment\n",
- argv[0]);
- exit(1);
- }
+ xbt_assert(argc > 2,
+ "Usage: %s platform_file deployment_file [action_files]\n"
+ "\t# if all actions are in the same file\n"
+ "\tExample: %s msg_platform.xml msg_deployment.xml actions\n"
+ "\t# if actions are in separate files, specified in deployment\n"
+ "\tExample: %s msg_platform.xml msg_deployment.xml ",
+ argv[0],argv[0],argv[0]);
+
printf("WARNING: THIS BINARY IS KINDA DEPRECATED\n"
"This example is still relevant if you want to learn about MSG-based trace replay, "
"but if you want to simulate MPI-like traces, you should use the newer version "
/* Explicit finalization of the action module is required now*/
MSG_action_exit();
- if (res == MSG_OK)
- return 0;
- else
- return 1;
+ return res != MSG_OK;
} /* end_of_main */
msg_error_t res = MSG_OK;
-
-
XBT_DEBUG("test_all");
/* Simulation setting */
_set_output_format(prev_exponent_format);
#endif
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return res != MSG_OK;
+}
int main(int argc, char *argv[])
{
MSG_init(&argc, argv);
- if (argc < 3) {
- printf("Usage: %s [-nb_bits=n] [-timeout=t] platform_file deployment_file\n", argv[0]);
- printf("example: %s ../msg_platform.xml chord.xml\n", argv[0]);
- exit(1);
- }
+ xbt_assert(argc > 2,
+ "Usage: %s [-nb_bits=n] [-timeout=t] platform_file deployment_file\n"
+ "\tExample: %s ../msg_platform.xml chord.xml\n",
+ argv[0], argv[0]);
char **options = &argv[1];
while (!strncmp(options[0], "-", 1)) {
chord_exit();
- if (res == MSG_OK)
- return 0;
- else
- return 1;
+ return res != MSG_OK;
}
sg_energy_plugin_init();
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.xml\n",
- argv[0]);
- exit(1);
- }
-
+ 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]);
/* Application deployment */
XBT_INFO("Total simulation time: %.2f", MSG_get_clock());
- if (res == MSG_OK)
- return 0;
- else
- return 1;
+ return res != MSG_OK;
}
#include "xbt/asserts.h"
XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
- "Messages specific for this msg example");
+ "Messages specific for this msg example");
static void simulate_bootup(msg_host_t host) {
- int previous_pstate = MSG_host_get_pstate(host);
+ int previous_pstate = MSG_host_get_pstate(host);
- XBT_INFO("Switch to virtual pstate 3, that encodes the shutting down state in the XML file of that example");
- MSG_host_set_pstate(host,3);
+ XBT_INFO("Switch to virtual pstate 3, that encodes the shutting down state in the XML file of that example");
+ MSG_host_set_pstate(host,3);
- msg_host_t host_list[1] = {host};
- double flops_amount[1] = {1};
- double bytes_amount[1] = {0};
+ msg_host_t host_list[1] = {host};
+ double flops_amount[1] = {1};
+ double bytes_amount[1] = {0};
- XBT_INFO("Actually start the host");
- MSG_host_on(host);
+ XBT_INFO("Actually start the host");
+ MSG_host_on(host);
- XBT_INFO("Simulate the boot up by executing one flop on that host");
- // We use a parallel task to run some task on a remote host.
- msg_task_t bootup = MSG_parallel_task_create("boot up", 1, host_list, flops_amount, bytes_amount, NULL);
- MSG_task_execute(bootup);
- MSG_task_destroy(bootup);
+ XBT_INFO("Simulate the boot up by executing one flop on that host");
+ // We use a parallel task to run some task on a remote host.
+ msg_task_t bootup = MSG_parallel_task_create("boot up", 1, host_list, flops_amount, bytes_amount, NULL);
+ MSG_task_execute(bootup);
+ MSG_task_destroy(bootup);
- XBT_INFO("Switch back to previously selected pstate %d", previous_pstate);
- MSG_host_set_pstate(host, previous_pstate);
+ XBT_INFO("Switch back to previously selected pstate %d", previous_pstate);
+ MSG_host_set_pstate(host, previous_pstate);
}
static void simulate_shutdown(msg_host_t host) {
- int previous_pstate = MSG_host_get_pstate(host);
+ int previous_pstate = MSG_host_get_pstate(host);
- XBT_INFO("Switch to virtual pstate 4, that encodes the shutting down state in the XML file of that example");
- MSG_host_set_pstate(host,4);
+ XBT_INFO("Switch to virtual pstate 4, that encodes the shutting down state in the XML file of that example");
+ MSG_host_set_pstate(host,4);
- msg_host_t host_list[1] = {host};
- double flops_amount[1] = {1};
- double bytes_amount[1] = {0};
+ msg_host_t host_list[1] = {host};
+ double flops_amount[1] = {1};
+ double bytes_amount[1] = {0};
- XBT_INFO("Simulate the shutdown by executing one flop on that remote host (using a parallel task)");
- msg_task_t shutdown = MSG_parallel_task_create("shutdown", 1, host_list, flops_amount, bytes_amount, NULL);
- MSG_task_execute(shutdown);
- MSG_task_destroy(shutdown);
+ XBT_INFO("Simulate the shutdown by executing one flop on that remote host (using a parallel task)");
+ msg_task_t shutdown = MSG_parallel_task_create("shutdown", 1, host_list, flops_amount, bytes_amount, NULL);
+ MSG_task_execute(shutdown);
+ MSG_task_destroy(shutdown);
- XBT_INFO("Switch back to previously selected pstate %d", previous_pstate);
- MSG_host_set_pstate(host, previous_pstate);
+ XBT_INFO("Switch back to previously selected pstate %d", previous_pstate);
+ MSG_host_set_pstate(host, previous_pstate);
- XBT_INFO("Actually shutdown the host");
- MSG_host_off(host);
+ XBT_INFO("Actually shutdown the host");
+ MSG_host_off(host);
}
static int onoff(int argc, char *argv[]) {
- msg_host_t host1 = MSG_host_by_name("MyHost1");
+ msg_host_t host1 = MSG_host_by_name("MyHost1");
- XBT_INFO("Energetic profile: %s",
- MSG_host_get_property_value(host1,"watt_per_state"));
- XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J",
- MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
+ XBT_INFO("Energetic profile: %s",
+ MSG_host_get_property_value(host1,"watt_per_state"));
+ XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J",
+ MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
- XBT_INFO("Sleep for 10 seconds");
- MSG_process_sleep(10);
- XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J",
- MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
+ XBT_INFO("Sleep for 10 seconds");
+ MSG_process_sleep(10);
+ XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J",
+ MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
- simulate_shutdown(host1);
- XBT_INFO("Host1 is now OFF. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
- MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
+ simulate_shutdown(host1);
+ XBT_INFO("Host1 is now OFF. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
+ MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
- XBT_INFO("Sleep for 10 seconds");
- MSG_process_sleep(10);
- XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J",
- MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
+ XBT_INFO("Sleep for 10 seconds");
+ MSG_process_sleep(10);
+ XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J",
+ MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
- simulate_bootup(host1);
- XBT_INFO("Host1 is now ON again. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
- MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
+ simulate_bootup(host1);
+ XBT_INFO("Host1 is now ON again. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
+ MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
- return 0;
+ return 0;
}
int main(int argc, char *argv[])
{
- msg_error_t res = MSG_OK;
- sg_energy_plugin_init();
- MSG_init(&argc, argv);
+ msg_error_t res = MSG_OK;
+ sg_energy_plugin_init();
+ 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.xml\n",
- argv[0]);
- exit(1);
- }
+ 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]);
+ MSG_create_environment(argv[1]);
- /* Application deployment */
- MSG_function_register("onoff_test", onoff);
+ /* Application deployment */
+ MSG_function_register("onoff_test", onoff);
- MSG_launch_application(argv[2]);
+ MSG_launch_application(argv[2]);
- res = MSG_main();
+ res = MSG_main();
- XBT_INFO("Total simulation time: %.2f", MSG_get_clock());
+ XBT_INFO("Total simulation time: %.2f", MSG_get_clock());
- if (res == MSG_OK)
- return 0;
- else
- return 1;
+ return res != MSG_OK;
}
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.xml\n",
- argv[0]);
- exit(1);
- }
-
+ 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]);
/* Application deployment */
XBT_INFO("Total simulation time: %e", MSG_get_clock());
- if (res == MSG_OK)
- return 0;
- else
- return 1;
+ return res != MSG_OK;
}
static int worker_func() {
- msg_task_t task1 = MSG_task_create("t1", 300E6, 0, NULL);
- MSG_task_execute (task1);
- MSG_task_destroy(task1);
- XBT_INFO("This worker is done.");
- return 0;
+ msg_task_t task1 = MSG_task_create("t1", 300E6, 0, NULL);
+ MSG_task_execute (task1);
+ MSG_task_destroy(task1);
+ XBT_INFO("This worker is done.");
+ return 0;
}
static int dvfs(int argc, char *argv[])
{
- msg_host_t host1 = MSG_host_by_name("MyHost1");
- msg_host_t host2 = MSG_host_by_name("MyHost2");
- msg_host_t host3 = MSG_host_by_name("MyHost3");
-
- /* Host 1 */
- XBT_INFO("Creating and starting two VMs");
- msg_vm_t vm_host1 = MSG_vm_create(host1, "vm_host1", 4, 2048, 100, NULL, 1024 * 20, 10,50);
- MSG_vm_start(vm_host1);
- msg_vm_t vm_host3 = MSG_vm_create(host3, "vm_host3", 4, 2048, 100, NULL, 1024 * 20, 10,50);
- MSG_vm_start(vm_host3);
-
- XBT_INFO("Create two tasks on Host1: one inside a VM, the other directly on the host");
- MSG_process_create("p11", worker_func, NULL, vm_host1);
- MSG_process_create("p12", worker_func, NULL, host1);
-
- XBT_INFO("Create two tasks on Host2: both directly on the host");
- MSG_process_create("p21", worker_func, NULL, host2);
- MSG_process_create("p22", worker_func, NULL, host2);
-
- XBT_INFO("Create two tasks on Host3: both inside a VM");
- MSG_process_create("p31", worker_func, NULL, vm_host3);
- MSG_process_create("p32", worker_func, NULL, vm_host3);
-
- XBT_INFO("Wait 5 seconds. The tasks are still running (they run for 3 seconds, but 2 tasks are co-located, so they run for 6 seconds)");
- MSG_process_sleep(5);
- XBT_INFO("Wait another 5 seconds. The tasks stop at some point in between");
- MSG_process_sleep(5);
-
- MSG_vm_shutdown(vm_host1);
- MSG_vm_shutdown(vm_host3);
-
- return 0;
+ msg_host_t host1 = MSG_host_by_name("MyHost1");
+ msg_host_t host2 = MSG_host_by_name("MyHost2");
+ msg_host_t host3 = MSG_host_by_name("MyHost3");
+
+ /* Host 1 */
+ XBT_INFO("Creating and starting two VMs");
+ msg_vm_t vm_host1 = MSG_vm_create(host1, "vm_host1", 4, 2048, 100, NULL, 1024 * 20, 10,50);
+ MSG_vm_start(vm_host1);
+ msg_vm_t vm_host3 = MSG_vm_create(host3, "vm_host3", 4, 2048, 100, NULL, 1024 * 20, 10,50);
+ MSG_vm_start(vm_host3);
+
+ XBT_INFO("Create two tasks on Host1: one inside a VM, the other directly on the host");
+ MSG_process_create("p11", worker_func, NULL, vm_host1);
+ MSG_process_create("p12", worker_func, NULL, host1);
+
+ XBT_INFO("Create two tasks on Host2: both directly on the host");
+ MSG_process_create("p21", worker_func, NULL, host2);
+ MSG_process_create("p22", worker_func, NULL, host2);
+
+ XBT_INFO("Create two tasks on Host3: both inside a VM");
+ MSG_process_create("p31", worker_func, NULL, vm_host3);
+ MSG_process_create("p32", worker_func, NULL, vm_host3);
+
+ XBT_INFO("Wait 5 seconds. The tasks are still running (they run for 3 seconds, but 2 tasks are co-located, so they run for 6 seconds)");
+ MSG_process_sleep(5);
+ XBT_INFO("Wait another 5 seconds. The tasks stop at some point in between");
+ MSG_process_sleep(5);
+
+ MSG_vm_shutdown(vm_host1);
+ MSG_vm_shutdown(vm_host3);
+
+ return 0;
}
int main(int argc, char *argv[])
{
- msg_error_t res = MSG_OK;
- sg_energy_plugin_init();
- MSG_init(&argc, argv);
+ msg_error_t res = MSG_OK;
+ sg_energy_plugin_init();
+ MSG_init(&argc, argv);
- if (argc != 2) {
- XBT_CRITICAL("Usage: %s platform_file\n", argv[0]);
- xbt_die("example: %s msg_platform.xml\n", argv[0]);
- }
+ xbt_assert(argc > 1, "Usage: %s platform_file\n"
+ "\tExample: %s msg_platform.xml\n",
+ argv[0], argv[0]);
- MSG_create_environment(argv[1]);
+ MSG_create_environment(argv[1]);
- /* Application deployment */
- MSG_process_create("dvfs",dvfs,NULL,MSG_host_by_name("MyHost1"));
+ /* Application deployment */
+ MSG_process_create("dvfs",dvfs,NULL,MSG_host_by_name("MyHost1"));
- res = MSG_main();
+ res = MSG_main();
- XBT_INFO("Total simulation time: %.2f; All hosts must have the exact same energy consumption.", MSG_get_clock());
+ XBT_INFO("Total simulation time: %.2f; All hosts must have the exact same energy consumption.", MSG_get_clock());
- if (res == MSG_OK)
- return 0;
- else
- return 1;
+ return res != MSG_OK;
}
msg_error_t res = MSG_OK;
MSG_init(&argc, argv);
- if (argc < 3) {
- XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
- exit(1);
- }
+ 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_function_register("terrorist", terrorist);
MSG_create_environment(argv[1]);
MSG_launch_application(argv[2]);
- /*
- // Simplistic platform with only one host
- sg_platf_begin();
- s_sg_platf_AS_cbarg_t AS = SG_PLATF_AS_INITIALIZER;
- sg_platf_new_AS_begin(&AS);
-
- s_sg_platf_host_cbarg_t host = SG_PLATF_HOST_INITIALIZER;
- host.id = "host0";
- sg_platf_new_host(&host);
-
- sg_platf_new_AS_end();
- sg_platf_end();
-
- // Add one process -- super heavy just to launch an application!
- SIMIX_init_application();
- sg_platf_begin();
-
- s_sg_platf_process_cbarg_t process = SG_PLATF_PROCESS_INITIALIZER;
- process.argc=1;
- process.argv = malloc(sizeof(char*)*2);
- process.argv[0] = "terrorist";
- process.argv[1] = NULL;
- process.host = "host0";
- process.function = "terrorist";
- process.start_time = 0;
- sg_platf_new_process(&process);
- sg_platf_end();
-*/
// Launch the simulation
res = MSG_main();
XBT_INFO("Simulation time %g", MSG_get_clock());
- if (res == MSG_OK)
- return 0;
- else
- return 1;
+ return res != MSG_OK;
}
XBT_INFO("GPU task %p was created", mytask);
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return res != MSG_OK;
+}
bool_printed = 0;
MSG_init(&argc, argv);
- if (argc < 3) {
- printf("Usage: %s platform_file deployment_file\n", argv[0]);
- exit(1);
- }
-
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s platform.xml deployment.xml\n",
+ argv[0], argv[0]);
+
res = test_all(argv[1], argv[2]);
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return res != MSG_OK;
+}
+
\ No newline at end of file
msg_error_t res = MSG_OK;
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);
- }
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+ argv[0], argv[0]);
+
res = test_all(argv[1], argv[2]);
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return res != MSG_OK;
+}
msg_error_t res = MSG_OK;
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);
- }
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+ argv[0], argv[0]);
+
res = test_all(argv[1], argv[2]);
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return res != MSG_OK;
+}
msg_error_t res = MSG_OK;
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);
- }
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+ argv[0], argv[0]);
+
res = test_all(argv[1], argv[2]);
-
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+
+ return res != MSG_OK;
+}
res = MSG_main();
XBT_INFO("Simulation time %g", MSG_get_clock());
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-
+ return res != MSG_OK;
}
res = MSG_main();
XBT_INFO("Simulation time %g", MSG_get_clock());
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-
+ return res != MSG_OK;
}
xbt_dynar_free_container(&storages);
XBT_INFO("Simulation time %g", MSG_get_clock());
- if (res == MSG_OK)
- return 0;
- else
- return 1;
+ return res != MSG_OK;
}
msg_error_t res = MSG_main();
XBT_INFO("Simulated time: %g", MSG_get_clock());
- if (res == MSG_OK)
- return 0;
- else
- return 1;
+ return res != MSG_OK;
}
MSG_init(&argc, argv);
/* Check the arguments */
- if (argc < 3) {
- printf("Usage: %s platform_file deployment_file \n", argv[0]);
- return -1;
- }
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+ argv[0], argv[0]);
const char *platform_file = argv[1];
const char *deployment_file = argv[2];
XBT_CRITICAL("Messages created: %ld", smx_total_comms);
XBT_INFO("Simulated time: %g", MSG_get_clock());
- if (res == MSG_OK)
- return 0;
- else
- return 1;
+ return res != MSG_OK;
}
MSG_task_destroy(task);
task = NULL;
}
- XBT_DEBUG("I'm done. See you!");
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+ argv[0], argv[0]);XBT_DEBUG("I'm done. See you!");
return 0;
} /* end_of_slave */ /* end_of_test_all */
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);
- }
+ xbt_assert(argc > 3, "Usage: %s platform_file number_of_jobs number_of_slaves\n"
+ "\tExample: %s msg_platform.xml 10 5\n",
+ argv[0], argv[0]);
MSG_function_register("master", master);
MSG_function_register("slave", slave);
XBT_INFO("Simulation time %g", MSG_get_clock());
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return res != MSG_OK;
+}
MSG_init(&argc, argv);
res = test_all();
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return res != MSG_OK;
+}
MSG_init(&argc, argv);
res = test_all(argv[1]);
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return res != MSG_OK;
+}
msg_error_t res = MSG_OK;
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);
- }
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+ argv[0], argv[0]);
+
res = test_all(argv[1], argv[2]);
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return res != MSG_OK;
+}
msg_error_t res = MSG_OK;
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);
- }
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+ argv[0], argv[0]);
+
res = test_all(argv[1], argv[2]);
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return res != MSG_OK;
+}
msg_error_t res = MSG_OK;
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);
- }
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment_suspend.xml\n",
+ argv[0], argv[0]);
+
test_all(argv[1], argv[2]);
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return res != MSG_OK;
+}
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);
- }
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+ argv[0], argv[0]);
+
platform_file = argv[1];
application_file = argv[2];
XBT_INFO("Simulation time %g", MSG_get_clock());
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return 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);
- }
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment_suspend.xml\n",
+ argv[0], argv[0]);
/* Simulation setting */
MSG_create_environment(argv[1]);
xbt_cond_destroy(cond);
xbt_mutex_destroy(mutex);
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return res != MSG_OK;
+}
bool_printed = 0;
MSG_init(&argc, argv);
- if (argc < 3) {
- printf("Usage: %s platform_file deployment_file\n", argv[0]);
- exit(1);
- }
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s platform.xml deployment.xml\n",
+ argv[0], argv[0]);
+
res = test_all(argv[1], argv[2]);
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return res != MSG_OK;
+}
msg_error_t res = MSG_OK;
MSG_init(&argc, argv);
- if (argc < 2) {
- printf("Usage: %s platform_file\n", argv[0]);
- printf("example: %s msg_platform.xml\n", argv[0]);
- exit(1);
- }
+ xbt_assert(argc > 1, "Usage: %s platform_file\n"
+ "\tExample: %s msg_platform.xml", argv[0], argv[0]);
res = test_all(argv[1]);
- if (res == MSG_OK)
- return 0;
- else
- return 1;
+ return res != MSG_OK;
}
msg_error_t res = MSG_OK;
MSG_init(&argc, argv);
- if (argc < 3) {
- printf("Usage: %s platform_file deployment_file\n", argv[0]);
- exit(1);
- }
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+ argv[0], argv[0]);
+
res = test_all(argv[1], argv[2]);
- if (res == MSG_OK)
- return 0;
- else
- return 1;
+ return res != MSG_OK;
}
int main(int argc, char *argv[])
{
MSG_init(&argc, argv);
- if (argc < 3) {
- printf("Usage: %s [-nb_bits=n] [-timeout=t] platform_file deployment_file\n", argv[0]);
- printf("example: %s ../msg_platform.xml chord.xml\n", argv[0]);
- exit(1);
- }
+ xbt_assert(argc > 2,
+ "Usage: %s [-nb_bits=n] [-timeout=t] platform_file deployment_file\n"
+ "\tExample: %s ../msg_platform.xml pastry10.xml\n",
+ argv[0], argv[0]);
char **options = &argv[1];
while (!strncmp(options[0], "-", 1)) {
XBT_CRITICAL("Messages created: %ld", smx_total_comms);
XBT_INFO("Simulated time: %g", MSG_get_clock());
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-
+ return res != MSG_OK;
}
#endif
XBT_CRITICAL("Simulated time: %g", MSG_get_clock());
- if (res == MSG_OK)
- return 0;
- else
- return 1;
+ return res != MSG_OK;
}
static void create_jobs(xbt_matrix_t A, xbt_matrix_t B, node_job_t *jobs)
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);
- }
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+ argv[0], argv[0]);
+
res = test_all(argv[1], argv[2]);
#ifdef _MSC_VER
_set_output_format(prev_exponent_format);
#endif
- if (res == MSG_OK)
- return 0;
- else
- return 1;
+ return res != MSG_OK;
}
msg_error_t res = MSG_OK;
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);
- }
- res = test_all(argv[1], argv[2]);
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+ argv[0], argv[0]);
+
+ res = test_all(argv[1], argv[2]);
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return res != MSG_OK;
+}
MSG_init(&argc, argv);
- if (argc != 3) {
- XBT_CRITICAL("Usage: %s platform_file deployment_file\n",
- argv[0]);
- xbt_die("example: %s msg_platform.xml msg_deployment.xml\n",argv[0]);
- }
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
res = test_all(argv[1], argv[2]);
_set_output_format(prev_exponent_format);
#endif
- if (res == MSG_OK)
- return 0;
- else
- return 1;
+ return res != MSG_OK;
} /* end_of_main */
msg_error_t res = MSG_OK;
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);
- }
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+ argv[0], argv[0]);
+
test_all(argv[1], argv[2]);
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return res != MSG_OK;
+}
msg_error_t res = MSG_OK;
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);
- }
+ xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment_suspend.xml\n",
+ argv[0], argv[0]);
+
test_all(argv[1], argv[2]);
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-} /* end_of_main */
+ return res != MSG_OK;
+}
res = MSG_main();
XBT_INFO("Simulation time %g", MSG_get_clock());
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-
+ return res != MSG_OK;
}
res = MSG_main();
XBT_INFO("Simulation time %g", MSG_get_clock());
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-
+ return res != MSG_OK;
}
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]);
+ "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+ argv[0], argv[0]);
platform_file = argv[1];
application_file = argv[2];