Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'coverity_scan' of github.com:mquinson/simgrid
[simgrid.git] / examples / msg / cloud / bound.c
index d9c6adc..06a059b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2014. The SimGrid Team.
+/* Copyright (c) 2007-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -24,9 +24,9 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
 
 static int worker_main(int argc, char *argv[])
 {
-  double computation_amount = atof(argv[1]);
-  int use_bound = atoi(argv[2]);
-  double bound = atof(argv[3]);
+  double computation_amount = xbt_str_parse_double(argv[1], "Invalid computation amount: %s");
+  int use_bound = xbt_str_parse_int(argv[2], "Second parameter (use_bound) should be 0 or 1 but is: %s");
+  double bound = xbt_str_parse_double(argv[3], "Invalid bound: %s");
 
   {
     double clock_sta = MSG_get_clock();
@@ -135,39 +135,6 @@ static void test_one_task(msg_host_t hostA)
 
   XBT_INFO("### Test: with/without MSG_task_set_bound");
 
-#if 0
-  /* Easy-to-understand code (without calling MSG_task_set_bound) */
-  {
-    double clock_sta = MSG_get_clock();
-
-    msg_task_t task = MSG_task_create("Task", computation_amount, 0, NULL);
-    MSG_task_execute(task);
-    MSG_task_destroy(task);
-
-    double clock_end = MSG_get_clock();
-    double duration = clock_end - clock_sta;
-    double flops_per_sec = computation_amount / duration;
-
-    XBT_INFO("not bound => duration %f (%f flops/s)", duration, flops_per_sec);
-  }
-
-  /* Easy-to-understand code (with calling MSG_task_set_bound) */
-  {
-    double clock_sta = MSG_get_clock();
-
-    msg_task_t task = MSG_task_create("Task", computation_amount, 0, NULL);
-    MSG_task_set_bound(task, cpu_speed / 2);
-    MSG_task_execute(task);
-    MSG_task_destroy(task);
-
-    double clock_end = MSG_get_clock();
-    double duration = clock_end - clock_sta;
-    double flops_per_sec = computation_amount / duration;
-
-    XBT_INFO("bound to 0.5 => duration %f (%f flops/s)", duration, flops_per_sec);
-  }
-#endif
-
   {
     XBT_INFO("### Test: no bound for Task1@%s", hostA_name);
     launch_worker(hostA, "worker0", computation_amount, 0, 0);
@@ -344,7 +311,7 @@ static int master_main(int argc, char *argv[])
   {
     msg_host_t vm0 = MSG_vm_create_core(pm0, "VM0");
 
-    s_ws_params_t params;
+    s_vm_params_t params;
     memset(&params, 0, sizeof(params));
     params.ramsize = 1L * 1000 * 1000 * 1000; // 1Gbytes
     MSG_host_set_params(vm0, &params);