From: Martin Quinson Date: Wed, 22 Nov 2017 00:25:45 +0000 (+0100) Subject: properly deprecate MSG_task_get_flops_amount() and stop using it ourselves X-Git-Tag: v3.18~267 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/fcb80ebab89345dbff0cc0dc6f7db793e880eaa6?ds=sidebyside properly deprecate MSG_task_get_flops_amount() and stop using it ourselves --- diff --git a/examples/msg/energy-consumption/energy-consumption.c b/examples/msg/energy-consumption/energy-consumption.c index cf5c6384e6..19b93a6ca2 100644 --- a/examples/msg/energy-consumption/energy-consumption.c +++ b/examples/msg/energy-consumption/energy-consumption.c @@ -26,7 +26,7 @@ static int dvfs(int argc, char *argv[]) // 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); XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Current consumption: from %.0fW to %.0fW" @@ -43,7 +43,7 @@ static int dvfs(int argc, char *argv[]) // 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("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", diff --git a/examples/msg/trace-masterworker/trace-masterworker.c b/examples/msg/trace-masterworker/trace-masterworker.c index 2ebf78d686..56cb7a3051 100644 --- a/examples/msg/trace-masterworker/trace-masterworker.c +++ b/examples/msg/trace-masterworker/trace-masterworker.c @@ -53,9 +53,9 @@ static int worker(int argc, char *argv[]) MSG_task_destroy(task); break; } - //adding the value returned by MSG_task_get_compute_duration(task) - //to the variable "task_computation" - TRACE_host_variable_add(MSG_host_get_name(MSG_host_self()), "task_computation", MSG_task_get_flops_amount(task)); + // adding the value returned by MSG_task_get_compute_duration(task) to the variable "task_computation" + TRACE_host_variable_add(MSG_host_get_name(MSG_host_self()), "task_computation", + MSG_task_get_initial_flops_amount(task)); MSG_task_execute(task); MSG_task_destroy(task); task = NULL; diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index 9fd43cb381..b3284ad436 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -379,16 +379,10 @@ 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); -/* 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_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)") 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); diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index 4e485ba3b1..15c3c47005 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -367,7 +367,7 @@ static double lookup_computed_flop_counts(msg_vm_t vm, int stage_for_fancy_debug for (auto const& elm : vm->pimpl_vm_->dp_objs) { const std::string& key = elm.first; 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); double clock = MSG_get_clock(); @@ -396,7 +396,7 @@ void MSG_host_add_task(msg_host_t host, msg_task_t task) if (vm == nullptr) return; - double remaining = MSG_task_get_flops_amount(task); + double remaining = MSG_task_get_remaining_work_ratio(task); std::string key = simgrid::xbt::string_printf("%s-%p", task->name, task); dirty_page_t dp = new s_dirty_page; @@ -426,7 +426,7 @@ void MSG_host_del_task(msg_host_t host, msg_task_t task) /* If we are in the middle of dirty page tracking, we record how much computation has been done until now, and keep * the information for the lookup_() function that will called soon. */ if (vm->pimpl_vm_->dp_enabled) { - double remaining = MSG_task_get_flops_amount(task); + double remaining = MSG_task_get_remaining_work_ratio(task); double clock = MSG_get_clock(); double updated = get_computed(key, vm, dp, remaining, clock); // was host instead of vm diff --git a/teshsuite/msg/task_destroy_cancel/task_destroy_cancel.cpp b/teshsuite/msg/task_destroy_cancel/task_destroy_cancel.cpp index 5c22018489..0326f56963 100644 --- a/teshsuite/msg/task_destroy_cancel/task_destroy_cancel.cpp +++ b/teshsuite/msg/task_destroy_cancel/task_destroy_cancel.cpp @@ -98,7 +98,7 @@ static int worker(int /*argc*/, char* /*argv*/ []) MSG_task_execute(task); double end = MSG_get_clock(); XBT_INFO("Task \"%s\" done in %f (amount %f)", MSG_task_get_name(task), end - start, - MSG_task_get_flops_amount(task)); + MSG_task_get_remaining_work_ratio(task)); MSG_task_destroy(task); }