From a593a2f7928b9494fd814062b6cbd33d19b89197 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 4 Jan 2016 23:58:53 +0100 Subject: [PATCH 1/1] inline two C calls in surf --- src/include/surf/surf.h | 6 ------ src/simdag/sd_workstation.c | 5 +++-- src/simgrid/host.cpp | 5 +++-- src/surf/surf_c_bindings.cpp | 8 -------- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index ab9ef84365..cf58fce33a 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -316,15 +316,9 @@ static inline void surf_host_set_state(surf_host_t host, e_surf_resource_state_t surf_resource_set_state((surf_cpp_resource_t)host, state); } -/** @brief Get the speed of the cpu associated to a host */ -XBT_PUBLIC(double) surf_host_get_speed(sg_host_t resource, double load); - /** @brief Get the available speed of cpu associated to a host */ XBT_PUBLIC(double) surf_host_get_available_speed(sg_host_t host); -/** @brief Get the number of cores of the cpu associated to a host */ -XBT_PUBLIC(int) surf_host_get_core(sg_host_t host); - /** @brief Create a computation action on the given host */ XBT_PUBLIC(surf_action_t) surf_host_execute(sg_host_t host, double size); diff --git a/src/simdag/sd_workstation.c b/src/simdag/sd_workstation.c index e61ebdaac8..13b33b9d09 100644 --- a/src/simdag/sd_workstation.c +++ b/src/simdag/sd_workstation.c @@ -6,6 +6,7 @@ #include "src/simdag/simdag_private.h" #include "simgrid/simdag.h" +#include "simgrid/host.h" #include "xbt/dict.h" #include "xbt/lib.h" #include "xbt/sysdep.h" @@ -260,7 +261,7 @@ int SD_route_get_size(SD_workstation_t src, SD_workstation_t dst) */ double SD_workstation_get_power(SD_workstation_t workstation) { - return surf_host_get_speed(workstation, 1.0); + return sg_host_get_speed(workstation); } /** * \brief Returns the amount of cores of a workstation @@ -269,7 +270,7 @@ double SD_workstation_get_power(SD_workstation_t workstation) * \return the amount of cores of this workstation */ int SD_workstation_get_cores(SD_workstation_t workstation) { - return surf_host_get_core(workstation); + return sg_host_get_core(workstation); } /** diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index cb72bc8c84..5c881b0d14 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -126,8 +126,9 @@ void sg_host_simix_destroy(sg_host_t host) { // =========== user-level functions =============== // ================================================ +/** @brief Get the speed of the cpu associated to a host */ double sg_host_get_speed(sg_host_t host){ - return surf_host_get_speed(host, 1.0); + return host->p_cpu->getSpeed(1.0); } double sg_host_get_available_speed(sg_host_t host){ @@ -135,7 +136,7 @@ double sg_host_get_available_speed(sg_host_t host){ } /** @brief Returns the number of core of the processor. */ int sg_host_get_core(sg_host_t host) { - return surf_host_get_core(host); + return host->p_cpu->getCore(); } /** @brief Returns the state of a host. * @return 1 if the host is active or 0 if it has crashed. diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index e9190b2a52..fc630e293f 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -259,18 +259,10 @@ xbt_dict_t sg_host_get_properties(sg_host_t host) { return get_casted_host(host)->getProperties(); } -double surf_host_get_speed(sg_host_t host, double load){ - return host->p_cpu->getSpeed(load); -} - double surf_host_get_available_speed(sg_host_t host){ return host->p_cpu->getAvailableSpeed(); } -int surf_host_get_core(sg_host_t host){ - return host->p_cpu->getCore(); -} - surf_action_t surf_host_execute(sg_host_t host, double size){ return host->p_cpu->execute(size); } -- 2.20.1