Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorStéphane Castelli <stephane.castelli@loria.fr>
Wed, 16 Apr 2014 15:47:12 +0000 (17:47 +0200)
committerStéphane Castelli <stephane.castelli@loria.fr>
Wed, 16 Apr 2014 15:47:12 +0000 (17:47 +0200)
src/surf/workstation_ptask_L07.cpp
src/surf/workstation_ptask_L07.hpp

index d34b521..a2b4ac6 100644 (file)
@@ -359,7 +359,7 @@ void WorkstationL07Model::addTraces()
     xbt_assert(host, "Host %s undefined", elm);
     xbt_assert(trace, "Trace %s undefined", trace_name);
 
-    host->p_power.event = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast<ResourcePtr>(host));
+    host->p_powerEvent = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast<ResourcePtr>(host));
   }
 
   /* Connect traces relative to network */
@@ -427,21 +427,19 @@ double WorkstationL07::getConsumedEnergy()
 }
 
 CpuL07::CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t props,
-                  double power_scale,
-                      double power_initial, tmgr_trace_t power_trace,
+                  double power_initial,
+                      double power_scale, tmgr_trace_t power_trace,
                       e_surf_resource_state_t state_initial, tmgr_trace_t state_trace)
  : Cpu(model, name, props, lmm_constraint_new(ptask_maxmin_system, this, power_initial * power_scale),
-          1, 0, 0)
+          1, power_initial, power_scale)
 {
-  p_power.scale = power_scale;
-  xbt_assert(p_power.scale > 0, "Power has to be >0");
+  xbt_assert(m_powerScale > 0, "Power has to be >0");
 
-  m_powerCurrent = power_initial;
   if (power_trace)
-    p_power.event = tmgr_history_add_trace(history, power_trace, 0.0, 0,
+    p_powerEvent = tmgr_history_add_trace(history, power_trace, 0.0, 0,
                                            static_cast<ResourcePtr>(this));
   else
-    p_power.event = NULL;
+    p_powerEvent = NULL;
 
   setState(state_initial);
   if (state_trace)
@@ -482,11 +480,11 @@ bool LinkL07::isUsed(){
 
 void CpuL07::updateState(tmgr_trace_event_t event_type, double value, double /*date*/){
   XBT_DEBUG("Updating cpu %s (%p) with value %g", getName(), this, value);
-  if (event_type == p_power.event) {
-       m_powerCurrent = value;
-    lmm_update_constraint_bound(ptask_maxmin_system, getConstraint(), m_powerCurrent * p_power.scale);
+  if (event_type == p_powerEvent) {
+         m_powerScale = value;
+    lmm_update_constraint_bound(ptask_maxmin_system, getConstraint(), m_powerPeak * m_powerScale);
     if (tmgr_trace_event_free(event_type))
-      p_power.event = NULL;
+      p_powerEvent = NULL;
   } else if (event_type == p_stateEvent) {
     if (value > 0)
       setState(SURF_RESOURCE_ON);
@@ -530,16 +528,6 @@ e_surf_resource_state_t WorkstationL07::getState()
   return p_cpu->getState();
 }
 
-double CpuL07::getSpeed(double load)
-{
-  return load * p_power.scale;
-}
-
-double CpuL07::getAvailableSpeed()
-{
-  return m_powerCurrent;
-}
-
 ActionPtr WorkstationL07::execute(double size)
 {
   void **workstation_list = xbt_new0(void *, 1);
index f6b00b1..aea13ee 100644 (file)
@@ -126,10 +126,9 @@ public:
 };
 
 class CpuL07 : public Cpu {
-public:
-  s_surf_metric_t p_power;
+  friend void WorkstationL07Model::addTraces();
   tmgr_trace_event_t p_stateEvent;
-
+  tmgr_trace_event_t p_powerEvent;
 public:
   CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t properties,
                 double power_scale,
@@ -138,8 +137,6 @@ public:
   bool isUsed();
   //bool isUsed() {DIE_IMPOSSIBLE;};
   void updateState(tmgr_trace_event_t event_type, double value, double date);
-  double getSpeed(double load);
-  double getAvailableSpeed();
   CpuActionPtr execute(double /*size*/) {DIE_IMPOSSIBLE;};
   CpuActionPtr sleep(double /*duration*/) {DIE_IMPOSSIBLE;};
 
@@ -148,8 +145,6 @@ public:
   int getNbPstates() {THROW_UNIMPLEMENTED;};
   void setPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
   double getConsumedEnergy() {THROW_UNIMPLEMENTED;};
-
-  double m_powerCurrent;
 };
 
 class LinkL07 : public NetworkLink {