From 559cb98f249c32641d64709f23c3103302ccf4e6 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 10 Jan 2016 00:35:51 +0100 Subject: [PATCH] C++-ifies a wrapper function, and kill it This path will be long :( --- src/include/surf/surf.h | 3 --- src/simix/smx_host.cpp | 2 +- src/surf/host_clm03.cpp | 2 +- src/surf/surf_c_bindings.cpp | 4 ---- src/surf/vm_hl13.cpp | 2 +- teshsuite/surf/surf_usage/surf_usage.cpp | 5 +++-- teshsuite/surf/surf_usage/surf_usage2.cpp | 5 +++-- 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 279955a981..04a4b1c699 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -304,9 +304,6 @@ XBT_PUBLIC(xbt_dict_t) sg_host_get_properties(sg_host_t host); /** @brief Get the available speed of cpu associated to a host */ XBT_PUBLIC(double) surf_host_get_available_speed(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); - /** @brief Create a sleep action on the given host */ XBT_PUBLIC(surf_action_t) surf_host_sleep(sg_host_t host, double duration); diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index 34d253e827..4a5bf18133 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -320,7 +320,7 @@ smx_synchro_t SIMIX_process_execute(smx_process_t issuer, const char *name, /* set surf's action */ if (!MC_is_active() && !MC_record_replay_is_active()) { - synchro->execution.surf_exec = surf_host_execute(issuer->host, flops_amount); + synchro->execution.surf_exec = issuer->host->p_cpu->execute(flops_amount); synchro->execution.surf_exec->setData(synchro); synchro->execution.surf_exec->setPriority(priority); diff --git a/src/surf/host_clm03.cpp b/src/surf/host_clm03.cpp index 0f018465b2..1df2fb2ac8 100644 --- a/src/surf/host_clm03.cpp +++ b/src/surf/host_clm03.cpp @@ -81,7 +81,7 @@ Action *HostCLM03Model::executeParallelTask(int host_nb, Action *action =NULL; if ((host_nb == 1) && (cost_or_zero(bytes_amount, 0) == 0.0)){ - action = surf_host_execute(host_list[0],flops_amount[0]); + action = host_list[0]->p_cpu->execute(flops_amount[0]); } else if ((host_nb == 1) && (cost_or_zero(flops_amount, 0) == 0.0)) { action = surf_network_model->communicate(host_list[0]->p_netcard, diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index d1907c694b..20b8c08c39 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -255,10 +255,6 @@ double surf_host_get_available_speed(sg_host_t host){ return host->p_cpu->getAvailableSpeed(); } -surf_action_t surf_host_execute(sg_host_t host, double size){ - return host->p_cpu->execute(size); -} - double surf_host_get_current_power_peak(sg_host_t host){ return host->p_cpu->getCurrentPowerPeak(); } diff --git a/src/surf/vm_hl13.cpp b/src/surf/vm_hl13.cpp index 4b93bba05f..3109c8e86d 100644 --- a/src/surf/vm_hl13.cpp +++ b/src/surf/vm_hl13.cpp @@ -135,7 +135,7 @@ Action *VMHL13Model::executeParallelTask(int host_nb, #define cost_or_zero(array,pos) ((array)?(array)[pos]:0.0) if ((host_nb == 1) && (cost_or_zero(bytes_amount, 0) == 0.0)) - return surf_host_execute(host_list[0], flops_amount[0]); + return host_list[0]->p_cpu->execute(flops_amount[0]); else if ((host_nb == 1) && (cost_or_zero(flops_amount, 0) == 0.0)) return surf_network_model_communicate(surf_network_model, host_list[0], host_list[0],bytes_amount[0], rate); diff --git a/teshsuite/surf/surf_usage/surf_usage.cpp b/teshsuite/surf/surf_usage/surf_usage.cpp index 83c5c5067f..5713c53035 100644 --- a/teshsuite/surf/surf_usage/surf_usage.cpp +++ b/teshsuite/surf/surf_usage/surf_usage.cpp @@ -11,6 +11,7 @@ #include "surf/surf.h" #include "surf/surfxml_parse.h" // for reset callback #include "src/surf/surf_interface.hpp" +#include "src/surf/cpu_interface.hpp" #include "xbt/log.h" XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, @@ -61,8 +62,8 @@ void test(char *platform) XBT_DEBUG("%s : %p", surf_cpu_name(hostB->p_cpu), hostB); /* Let's do something on it */ - actionA = surf_host_execute(hostA, 1000.0); - actionB = surf_host_execute(hostB, 1000.0); + actionA = hostA->p_cpu->execute(1000.0); + actionB = hostB->p_cpu->execute(1000.0); actionC = surf_host_sleep(hostB, 7.32); /* Use whatever calling style you want... */ diff --git a/teshsuite/surf/surf_usage/surf_usage2.cpp b/teshsuite/surf/surf_usage/surf_usage2.cpp index 9c95d455a5..ed16cdbf61 100644 --- a/teshsuite/surf/surf_usage/surf_usage2.cpp +++ b/teshsuite/surf/surf_usage/surf_usage2.cpp @@ -11,6 +11,7 @@ #include "surf/surf.h" #include "surf/surfxml_parse.h" // for reset callback #include "src/surf/surf_interface.hpp" +#include "src/surf/cpu_interface.hpp" #include "xbt/log.h" XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, @@ -57,8 +58,8 @@ void test(char *platform) XBT_DEBUG("%s : %p", sg_host_get_name(hostB), hostB); /* Let's do something on it */ - surf_host_execute(hostA, 1000.0); - surf_host_execute(hostB, 1000.0); + hostA->p_cpu->execute(1000.0); + hostB->p_cpu->execute(1000.0); surf_host_sleep(hostB, 7.32); surf_network_model_communicate(surf_network_model, hostA, hostB, 150.0, -1.0); -- 2.20.1