Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[surf] Remove some layers of indirections in sg_platf_new_host()
authorGabriel Corona <gabriel.corona@loria.fr>
Fri, 27 Nov 2015 12:33:28 +0000 (13:33 +0100)
committerGabriel Corona <gabriel.corona@loria.fr>
Fri, 27 Nov 2015 12:33:28 +0000 (13:33 +0100)
src/surf/cpu_interface.cpp
src/surf/cpu_interface.hpp
src/surf/host_interface.cpp
src/surf/host_interface.hpp
src/surf/sg_platf.cpp

index ed245c8..0513ad6 100644 (file)
@@ -31,19 +31,6 @@ surf_callback(void, Cpu*) cpuDestructedCallbacks;
 surf_callback(void, Cpu*, e_surf_resource_state_t, e_surf_resource_state_t) cpuStateChangedCallbacks;
 surf_callback(void, CpuAction*, e_surf_action_state_t, e_surf_action_state_t) cpuActionStateChangedCallbacks;
 
-void cpu_parse_init(sg_platf_host_cbarg_t host){
-  surf_cpu_model_pm->createCpu(
-        host->id,
-        host->power_peak,
-        host->pstate,
-        host->power_scale,
-        host->power_trace,
-        host->core_amount,
-        host->initial_state,
-        host->state_trace,
-        host->properties);
-}
-
 void cpu_add_traces(){
   surf_cpu_model_pm->addTraces();
 }
index 7de27b3..e28550a 100644 (file)
@@ -47,8 +47,6 @@ XBT_PUBLIC_DATA( surf_callback(void, Cpu*, e_surf_resource_state_t, e_surf_resou
  */
 XBT_PUBLIC_DATA( surf_callback(void, CpuAction*, e_surf_action_state_t, e_surf_action_state_t)) cpuActionStateChangedCallbacks;
 
-XBT_PUBLIC(void) cpu_parse_init(sg_platf_host_cbarg_t host);
-
 XBT_PUBLIC(void) cpu_add_traces();
 
 /*********
index 3c79032..7ed5f05 100644 (file)
@@ -27,11 +27,6 @@ surf_callback(void, Host*) hostDestructedCallbacks;
 surf_callback(void, Host*, e_surf_resource_state_t, e_surf_resource_state_t) hostStateChangedCallbacks;
 surf_callback(void, HostAction*, e_surf_action_state_t, e_surf_action_state_t) hostActionStateChangedCallbacks;
 
-void host_parse_init(sg_platf_host_cbarg_t host)
-{
-  surf_host_model->createHost(host->id);
-}
-
 void host_add_traces(){
   surf_host_model->addTraces();
 }
index 39e8780..204a583 100644 (file)
@@ -50,7 +50,6 @@ XBT_PUBLIC_DATA(surf_callback(void, HostAction*, e_surf_action_state_t, e_surf_a
  * Tools *
  *********/
 XBT_PUBLIC_DATA(HostModel*) surf_host_model;
-XBT_PUBLIC(void) host_parse_init(sg_platf_host_cbarg_t host);
 XBT_PUBLIC(void) host_add_traces();
 
 /*********
index 54229a8..3a35fcc 100644 (file)
@@ -135,15 +135,25 @@ void sg_platf_exit(void) {
   surf_parse_models_setup_already_called = 0;
 }
 
-void sg_platf_new_host(sg_platf_host_cbarg_t h){
-  routing_parse_init(h);
-  cpu_parse_init(h);
-  host_parse_init(h);
+void sg_platf_new_host(sg_platf_host_cbarg_t host)
+{
+  routing_parse_init(host);
+  surf_cpu_model_pm->createCpu(
+        host->id,
+        host->power_peak,
+        host->pstate,
+        host->power_scale,
+        host->power_trace,
+        host->core_amount,
+        host->initial_state,
+        host->state_trace,
+        host->properties);
+  surf_host_model->createHost(host->id);
 
   unsigned int iterator;
   sg_platf_host_cb_t fun;
   xbt_dynar_foreach(sg_platf_host_cb_list, iterator, fun) {
-    fun(h);
+    fun(host);
   }
 }
 void sg_platf_new_host_link(sg_platf_host_link_cbarg_t h){