From 3ca2d322fae492702b47c01fcb8a12c1bfab05d0 Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Fri, 27 Nov 2015 13:33:28 +0100 Subject: [PATCH] [surf] Remove some layers of indirections in sg_platf_new_host() --- src/surf/cpu_interface.cpp | 13 ------------- src/surf/cpu_interface.hpp | 2 -- src/surf/host_interface.cpp | 5 ----- src/surf/host_interface.hpp | 1 - src/surf/sg_platf.cpp | 20 +++++++++++++++----- 5 files changed, 15 insertions(+), 26 deletions(-) diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index ed245c8f88..0513ad6517 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -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(); } diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index 7de27b35bd..e28550a524 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -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(); /********* diff --git a/src/surf/host_interface.cpp b/src/surf/host_interface.cpp index 3c79032a42..7ed5f057bd 100644 --- a/src/surf/host_interface.cpp +++ b/src/surf/host_interface.cpp @@ -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(); } diff --git a/src/surf/host_interface.hpp b/src/surf/host_interface.hpp index 39e87803c5..204a58301f 100644 --- a/src/surf/host_interface.hpp +++ b/src/surf/host_interface.hpp @@ -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(); /********* diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 54229a8967..3a35fccc9e 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -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){ -- 2.20.1