Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
C++-ifies a wrapper function, and kill it
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 9 Jan 2016 23:35:51 +0000 (00:35 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 9 Jan 2016 23:40:25 +0000 (00:40 +0100)
This path will be long :(

src/include/surf/surf.h
src/simix/smx_host.cpp
src/surf/host_clm03.cpp
src/surf/surf_c_bindings.cpp
src/surf/vm_hl13.cpp
teshsuite/surf/surf_usage/surf_usage.cpp
teshsuite/surf/surf_usage/surf_usage2.cpp

index 279955a..04a4b1c 100644 (file)
@@ -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 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);
 
 /** @brief Create a sleep action on the given host */
 XBT_PUBLIC(surf_action_t) surf_host_sleep(sg_host_t host, double duration);
 
index 34d253e..4a5bf18 100644 (file)
@@ -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()) {
 
   /* 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);
 
     synchro->execution.surf_exec->setData(synchro);
     synchro->execution.surf_exec->setPriority(priority);
 
index 0f01846..1df2fb2 100644 (file)
@@ -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 *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,
   } else if ((host_nb == 1)
            && (cost_or_zero(flops_amount, 0) == 0.0)) {
     action = surf_network_model->communicate(host_list[0]->p_netcard,
index d1907c6..20b8c08 100644 (file)
@@ -255,10 +255,6 @@ double surf_host_get_available_speed(sg_host_t host){
   return host->p_cpu->getAvailableSpeed();
 }
 
   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();
 }
 double surf_host_get_current_power_peak(sg_host_t host){
   return host->p_cpu->getCurrentPowerPeak();
 }
index 4b93bba..3109c8e 100644 (file)
@@ -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))
 #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);
   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);
index 83c5c50..5713c53 100644 (file)
@@ -11,6 +11,7 @@
 #include "surf/surf.h"
 #include "surf/surfxml_parse.h" // for reset callback
 #include "src/surf/surf_interface.hpp"
 #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,
 
 #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 */
   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... */
   actionC = surf_host_sleep(hostB, 7.32);
 
   /* Use whatever calling style you want... */
index 9c95d45..ed16cdb 100644 (file)
@@ -11,6 +11,7 @@
 #include "surf/surf.h"
 #include "surf/surfxml_parse.h" // for reset callback
 #include "src/surf/surf_interface.hpp"
 #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,
 
 #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 */
   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);
   surf_host_sleep(hostB, 7.32);
 
   surf_network_model_communicate(surf_network_model, hostA, hostB, 150.0, -1.0);