Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
objectifies a C function
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 19 Mar 2016 23:15:33 +0000 (00:15 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 20 Mar 2016 00:01:28 +0000 (01:01 +0100)
src/surf/cpu_interface.cpp
src/surf/cpu_interface.hpp
src/surf/network_interface.hpp
src/surf/plugins/energy.cpp

index 6bb195a..94ba64d 100644 (file)
@@ -24,17 +24,6 @@ namespace surf {
  * Callbacks *
  *************/
 
-std::list<Cpu*> getActionCpus(CpuAction *action) {
-  std::list<Cpu*> retlist;
-  lmm_system_t sys = action->getModel()->getMaxminSystem();
-  int llen = lmm_get_number_of_cnst_from_var(sys, action->getVariable());
-
-  for(int i = 0; i<llen; i++) {
-    retlist.push_back( (Cpu*)(lmm_constraint_id( lmm_get_cnst_from_var(sys, action->getVariable(), i) )) );
-  }
-  return retlist;
-}
-
 simgrid::xbt::signal<void(CpuAction*, e_surf_action_state_t, e_surf_action_state_t)> cpuActionStateChangedCallbacks;
 
 /*********
@@ -348,6 +337,16 @@ void CpuAction::setState(e_surf_action_state_t state){
   Action::setState(state);
   onStateChange(this, previous);
 }
+std::list<Cpu*> CpuAction::cpus() {
+  std::list<Cpu*> retlist;
+  lmm_system_t sys = getModel()->getMaxminSystem();
+  int llen = lmm_get_number_of_cnst_from_var(sys, getVariable());
+
+  for(int i = 0; i<llen; i++)
+    retlist.push_back( (Cpu*)(lmm_constraint_id( lmm_get_cnst_from_var(sys, getVariable(), i) )) );
+
+  return retlist;
+}
 
 }
 }
index 5e9e7a0..380e6b7 100644 (file)
@@ -20,16 +20,7 @@ namespace surf {
 class CpuModel;
 class Cpu;
 class CpuAction;
-class CpuPlugin;
-
-/*************
- * Callbacks *
- *************/
-XBT_PUBLIC(std::list<Cpu*>) 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<Cpu*> cpus();
+
 };
 
 }
index 4d40e4d..0369963 100644 (file)
@@ -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
        *
index c0aa357..fdd672d 100644 (file)
@@ -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<simgrid::surf::Cpu*> 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)