From 2b3f46a61a583459ab18cc10de139010173de685 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 20 Mar 2016 00:15:33 +0100 Subject: [PATCH] objectifies a C function --- src/surf/cpu_interface.cpp | 21 ++++++++++----------- src/surf/cpu_interface.hpp | 13 +++---------- src/surf/network_interface.hpp | 3 +-- src/surf/plugins/energy.cpp | 3 +-- 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 6bb195a11b..94ba64d1d0 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -24,17 +24,6 @@ namespace surf { * Callbacks * *************/ -std::list getActionCpus(CpuAction *action) { - std::list retlist; - lmm_system_t sys = action->getModel()->getMaxminSystem(); - int llen = lmm_get_number_of_cnst_from_var(sys, action->getVariable()); - - for(int i = 0; igetVariable(), i) )) ); - } - return retlist; -} - simgrid::xbt::signal cpuActionStateChangedCallbacks; /********* @@ -348,6 +337,16 @@ void CpuAction::setState(e_surf_action_state_t state){ Action::setState(state); onStateChange(this, previous); } +std::list CpuAction::cpus() { + std::list retlist; + lmm_system_t sys = getModel()->getMaxminSystem(); + int llen = lmm_get_number_of_cnst_from_var(sys, getVariable()); + + for(int i = 0; i) getActionCpus(CpuAction *action); - -/********* - * Model * - *********/ +class CpuPlugin;// FIXME:DEADCODE /** @ingroup SURF_cpu_interface * @brief SURF cpu model interface class @@ -172,6 +163,8 @@ public: void setState(e_surf_action_state_t state); void updateRemainingLazy(double now); + std::list cpus(); + }; } diff --git a/src/surf/network_interface.hpp b/src/surf/network_interface.hpp index 4d40e4dee1..0369963ced 100644 --- a/src/surf/network_interface.hpp +++ b/src/surf/network_interface.hpp @@ -100,8 +100,7 @@ namespace simgrid { * unlimited. * @return The action representing the communication */ - virtual Action *communicate(NetCard *src, NetCard *dst, - double size, double rate)=0; + virtual Action *communicate(NetCard *src, NetCard *dst, double size, double rate)=0; /** @brief Function pointer to the function to use to solve the lmm_system_t * diff --git a/src/surf/plugins/energy.cpp b/src/surf/plugins/energy.cpp index c0aa3570ce..fdd672dee1 100644 --- a/src/surf/plugins/energy.cpp +++ b/src/surf/plugins/energy.cpp @@ -206,8 +206,7 @@ static void onCreation(simgrid::s4u::Host& host) { } static void onActionStateChange(simgrid::surf::CpuAction *action, e_surf_action_state_t previous) { - std::list cpus = getActionCpus(action); - for(simgrid::surf::Cpu* cpu : cpus) { + for(simgrid::surf::Cpu* cpu : action->cpus()) { const char *name = cpu->getName(); sg_host_t sghost = sg_host_by_name(name); if(sghost == NULL) -- 2.20.1