From: Martin Quinson Date: Mon, 9 May 2016 15:25:43 +0000 (+0200) Subject: simix: change two more getter simcalls into methods X-Git-Tag: v3_14~1256 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/dfd4577a334ccffefde41992148e11edf2b34a25 simix: change two more getter simcalls into methods --- diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 0cfad7fddc..cf5f064043 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -283,8 +283,6 @@ XBT_PUBLIC(smx_synchro_t) simcall_execution_parallel_start(const char *name, double rate); XBT_PUBLIC(void) simcall_execution_destroy(smx_synchro_t execution); XBT_PUBLIC(void) simcall_execution_cancel(smx_synchro_t execution); -XBT_PUBLIC(double) simcall_execution_get_remains(smx_synchro_t execution); -XBT_PUBLIC(e_smx_state_t) simcall_execution_get_state(smx_synchro_t execution); XBT_PUBLIC(void) simcall_execution_set_priority(smx_synchro_t execution, double priority); XBT_PUBLIC(void) simcall_execution_set_bound(smx_synchro_t execution, double bound); XBT_PUBLIC(void) simcall_execution_set_affinity(smx_synchro_t execution, sg_host_t host, unsigned long mask); diff --git a/src/msg/msg_task.cpp b/src/msg/msg_task.cpp index 33a386ed0e..4910856980 100644 --- a/src/msg/msg_task.cpp +++ b/src/msg/msg_task.cpp @@ -252,7 +252,7 @@ msg_error_t MSG_task_cancel(msg_task_t task) */ double MSG_task_get_flops_amount(msg_task_t task) { if (task->simdata->compute) { - return simcall_execution_get_remains(task->simdata->compute); + return task->simdata->compute->remains(); } else { return task->simdata->flops_amount; } diff --git a/src/simix/SynchroExec.cpp b/src/simix/SynchroExec.cpp index db79ea0cad..6dfa770f56 100644 --- a/src/simix/SynchroExec.cpp +++ b/src/simix/SynchroExec.cpp @@ -17,3 +17,11 @@ void simgrid::simix::Exec::resume() if (surf_exec) surf_exec->resume(); } + +double simgrid::simix::Exec::remains() +{ + if (state == SIMIX_RUNNING) + return surf_exec->getRemains(); + + return 0; +} diff --git a/src/simix/SynchroExec.hpp b/src/simix/SynchroExec.hpp index c81b6b7b0f..d24af4fde5 100644 --- a/src/simix/SynchroExec.hpp +++ b/src/simix/SynchroExec.hpp @@ -16,6 +16,7 @@ namespace simix { public: void suspend(); void resume(); + double remains(); sg_host_t host; /* The host where the execution takes place */ surf_action_t surf_exec; /* The Surf execution action encapsulated */ diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index f15f002165..b1563f0042 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -149,30 +149,6 @@ void simcall_execution_cancel(smx_synchro_t execution) simcall_BODY_execution_cancel(execution); } -/** - * \ingroup simix_process_management - * \brief Returns how much of an execution synchro remains to be done. - * - * \param execution The execution synchro - * \return The remaining amount - */ -double simcall_execution_get_remains(smx_synchro_t execution) -{ - return simcall_BODY_execution_get_remains(execution); -} - -/** - * \ingroup simix_process_management - * \brief Returns the state of an execution synchro. - * - * \param execution The execution synchro - * \return The state - */ -e_smx_state_t simcall_execution_get_state(smx_synchro_t execution) -{ - return simcall_BODY_execution_get_state(execution); -} - /** * \ingroup simix_process_management * \brief Changes the priority of an execution synchro. diff --git a/src/simix/popping_accessors.h b/src/simix/popping_accessors.h index c694b14a63..f91ec832ad 100644 --- a/src/simix/popping_accessors.h +++ b/src/simix/popping_accessors.h @@ -303,32 +303,6 @@ static inline void simcall_execution_cancel__set__execution(smx_simcall_t simcal simcall->args[0].dp = arg; } -static inline smx_synchro_t simcall_execution_get_remains__get__execution(smx_simcall_t simcall) { - return (smx_synchro_t) simcall->args[0].dp; -} -static inline void simcall_execution_get_remains__set__execution(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} -static inline double simcall_execution_get_remains__get__result(smx_simcall_t simcall){ - return simcall->result.d; -} -static inline void simcall_execution_get_remains__set__result(smx_simcall_t simcall, double result){ - simcall->result.d = result; -} - -static inline smx_synchro_t simcall_execution_get_state__get__execution(smx_simcall_t simcall) { - return (smx_synchro_t) simcall->args[0].dp; -} -static inline void simcall_execution_get_state__set__execution(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} -static inline e_smx_state_t simcall_execution_get_state__get__result(smx_simcall_t simcall){ - return (e_smx_state_t) simcall->result.i; -} -static inline void simcall_execution_get_state__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} - static inline smx_synchro_t simcall_execution_set_priority__get__execution(smx_simcall_t simcall) { return (smx_synchro_t) simcall->args[0].dp; } diff --git a/src/simix/popping_bodies.cpp b/src/simix/popping_bodies.cpp index 4c1e438c3e..0b3bf0510b 100644 --- a/src/simix/popping_bodies.cpp +++ b/src/simix/popping_bodies.cpp @@ -437,48 +437,6 @@ inline static void simcall_BODY_execution_cancel(smx_synchro_t execution) { } -inline static double simcall_BODY_execution_get_remains(smx_synchro_t execution) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_execution_get_remains(execution); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_EXECUTION_GET_REMAINS; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) execution; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - return (double) self->simcall.result.d; - } - -inline static e_smx_state_t simcall_BODY_execution_get_state(smx_synchro_t execution) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_execution_get_state(execution); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_EXECUTION_GET_STATE; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) execution; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - return (e_smx_state_t) self->simcall.result.i; - } - inline static void simcall_BODY_execution_set_priority(smx_synchro_t execution, double priority) { smx_process_t self = SIMIX_process_self(); diff --git a/src/simix/popping_enum.h b/src/simix/popping_enum.h index fca277b8a1..3da7977eb5 100644 --- a/src/simix/popping_enum.h +++ b/src/simix/popping_enum.h @@ -37,8 +37,6 @@ typedef enum { SIMCALL_EXECUTION_PARALLEL_START, SIMCALL_EXECUTION_DESTROY, SIMCALL_EXECUTION_CANCEL, - SIMCALL_EXECUTION_GET_REMAINS, - SIMCALL_EXECUTION_GET_STATE, SIMCALL_EXECUTION_SET_PRIORITY, SIMCALL_EXECUTION_SET_BOUND, SIMCALL_EXECUTION_SET_AFFINITY, diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index 5e9e1e09c5..d73d79846d 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -42,8 +42,6 @@ const char* simcall_names[] = { "SIMCALL_EXECUTION_PARALLEL_START", "SIMCALL_EXECUTION_DESTROY", "SIMCALL_EXECUTION_CANCEL", - "SIMCALL_EXECUTION_GET_REMAINS", - "SIMCALL_EXECUTION_GET_STATE", "SIMCALL_EXECUTION_SET_PRIORITY", "SIMCALL_EXECUTION_SET_BOUND", "SIMCALL_EXECUTION_SET_AFFINITY", @@ -205,16 +203,6 @@ case SIMCALL_EXECUTION_CANCEL: SIMIX_simcall_answer(simcall); break; -case SIMCALL_EXECUTION_GET_REMAINS: - simcall->result.d = SIMIX_execution_get_remains((smx_synchro_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_EXECUTION_GET_STATE: - simcall->result.i = SIMIX_execution_get_state((smx_synchro_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - case SIMCALL_EXECUTION_SET_PRIORITY: SIMIX_execution_set_priority((smx_synchro_t) simcall->args[0].dp, simcall->args[1].d); SIMIX_simcall_answer(simcall); diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index 8e2315cbf7..b345e4f4e7 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -67,8 +67,6 @@ Func H execution_start (void*, smx_synchro_t) (name, const char*) (flops_amount, Func - execution_parallel_start (void*, smx_synchro_t) (name, const char*) (host_nb, int) (host_list, void*, sg_host_t*) (flops_amount, void*, double*) (bytes_amount, void*, double*) (amount, double) (rate, double) Proc - execution_destroy (void) (execution, void*, smx_synchro_t) Proc - execution_cancel (void) (execution, void*, smx_synchro_t) -Func - execution_get_remains (double) (execution, void*, smx_synchro_t) -Func - execution_get_state (int, e_smx_state_t) (execution, void*, smx_synchro_t) Proc - execution_set_priority (void) (execution, void*, smx_synchro_t) (priority, double) Proc - execution_set_bound (void) (execution, void*, smx_synchro_t) (bound, double) Proc - execution_set_affinity (void) (execution, void*, smx_synchro_t) (ws, void*, sg_host_t) (mask, unsigned long) diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index 2115a8090d..4b4b3255e6 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -353,22 +353,6 @@ void SIMIX_execution_cancel(smx_synchro_t synchro) exec->surf_exec->cancel(); } -double SIMIX_execution_get_remains(smx_synchro_t synchro) -{ - double result = 0.0; - simgrid::simix::Exec *exec = static_cast(synchro); - - if (synchro->state == SIMIX_RUNNING) - result = exec->surf_exec->getRemains(); - - return result; -} - -e_smx_state_t SIMIX_execution_get_state(smx_synchro_t synchro) -{ - return synchro->state; -} - void SIMIX_execution_set_priority(smx_synchro_t synchro, double priority) { simgrid::simix::Exec *exec = static_cast(synchro); diff --git a/src/simix/smx_host_private.h b/src/simix/smx_host_private.h index 8393d9a886..312e5bd76b 100644 --- a/src/simix/smx_host_private.h +++ b/src/simix/smx_host_private.h @@ -45,8 +45,6 @@ XBT_PRIVATE smx_synchro_t SIMIX_execution_parallel_start(const char *name, double amount, double rate); XBT_PRIVATE void SIMIX_execution_destroy(smx_synchro_t synchro); XBT_PRIVATE void SIMIX_execution_cancel(smx_synchro_t synchro); -XBT_PRIVATE double SIMIX_execution_get_remains(smx_synchro_t synchro); -XBT_PRIVATE e_smx_state_t SIMIX_execution_get_state(smx_synchro_t synchro); XBT_PRIVATE void SIMIX_execution_set_priority(smx_synchro_t synchro, double priority); XBT_PRIVATE void SIMIX_execution_set_bound(smx_synchro_t synchro, double bound); XBT_PRIVATE void SIMIX_execution_set_affinity(smx_synchro_t synchro, sg_host_t host, unsigned long mask);