From: Frederic Suter Date: Thu, 28 Jul 2016 08:34:38 +0000 (+0200) Subject: morning routine of chasings sonar bugs X-Git-Tag: v3_14~699^2~3^2~1 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5238b3149ae199c508cd5c9a13f7a49966161d81?hp=-c morning routine of chasings sonar bugs --- 5238b3149ae199c508cd5c9a13f7a49966161d81 diff --git a/src/msg/msg_task.cpp b/src/msg/msg_task.cpp index a19d803800..dee434524c 100644 --- a/src/msg/msg_task.cpp +++ b/src/msg/msg_task.cpp @@ -161,7 +161,7 @@ void MSG_task_set_copy_callback(void (*callback) (msg_task_t task, msg_process_t msg_process_t MSG_task_get_sender(msg_task_t task) { xbt_assert(task, "Invalid parameters"); - return ((simdata_task_t) task->simdata)->sender; + return (static_cast (task->simdata)->sender); } /** \ingroup m_task_management @@ -172,7 +172,7 @@ msg_process_t MSG_task_get_sender(msg_task_t task) msg_host_t MSG_task_get_source(msg_task_t task) { xbt_assert(task, "Invalid parameters"); - return ((simdata_task_t) task->simdata)->source; + return (static_cast (task->simdata)->source); } /** \ingroup m_task_management @@ -326,7 +326,7 @@ void MSG_task_set_bound(msg_task_t task, double bound) xbt_assert(task, "Invalid parameter"); xbt_assert(task->simdata, "Invalid parameter"); - if (bound == 0) + if (bound < 1e-12) /* close enough to 0 without any floating precision surprise */ XBT_INFO("bound == 0 means no capping (i.e., unlimited)."); task->simdata->bound = bound; @@ -390,24 +390,19 @@ void MSG_task_set_affinity(msg_task_t task, msg_host_t host, unsigned long mask) return; } - { - simgrid::simix::Exec *compute = task->simdata->compute; - msg_host_t host_now = compute->host; // simix_private.h is necessary - if (host_now != host) { - /* task is not yet executed on this host */ - XBT_INFO("set affinity(0x%04lx@%s) for %s (not active now)", mask, MSG_host_get_name(host), - MSG_task_get_name(task)); - return; - } - - /* task is being executed on this host. so change the affinity now */ - { - /* check it works. remove me if it works. */ - xbt_assert((unsigned long)(uintptr_t) xbt_dict_get_or_null_ext(task->simdata->affinity_mask_db, - (char *) host, sizeof(msg_host_t)) == mask); - } - - XBT_INFO("set affinity(0x%04lx@%s) for %s", mask, MSG_host_get_name(host), MSG_task_get_name(task)); - simcall_execution_set_affinity(task->simdata->compute, host, mask); + simgrid::simix::Exec *compute = task->simdata->compute; + msg_host_t host_now = compute->host; // simix_private.h is necessary + if (host_now != host) { + /* task is not yet executed on this host */ + XBT_INFO("set affinity(0x%04lx@%s) for %s (not active now)", mask, MSG_host_get_name(host), + MSG_task_get_name(task)); + return; } + + /* task is being executed on this host. so change the affinity now */ + /* check it works. remove me if it works. */ + xbt_assert(static_cast((uintptr_t) xbt_dict_get_or_null_ext(task->simdata->affinity_mask_db, + (char*)(host), sizeof(msg_host_t))) == mask); + XBT_INFO("set affinity(0x%04lx@%s) for %s", mask, MSG_host_get_name(host), MSG_task_get_name(task)); + simcall_execution_set_affinity(task->simdata->compute, host, mask); } diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index c341322158..058904139c 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -669,7 +669,7 @@ static int migration_tx_fun(int argc, char *argv[]) if (ramsize == 0) XBT_WARN("migrate a VM, but ramsize is zero"); - if (max_downtime == 0) { + if (max_downtime <= 0) { XBT_WARN("use the default max_downtime value 30ms"); max_downtime = 0.03; } diff --git a/teshsuite/surf/surf_usage2/surf_usage2.cpp b/teshsuite/surf/surf_usage2/surf_usage2.cpp index 5683d9e186..da719bf576 100644 --- a/teshsuite/surf/surf_usage2/surf_usage2.cpp +++ b/teshsuite/surf/surf_usage2/surf_usage2.cpp @@ -60,15 +60,21 @@ int main(int argc, char **argv) XBT_DEBUG("\t Running that model"); running = 1; } - while ((action = surf_model_extract_failed_action_set((surf_model_t)model))) { + + action = surf_model_extract_failed_action_set(static_cast(model)); + while (action != nullptr) { XBT_INFO(" * Done Action"); XBT_DEBUG("\t * Failed Action: %p", action); action->unref(); + action = surf_model_extract_failed_action_set(static_cast(model)); } - while ((action = surf_model_extract_done_action_set((surf_model_t)model))) { + + action = surf_model_extract_done_action_set(static_cast(model)); + while (action != nullptr){ XBT_INFO(" * Done Action"); XBT_DEBUG("\t * Done Action: %p", action); action->unref(); + action = surf_model_extract_done_action_set(static_cast(model)); } } } while (running && surf_solve(-1.0) >= 0.0);