From: Martin Quinson Date: Thu, 5 Nov 2015 00:31:33 +0000 (+0100) Subject: inline another getter simcall: host_get_nb_pstates X-Git-Tag: v3_13~1596 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/ea8f841a468a3db03f1d74e8e92e2dfba3db6f3b inline another getter simcall: host_get_nb_pstates --- diff --git a/include/simgrid/host.h b/include/simgrid/host.h index f3fa3a661b..1b380654de 100644 --- a/include/simgrid/host.h +++ b/include/simgrid/host.h @@ -67,6 +67,7 @@ XBT_PUBLIC(double) sg_host_get_available_speed(sg_host_t host); XBT_PUBLIC(int) sg_host_get_core(sg_host_t host); XBT_PUBLIC(int) sg_host_get_state(sg_host_t host); +XBT_PUBLIC(int) sg_host_get_nb_pstates(sg_host_t host); XBT_PUBLIC(int) sg_host_get_pstate(sg_host_t host); XBT_PUBLIC(double) sg_host_get_consumed_energy(sg_host_t host); diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 00ff99a6bc..544f4c0b8c 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -307,7 +307,6 @@ XBT_PUBLIC(void) simcall_host_set_data(sg_host_t host, void *data); XBT_PUBLIC(double) simcall_host_get_current_power_peak(sg_host_t host); XBT_PUBLIC(double) simcall_host_get_power_peak_at(sg_host_t host, int pstate_index); -XBT_PUBLIC(int) simcall_host_get_nb_pstates(sg_host_t host); XBT_PUBLIC(void) simcall_host_set_pstate(sg_host_t host, int pstate_index); XBT_PUBLIC(double) simcall_host_get_wattmin_at(sg_host_t host, int pstate); XBT_PUBLIC(double) simcall_host_get_wattmax_at(sg_host_t host, int pstate); diff --git a/src/msg/msg_host.c b/src/msg/msg_host.c index 0cbac256a7..02d7f4060c 100644 --- a/src/msg/msg_host.c +++ b/src/msg/msg_host.c @@ -383,9 +383,7 @@ double MSG_host_get_current_power_peak(msg_host_t host) { * \param host host to test */ int MSG_host_get_nb_pstates(msg_host_t host) { - - xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); - return (simcall_host_get_nb_pstates(host)); + return sg_host_get_nb_pstates(host); } /** \ingroup m_host_management diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index 396f4a325d..74e03b0982 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -141,12 +141,26 @@ int sg_host_get_state(sg_host_t host) { return surf_host_get_state(surf_host_resource_priv(host)); } -/** @brief Returns the total energy consumed by the host (in Joules) */ +/** @brief Returns the total energy consumed by the host (in Joules). + * + * See also @ref SURF_plugin_energy. + */ double sg_host_get_consumed_energy(sg_host_t host) { return surf_host_get_consumed_energy(host); } -/** @brief Gets the pstate at which that host currently runs */ +/** @brief Returns the number of power states for a host. + * + * See also @ref SURF_plugin_energy. + */ +int sg_host_get_nb_pstates(sg_host_t host) { + return surf_host_get_nb_pstates(host); +} + +/** @brief Gets the pstate at which that host currently runs. + * + * See also @ref SURF_plugin_energy. + */ int sg_host_get_pstate(sg_host_t host) { return surf_host_get_pstate(host); } diff --git a/src/simix/libsmx.c b/src/simix/libsmx.c index 44efe35991..ab101d1db2 100644 --- a/src/simix/libsmx.c +++ b/src/simix/libsmx.c @@ -105,18 +105,6 @@ double simcall_host_get_power_peak_at(sg_host_t host, int pstate_index) return simcall_BODY_host_get_power_peak_at(host, pstate_index); } -/** - * \ingroup simix_host_management - * \brief Returns the number of power states for a host. - * - * \param host A SIMIX host - * \return the number of power states - */ -int simcall_host_get_nb_pstates(sg_host_t host) -{ - return simcall_BODY_host_get_nb_pstates(host); -} - /** * \ingroup simix_host_management * \brief Sets the pstate at which the host should run diff --git a/src/simix/popping_accessors.h b/src/simix/popping_accessors.h index ae6c431c68..fd3d6142f2 100644 --- a/src/simix/popping_accessors.h +++ b/src/simix/popping_accessors.h @@ -86,19 +86,6 @@ static inline void simcall_host_get_power_peak_at__set__result(smx_simcall_t sim simcall->result.d = result; } -static inline sg_host_t simcall_host_get_nb_pstates__get__host(smx_simcall_t simcall) { - return (sg_host_t) simcall->args[0].dp; -} -static inline void simcall_host_get_nb_pstates__set__host(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} -static inline int simcall_host_get_nb_pstates__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_host_get_nb_pstates__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} - static inline sg_host_t simcall_host_get_wattmin_at__get__host(smx_simcall_t simcall) { return (sg_host_t) simcall->args[0].dp; } diff --git a/src/simix/popping_bodies.c b/src/simix/popping_bodies.c index 779dbb0a76..ef7460eaf6 100644 --- a/src/simix/popping_bodies.c +++ b/src/simix/popping_bodies.c @@ -144,27 +144,6 @@ inline static double simcall_BODY_host_get_power_peak_at(sg_host_t host, int pst return self->simcall.result.d; } -inline static int simcall_BODY_host_get_nb_pstates(sg_host_t host) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_host_get_nb_pstates(host); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_HOST_GET_NB_PSTATES; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) host; - 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 self->simcall.result.i; - } - inline static double simcall_BODY_host_get_wattmin_at(sg_host_t host, int pstate_index) { smx_process_t self = SIMIX_process_self(); diff --git a/src/simix/popping_enum.h b/src/simix/popping_enum.h index 937605d866..cd27c75c1a 100644 --- a/src/simix/popping_enum.h +++ b/src/simix/popping_enum.h @@ -24,7 +24,6 @@ typedef enum { SIMCALL_HOST_GET_PROCESS_LIST, SIMCALL_HOST_GET_CURRENT_POWER_PEAK, SIMCALL_HOST_GET_POWER_PEAK_AT, - SIMCALL_HOST_GET_NB_PSTATES, SIMCALL_HOST_GET_WATTMIN_AT, SIMCALL_HOST_GET_WATTMAX_AT, SIMCALL_HOST_SET_PSTATE, diff --git a/src/simix/popping_generated.c b/src/simix/popping_generated.c index 0a8f7e6aaf..55d72ff32e 100644 --- a/src/simix/popping_generated.c +++ b/src/simix/popping_generated.c @@ -29,7 +29,6 @@ const char* simcall_names[] = { [SIMCALL_HOST_GET_PROCESS_LIST] = "SIMCALL_HOST_GET_PROCESS_LIST", [SIMCALL_HOST_GET_CURRENT_POWER_PEAK] = "SIMCALL_HOST_GET_CURRENT_POWER_PEAK", [SIMCALL_HOST_GET_POWER_PEAK_AT] = "SIMCALL_HOST_GET_POWER_PEAK_AT", - [SIMCALL_HOST_GET_NB_PSTATES] = "SIMCALL_HOST_GET_NB_PSTATES", [SIMCALL_HOST_GET_WATTMIN_AT] = "SIMCALL_HOST_GET_WATTMIN_AT", [SIMCALL_HOST_GET_WATTMAX_AT] = "SIMCALL_HOST_GET_WATTMAX_AT", [SIMCALL_HOST_SET_PSTATE] = "SIMCALL_HOST_SET_PSTATE", @@ -191,11 +190,6 @@ case SIMCALL_HOST_GET_POWER_PEAK_AT: SIMIX_simcall_answer(simcall); break; -case SIMCALL_HOST_GET_NB_PSTATES: - simcall->result.i = SIMIX_host_get_nb_pstates((sg_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - case SIMCALL_HOST_GET_WATTMIN_AT: simcall->result.d = SIMIX_host_get_wattmin_at((sg_host_t) simcall->args[0].dp, simcall->args[1].i); SIMIX_simcall_answer(simcall); diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index 8337d273f7..ffac959031 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -52,7 +52,6 @@ Func - host_get_properties (void*, xbt_dict_t) (host, void*, sg_host_t) Func - host_get_process_list (void*, xbt_swag_t) (host, void*, sg_host_t) Func - host_get_current_power_peak (double) (host, void*, sg_host_t) Func - host_get_power_peak_at (double) (host, void*, sg_host_t) (pstate_index, int) -Func - host_get_nb_pstates (int) (host, void*, sg_host_t) Func - host_get_wattmin_at (double) (host, void*, sg_host_t) (pstate_index, int) Func - host_get_wattmax_at (double) (host, void*, sg_host_t) (pstate_index, int) Proc - host_set_pstate (void) (host, void*, sg_host_t) (pstate_index, int) diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index 1fb5227446..276bc86001 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -182,11 +182,6 @@ double SIMIX_host_get_power_peak_at(sg_host_t host, int pstate_index) { return surf_host_get_power_peak_at(host, pstate_index); } -int SIMIX_host_get_nb_pstates(sg_host_t host) { - return surf_host_get_nb_pstates(host); -} - - void SIMIX_host_set_pstate(sg_host_t host, int pstate_index) { surf_host_set_pstate(host, pstate_index); } diff --git a/src/simix/smx_host_private.h b/src/simix/smx_host_private.h index 50c8a8e648..1d800234ec 100644 --- a/src/simix/smx_host_private.h +++ b/src/simix/smx_host_private.h @@ -41,7 +41,6 @@ XBT_PRIVATE xbt_dict_t SIMIX_host_get_properties(sg_host_t host); XBT_PRIVATE xbt_swag_t SIMIX_host_get_process_list(sg_host_t host); XBT_PRIVATE double SIMIX_host_get_current_power_peak(sg_host_t host); XBT_PRIVATE double SIMIX_host_get_power_peak_at(sg_host_t host, int pstate_index); -XBT_PRIVATE int SIMIX_host_get_nb_pstates(sg_host_t host); XBT_PRIVATE double SIMIX_host_get_wattmin_at(sg_host_t host,int pstate); XBT_PRIVATE double SIMIX_host_get_wattmax_at(sg_host_t host,int pstate); XBT_PRIVATE void SIMIX_host_set_pstate(sg_host_t host, int pstate_index); diff --git a/src/smpi/smpi_dvfs.c b/src/smpi/smpi_dvfs.c index 3c16f526c2..57da46421e 100644 --- a/src/smpi/smpi_dvfs.c +++ b/src/smpi/smpi_dvfs.c @@ -34,11 +34,11 @@ double smpi_get_host_current_power_peak(void) } /** - * \brief Return the number of pstates defined for host + * \brief Return the number of pstates defined for the current host */ int smpi_get_host_nb_pstates(void) { - return simcall_host_get_nb_pstates(SIMIX_host_self()); + return sg_host_get_nb_pstates(SIMIX_host_self()); } /**