Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix warnings + refactor
authorMERCIER Michael <michael.mercier@inria.fr>
Mon, 13 Nov 2017 13:46:03 +0000 (14:46 +0100)
committerMERCIER Michael <michael.mercier@inria.fr>
Mon, 13 Nov 2017 13:46:03 +0000 (14:46 +0100)
examples/msg/plugin-hostload/plugin-hostload.c
include/simgrid/msg.h
src/msg/msg_task.cpp
src/msg/msg_vm.cpp
teshsuite/msg/task_progress/task_progress.cpp

index 717c54b..e458d27 100644 (file)
@@ -27,7 +27,7 @@ static int execute_load_test(int argc, char* argv[])
   // Run a task
   start            = MSG_get_clock();
   msg_task_t task1 = MSG_task_create("t1", 100E6, 0, NULL);
   // Run a task
   start            = MSG_get_clock();
   msg_task_t task1 = MSG_task_create("t1", 100E6, 0, NULL);
-  XBT_INFO("Run a task of %.0E flops", MSG_task_get_flops_amount(task1));
+  XBT_INFO("Run a task of %.0E flops", MSG_task_get_initial_flops_amount(task1));
   MSG_task_execute(task1);
   MSG_task_destroy(task1);
 
   MSG_task_execute(task1);
   MSG_task_destroy(task1);
 
@@ -44,7 +44,7 @@ static int execute_load_test(int argc, char* argv[])
   // Run a second task
   start = MSG_get_clock();
   task1 = MSG_task_create("t2", 100E6, 0, NULL);
   // Run a second task
   start = MSG_get_clock();
   task1 = MSG_task_create("t2", 100E6, 0, NULL);
-  XBT_INFO("Run a task of %.0E flops", MSG_task_get_flops_amount(task1));
+  XBT_INFO("Run a task of %.0E flops", MSG_task_get_initial_flops_amount(task1));
   MSG_task_execute(task1);
   MSG_task_destroy(task1);
   XBT_INFO("Done working on my task; this took %.2fs; current peak speed: %.0E flop/s; number of flops computed so "
   MSG_task_execute(task1);
   MSG_task_destroy(task1);
   XBT_INFO("Done working on my task; this took %.2fs; current peak speed: %.0E flop/s; number of flops computed so "
index ce49c90..9fd43cb 100644 (file)
@@ -379,7 +379,17 @@ XBT_PUBLIC(msg_error_t) MSG_process_join(msg_process_t process, double timeout);
 XBT_PUBLIC(msg_error_t) MSG_process_sleep(double nb_sec);
 
 XBT_PUBLIC(void) MSG_task_set_flops_amount(msg_task_t task, double flops_amount);
 XBT_PUBLIC(msg_error_t) MSG_process_sleep(double nb_sec);
 
 XBT_PUBLIC(void) MSG_task_set_flops_amount(msg_task_t task, double flops_amount);
+/* Unable to compile that without -Werror=deprecated-declarations
+XBT_ATTRIB_DEPRECATED_v321( "Use MSG_task_get_initial_flops_amount if you want to get initial amounts of flops, or "
+                            "Use MSG_task_get_remaining_work_ratio to get task progress (in order "
+                            "to compute progress in flops)") static inline double MSG_task_get_flops_amount(msg_task_t task)
+{
+  return MSG_task_get_flops_amount(task);
+}
+*/
+
 XBT_PUBLIC(double) MSG_task_get_flops_amount(msg_task_t task);
 XBT_PUBLIC(double) MSG_task_get_flops_amount(msg_task_t task);
+XBT_PUBLIC(double) MSG_task_get_initial_flops_amount(msg_task_t task);
 XBT_PUBLIC(double) MSG_task_get_remaining_work_ratio(msg_task_t task);
 XBT_PUBLIC(void) MSG_task_set_bytes_amount(msg_task_t task, double bytes_amount);
 
 XBT_PUBLIC(double) MSG_task_get_remaining_work_ratio(msg_task_t task);
 XBT_PUBLIC(void) MSG_task_set_bytes_amount(msg_task_t task, double bytes_amount);
 
index e5f3641..86ece99 100644 (file)
@@ -251,13 +251,23 @@ double MSG_task_get_remaining_work_ratio(msg_task_t task) {
   }
 }
 
   }
 }
 
+double MSG_task_get_flops_amount(msg_task_t task) {
+  if (task->simdata->compute) {
+    return task->simdata->compute->remains();
+  } else {
+    return task->simdata->flops_amount;
+  }
+}
+
 /** \ingroup m_task_management
  * \brief Returns the initial amount of flops needed to execute a task #msg_task_t.
  *
  * Once a task has been processed, this amount is set to 0. If you want, you can reset this value with
  * #MSG_task_set_flops_amount before restarting the task.
 /** \ingroup m_task_management
  * \brief Returns the initial amount of flops needed to execute a task #msg_task_t.
  *
  * Once a task has been processed, this amount is set to 0. If you want, you can reset this value with
  * #MSG_task_set_flops_amount before restarting the task.
+ *
+ * Warning: Only work for simple task, not parallel task.
  */
  */
-double MSG_task_get_flops_amount(msg_task_t task) {
+double MSG_task_get_initial_flops_amount(msg_task_t task) {
   return task->simdata->flops_amount;
 }
 
   return task->simdata->flops_amount;
 }
 
index 1a5a9ad..8826c7e 100644 (file)
@@ -336,7 +336,7 @@ static void start_dirty_page_tracking(msg_vm_t vm)
 
   for (auto const& elm : vm->pimpl_vm_->dp_objs) {
     dirty_page_t dp    = elm.second;
 
   for (auto const& elm : vm->pimpl_vm_->dp_objs) {
     dirty_page_t dp    = elm.second;
-    double remaining = MSG_task_get_flops_amount(dp->task);
+    double remaining = MSG_task_get_remaining_work_ratio(dp->task);
     dp->prev_clock = MSG_get_clock();
     dp->prev_remaining = remaining;
     XBT_DEBUG("%s@%s remaining %f", elm.first.c_str(), vm->getCname(), remaining);
     dp->prev_clock = MSG_get_clock();
     dp->prev_remaining = remaining;
     XBT_DEBUG("%s@%s remaining %f", elm.first.c_str(), vm->getCname(), remaining);
index 80e7031..7c3ad78 100644 (file)
@@ -80,6 +80,7 @@ static int get_progress(int /*argc*/, char* /*argv*/ [])
       progress_prev = progress;
     }
   }
       progress_prev = progress;
     }
   }
+  return 0;
 }
 
 int main(int argc, char *argv[])
 }
 
 int main(int argc, char *argv[])