Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
not all resources need a property set, only Host, Link and Storage
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 17 Dec 2015 22:04:03 +0000 (23:04 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 17 Dec 2015 22:04:06 +0000 (23:04 +0100)
So dupplicate the property-related code in these classes, and remove
it from Resource. We may want to refactorize this code in a specific
class, but I'm not confident with multiple inheritance yet.

The reason of fixing that working feature is the bloat fight. A CPU or
RoutingEdge don't need no properties. The Resource class contains too
much things and should be split of.

35 files changed:
examples/java/surfCpuModel/CpuConstantModel.java
src/bindings/java/org/simgrid/surf/Cpu.java
src/bindings/java/org/simgrid/surf/CpuModel.java
src/bindings/java/org/simgrid/surf/Link.java
src/bindings/java/org/simgrid/surf/Resource.java
src/bindings/java/org/simgrid/surf/SurfJNI.java
src/bindings/java/org/simgrid/surf/surfJAVA_wrap.cxx
src/bindings/java/org/simgrid/surf/surfJAVA_wrap.h
src/bindings/java/surf.i
src/include/surf/surf.h
src/simdag/sd_workstation.c
src/simix/smx_host.cpp
src/simix/smx_io.cpp
src/surf/cpu_cas01.cpp
src/surf/cpu_cas01.hpp
src/surf/cpu_interface.cpp
src/surf/cpu_interface.hpp
src/surf/cpu_ti.cpp
src/surf/cpu_ti.hpp
src/surf/host_clm03.cpp
src/surf/host_clm03.hpp
src/surf/host_interface.cpp
src/surf/host_interface.hpp
src/surf/host_ptask_L07.cpp
src/surf/host_ptask_L07.hpp
src/surf/network_interface.cpp
src/surf/network_interface.hpp
src/surf/sg_platf.cpp
src/surf/storage_interface.cpp
src/surf/storage_interface.hpp
src/surf/surf_c_bindings.cpp
src/surf/surf_interface.cpp
src/surf/surf_interface.hpp
src/surf/virtual_machine.hpp
src/surf/vm_hl13.cpp

index 60d35dd..7118ff4 100644 (file)
@@ -13,10 +13,10 @@ public class CpuConstantModel extends CpuModel {
     Msg.info("Initialize Cpu Constant Model");
   }
 
-  public Cpu createCpu(String name, double[] power_peak, int pstate, double power_scale, TmgrTrace power_trace, int core, ResourceState state_initial, TmgrTrace state_trace, XbtDict cpu_properties) {
+  public Cpu createCpu(String name, double[] power_peak, int pstate, double power_scale, TmgrTrace power_trace, int core, ResourceState state_initial, TmgrTrace state_trace) {
     Msg.info("New Cpu("+name+", "+power_peak[pstate]+", "+power_scale+")");
 
-    CpuConstant res = new CpuConstant(this, name, cpu_properties, core, power_peak[pstate], power_scale);
+    CpuConstant res = new CpuConstant(this, name, core, power_peak[pstate], power_scale);
     cpus.add(res);
     return res;
   }
@@ -54,9 +54,9 @@ public class CpuConstantModel extends CpuModel {
 public class CpuConstant extends Cpu {
   private List<CpuConstantAction> actions = new ArrayList<CpuConstantAction>();
 
-  public CpuConstant(CpuConstantModel model, String name, XbtDict props,
+  public CpuConstant(CpuConstantModel model, String name, 
                      int core, double powerPeak, double powerScale) {
-    super(model, name, props, core, powerPeak, powerScale);
+    super(model, name, core, powerPeak, powerScale);
   }
 
   public void remove(CpuConstantAction action){
index d3745d3..179c60f 100644 (file)
@@ -50,13 +50,13 @@ public class Cpu extends Resource {
     SurfJNI.Cpu_change_ownership(this, swigCPtr, true);
   }
 
-  public Cpu(Model model, String name, XbtDict props, LmmConstraint constraint, int core, double powerPeak, double powerScale) {
-    this(SurfJNI.new_Cpu__SWIG_0(Model.getCPtr(model), model, name, XbtDict.getCPtr(props), props, LmmConstraint.getCPtr(constraint), constraint, core, powerPeak, powerScale), true);
+  public Cpu(Model model, String name, LmmConstraint constraint, int core, double powerPeak, double powerScale) {
+    this(SurfJNI.new_Cpu__SWIG_0(Model.getCPtr(model), model, name, LmmConstraint.getCPtr(constraint), constraint, core, powerPeak, powerScale), true);
     SurfJNI.Cpu_director_connect(this, swigCPtr, swigCMemOwn, true);
   }
 
-  public Cpu(Model model, String name, XbtDict props, int core, double powerPeak, double powerScale) {
-    this(SurfJNI.new_Cpu__SWIG_1(Model.getCPtr(model), model, name, XbtDict.getCPtr(props), props, core, powerPeak, powerScale), true);
+  public Cpu(Model model, String name, int core, double powerPeak, double powerScale) {
+    this(SurfJNI.new_Cpu__SWIG_1(Model.getCPtr(model), model, name, core, powerPeak, powerScale), true);
     SurfJNI.Cpu_director_connect(this, swigCPtr, swigCMemOwn, true);
   }
 
index 317b42e..4063ee1 100644 (file)
@@ -55,8 +55,8 @@ public class CpuModel extends Model {
     SurfJNI.CpuModel_director_connect(this, swigCPtr, swigCMemOwn, true);
   }
 
-  public Cpu createCpu(String name, double[] power_peak, int pstate, double power_scale, TmgrTrace power_trace, int core, ResourceState state_initial, TmgrTrace state_trace, XbtDict cpu_properties) {
-    long cPtr = SurfJNI.CpuModel_createCpu(swigCPtr, this, name, power_peak, pstate, power_scale, TmgrTrace.getCPtr(power_trace), power_trace, core, state_initial.swigValue(), TmgrTrace.getCPtr(state_trace), state_trace, XbtDict.getCPtr(cpu_properties), cpu_properties);
+  public Cpu createCpu(String name, double[] power_peak, int pstate, double power_scale, TmgrTrace power_trace, int core, ResourceState state_initial, TmgrTrace state_trace) {
+    long cPtr = SurfJNI.CpuModel_createCpu(swigCPtr, this, name, power_peak, pstate, power_scale, TmgrTrace.getCPtr(power_trace), power_trace, core, state_initial.swigValue(), TmgrTrace.getCPtr(state_trace), state_trace);
     return (cPtr == 0) ? null : new Cpu(cPtr, false);
   }
 
index 12191f6..e616995 100644 (file)
@@ -73,4 +73,9 @@ public class Link extends Resource {
     SurfJNI.Link_updateLatency__SWIG_1(swigCPtr, this, value);
   }
 
+  public XbtDict getProperties() {
+    long cPtr = SurfJNI.Link_getProperties(swigCPtr, this);
+    return (cPtr == 0) ? null : new XbtDict(cPtr, false);
+  }
+
 }
index f21b7b5..dbac94f 100644 (file)
@@ -57,11 +57,6 @@ public class Resource {
     return (cPtr == 0) ? null : new LmmConstraint(cPtr, false);
   }
 
-  public XbtDict getProperties() {
-    long cPtr = SurfJNI.Resource_getProperties(swigCPtr, this);
-    return (cPtr == 0) ? null : new XbtDict(cPtr, false);
-  }
-
   public void updateState(TmgrTraceEvent event_type, double value, double date) {
     SurfJNI.Resource_updateState(swigCPtr, this, TmgrTraceEvent.getCPtr(event_type), event_type, value, date);
   }
index af1eff3..d50a270 100644 (file)
@@ -82,7 +82,7 @@ public class SurfJNI {
   public final static native void delete_Model(long jarg1);
   public final static native long new_CpuModel();
   public final static native void delete_CpuModel(long jarg1);
-  public final static native long CpuModel_createCpu(long jarg1, CpuModel jarg1_, String jarg2, double[] jarg3, int jarg4, double jarg5, long jarg6, TmgrTrace jarg6_, int jarg7, int jarg8, long jarg9, TmgrTrace jarg9_, long jarg10, XbtDict jarg10_);
+  public final static native long CpuModel_createCpu(long jarg1, CpuModel jarg1_, String jarg2, double[] jarg3, int jarg4, double jarg5, long jarg6, TmgrTrace jarg6_, int jarg7, int jarg8, long jarg9, TmgrTrace jarg9_);
   public final static native void CpuModel_director_connect(CpuModel obj, long cptr, boolean mem_own, boolean weak_global);
   public final static native void CpuModel_change_ownership(CpuModel obj, long cptr, boolean take_or_release);
   public final static native String Resource_getName(long jarg1, Resource jarg1_);
@@ -90,11 +90,10 @@ public class SurfJNI {
   public final static native long Resource_getModel(long jarg1, Resource jarg1_);
   public final static native int Resource_getState(long jarg1, Resource jarg1_);
   public final static native long Resource_getConstraint(long jarg1, Resource jarg1_);
-  public final static native long Resource_getProperties(long jarg1, Resource jarg1_);
   public final static native void Resource_updateState(long jarg1, Resource jarg1_, long jarg2, TmgrTraceEvent jarg2_, double jarg3, double jarg4);
   public final static native void delete_Resource(long jarg1);
-  public final static native long new_Cpu__SWIG_0(long jarg1, Model jarg1_, String jarg2, long jarg3, XbtDict jarg3_, long jarg4, LmmConstraint jarg4_, int jarg5, double jarg6, double jarg7);
-  public final static native long new_Cpu__SWIG_1(long jarg1, Model jarg1_, String jarg2, long jarg3, XbtDict jarg3_, int jarg4, double jarg5, double jarg6);
+  public final static native long new_Cpu__SWIG_0(long jarg1, Model jarg1_, String jarg2, long jarg3, LmmConstraint jarg3_, int jarg4, double jarg5, double jarg6);
+  public final static native long new_Cpu__SWIG_1(long jarg1, Model jarg1_, String jarg2, int jarg3, double jarg4, double jarg5);
   public final static native void delete_Cpu(long jarg1);
   public final static native double Cpu_getCurrentPowerPeak(long jarg1, Cpu jarg1_);
   public final static native double Cpu_getCurrentPowerPeakSwigExplicitCpu(long jarg1, Cpu jarg1_);
@@ -120,6 +119,7 @@ public class SurfJNI {
   public final static native double Link_getLatency(long jarg1, Link jarg1_);
   public final static native void Link_updateLatency__SWIG_0(long jarg1, Link jarg1_, double jarg2, double jarg3);
   public final static native void Link_updateLatency__SWIG_1(long jarg1, Link jarg1_, double jarg2);
+  public final static native long Link_getProperties(long jarg1, Link jarg1_);
   public final static native long new_Action(long jarg1, Model jarg1_, double jarg2, boolean jarg3);
   public final static native void delete_Action(long jarg1);
   public final static native long Action_getModel(long jarg1, Action jarg1_);
@@ -210,8 +210,8 @@ public class SurfJNI {
   public static void SwigDirector_CpuModel_addTraces(CpuModel self) {
     self.addTraces();
   }
-  public static long SwigDirector_CpuModel_createCpu(CpuModel self, String name, double[] power_peak, int pstate, double power_scale, long power_trace, int core, int state_initial, long state_trace, long cpu_properties) {
-    return Cpu.getCPtr(self.createCpu(name, power_peak, pstate, power_scale, (power_trace == 0) ? null : new TmgrTrace(power_trace, false), core, ResourceState.swigToEnum(state_initial), (state_trace == 0) ? null : new TmgrTrace(state_trace, false), (cpu_properties == 0) ? null : new XbtDict(cpu_properties, false)));
+  public static long SwigDirector_CpuModel_createCpu(CpuModel self, String name, double[] power_peak, int pstate, double power_scale, long power_trace, int core, int state_initial, long state_trace) {
+    return Cpu.getCPtr(self.createCpu(name, power_peak, pstate, power_scale, (power_trace == 0) ? null : new TmgrTrace(power_trace, false), core, ResourceState.swigToEnum(state_initial), (state_trace == 0) ? null : new TmgrTrace(state_trace, false)));
   }
   public static boolean SwigDirector_Cpu_isUsed(Cpu self) {
     return self.isUsed();
index 2bca042..8701e69 100644 (file)
@@ -1538,7 +1538,7 @@ SwigDirector_CpuModel::~SwigDirector_CpuModel() {
 }
 
 
-simgrid::surf::Cpu *SwigDirector_CpuModel::createCpu(char const *name, DoubleDynar power_peak, int pstate, double power_scale, tmgr_trace *power_trace, int core, e_surf_resource_state_t state_initial, tmgr_trace *state_trace, s_xbt_dict *cpu_properties) {
+simgrid::surf::Cpu *SwigDirector_CpuModel::createCpu(char const *name, DoubleDynar power_peak, int pstate, double power_scale, tmgr_trace *power_trace, int core, e_surf_resource_state_t state_initial, tmgr_trace *state_trace) {
   simgrid::surf::Cpu *c_result = 0 ;
   jlong jresult = 0 ;
   JNIEnvWrapper swigjnienv(this) ;
@@ -1552,7 +1552,6 @@ simgrid::surf::Cpu *SwigDirector_CpuModel::createCpu(char const *name, DoubleDyn
   jint jcore  ;
   jint jstate_initial  ;
   jlong jstate_trace = 0 ;
-  jlong jcpu_properties = 0 ;
   
   if (!swig_override[8]) {
     SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method simgrid::surf::CpuModel::createCpu.");
@@ -1577,8 +1576,7 @@ simgrid::surf::Cpu *SwigDirector_CpuModel::createCpu(char const *name, DoubleDyn
     jcore = (jint) core;
     jstate_initial = (jint) state_initial;
     *((tmgr_trace **)&jstate_trace) = (tmgr_trace *) state_trace; 
-    *((s_xbt_dict **)&jcpu_properties) = (s_xbt_dict *) cpu_properties; 
-    jresult = (jlong) jenv->CallStaticLongMethod(Swig::jclass_SurfJNI, Swig::director_methids[17], swigjobj, jname, jpower_peak, jpstate, jpower_scale, jpower_trace, jcore, jstate_initial, jstate_trace, jcpu_properties);
+    jresult = (jlong) jenv->CallStaticLongMethod(Swig::jclass_SurfJNI, Swig::director_methids[17], swigjobj, jname, jpower_peak, jpstate, jpower_scale, jpower_trace, jcore, jstate_initial, jstate_trace);
     if (jenv->ExceptionCheck() == JNI_TRUE) return c_result;
     c_result = *(simgrid::surf::Cpu **)&jresult; 
   } else {
@@ -1619,7 +1617,7 @@ void SwigDirector_CpuModel::swig_connect_director(JNIEnv *jenv, jobject jself, j
       "addTraces", "()V", NULL 
     },
     {
-      "createCpu", "(Ljava/lang/String;[DIDLorg/simgrid/surf/TmgrTrace;ILorg/simgrid/surf/ResourceState;Lorg/simgrid/surf/TmgrTrace;Lorg/simgrid/surf/XbtDict;)Lorg/simgrid/surf/Cpu;", NULL 
+      "createCpu", "(Ljava/lang/String;[DIDLorg/simgrid/surf/TmgrTrace;ILorg/simgrid/surf/ResourceState;Lorg/simgrid/surf/TmgrTrace;)Lorg/simgrid/surf/Cpu;", NULL 
     }
   };
   
@@ -1648,10 +1646,10 @@ void SwigDirector_CpuModel::swig_connect_director(JNIEnv *jenv, jobject jself, j
 }
 
 
-SwigDirector_Cpu::SwigDirector_Cpu(JNIEnv *jenv, simgrid::surf::Model *model, char const *name, s_xbt_dict *props, lmm_constraint *constraint, int core, double powerPeak, double powerScale) : simgrid::surf::Cpu(model, name, props, constraint, core, powerPeak, powerScale), Swig::Director(jenv) {
+SwigDirector_Cpu::SwigDirector_Cpu(JNIEnv *jenv, simgrid::surf::Model *model, char const *name, lmm_constraint *constraint, int core, double powerPeak, double powerScale) : simgrid::surf::Cpu(model, name, constraint, core, powerPeak, powerScale), Swig::Director(jenv) {
 }
 
-SwigDirector_Cpu::SwigDirector_Cpu(JNIEnv *jenv, simgrid::surf::Model *model, char const *name, s_xbt_dict *props, int core, double powerPeak, double powerScale) : simgrid::surf::Cpu(model, name, props, core, powerPeak, powerScale), Swig::Director(jenv) {
+SwigDirector_Cpu::SwigDirector_Cpu(JNIEnv *jenv, simgrid::surf::Model *model, char const *name, int core, double powerPeak, double powerScale) : simgrid::surf::Cpu(model, name, core, powerPeak, powerScale), Swig::Director(jenv) {
 }
 
 bool SwigDirector_Cpu::isUsed() {
@@ -2990,7 +2988,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1CpuModel(JNIEnv *j
 }
 
 
-SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_CpuModel_1createCpu(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdoubleArray jarg3, jint jarg4, jdouble jarg5, jlong jarg6, jobject jarg6_, jint jarg7, jint jarg8, jlong jarg9, jobject jarg9_, jlong jarg10, jobject jarg10_) {
+SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_CpuModel_1createCpu(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdoubleArray jarg3, jint jarg4, jdouble jarg5, jlong jarg6, jobject jarg6_, jint jarg7, jint jarg8, jlong jarg9, jobject jarg9_) {
   jlong jresult = 0 ;
   simgrid::surf::CpuModel *arg1 = (simgrid::surf::CpuModel *) 0 ;
   char *arg2 = (char *) 0 ;
@@ -3001,7 +2999,6 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_CpuModel_1createCpu(JNIEn
   int arg7 ;
   e_surf_resource_state_t arg8 ;
   tmgr_trace *arg9 = (tmgr_trace *) 0 ;
-  s_xbt_dict *arg10 = (s_xbt_dict *) 0 ;
   DoubleDynar *argp3 ;
   simgrid::surf::Cpu *result = 0 ;
   
@@ -3010,7 +3007,6 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_CpuModel_1createCpu(JNIEn
   (void)jarg1_;
   (void)jarg6_;
   (void)jarg9_;
-  (void)jarg10_;
   arg1 = *(simgrid::surf::CpuModel **)&jarg1; 
   arg2 = 0;
   if (jarg2) {
@@ -3029,8 +3025,7 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_CpuModel_1createCpu(JNIEn
   arg7 = (int)jarg7; 
   arg8 = (e_surf_resource_state_t)jarg8; 
   arg9 = *(tmgr_trace **)&jarg9; 
-  arg10 = *(s_xbt_dict **)&jarg10; 
-  result = (simgrid::surf::Cpu *)(arg1)->createCpu((char const *)arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10);
+  result = (simgrid::surf::Cpu *)(arg1)->createCpu((char const *)arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
   *(simgrid::surf::Cpu **)&jresult = result; 
   {
     
@@ -3134,21 +3129,6 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1getConstraint(J
 }
 
 
-SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1getProperties(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
-  jlong jresult = 0 ;
-  simgrid::surf::Resource *arg1 = (simgrid::surf::Resource *) 0 ;
-  s_xbt_dict *result = 0 ;
-  
-  (void)jenv;
-  (void)jcls;
-  (void)jarg1_;
-  arg1 = *(simgrid::surf::Resource **)&jarg1; 
-  result = (s_xbt_dict *)(arg1)->getProperties();
-  *(s_xbt_dict **)&jresult = result; 
-  return jresult;
-}
-
-
 SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1updateState(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jdouble jarg3, jdouble jarg4) {
   simgrid::surf::Resource *arg1 = (simgrid::surf::Resource *) 0 ;
   tmgr_trace_event *arg2 = (tmgr_trace_event *) 0 ;
@@ -3177,34 +3157,31 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1Resource(JNIEnv *j
 }
 
 
-SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1Cpu_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_, jint jarg5, jdouble jarg6, jdouble jarg7) {
+SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1Cpu_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jint jarg4, jdouble jarg5, jdouble jarg6) {
   jlong jresult = 0 ;
   simgrid::surf::Model *arg1 = (simgrid::surf::Model *) 0 ;
   char *arg2 = (char *) 0 ;
-  s_xbt_dict *arg3 = (s_xbt_dict *) 0 ;
-  lmm_constraint *arg4 = (lmm_constraint *) 0 ;
-  int arg5 ;
+  lmm_constraint *arg3 = (lmm_constraint *) 0 ;
+  int arg4 ;
+  double arg5 ;
   double arg6 ;
-  double arg7 ;
   simgrid::surf::Cpu *result = 0 ;
   
   (void)jenv;
   (void)jcls;
   (void)jarg1_;
   (void)jarg3_;
-  (void)jarg4_;
   arg1 = *(simgrid::surf::Model **)&jarg1; 
   arg2 = 0;
   if (jarg2) {
     arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
     if (!arg2) return 0;
   }
-  arg3 = *(s_xbt_dict **)&jarg3; 
-  arg4 = *(lmm_constraint **)&jarg4; 
-  arg5 = (int)jarg5; 
+  arg3 = *(lmm_constraint **)&jarg3; 
+  arg4 = (int)jarg4; 
+  arg5 = (double)jarg5; 
   arg6 = (double)jarg6; 
-  arg7 = (double)jarg7; 
-  result = (simgrid::surf::Cpu *)new SwigDirector_Cpu(jenv,arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7);
+  result = (simgrid::surf::Cpu *)new SwigDirector_Cpu(jenv,arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
   *(simgrid::surf::Cpu **)&jresult = result; 
   {
     
@@ -3213,31 +3190,28 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1Cpu_1_1SWIG_10(JNIEn
 }
 
 
-SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1Cpu_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jint jarg4, jdouble jarg5, jdouble jarg6) {
+SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1Cpu_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jdouble jarg4, jdouble jarg5) {
   jlong jresult = 0 ;
   simgrid::surf::Model *arg1 = (simgrid::surf::Model *) 0 ;
   char *arg2 = (char *) 0 ;
-  s_xbt_dict *arg3 = (s_xbt_dict *) 0 ;
-  int arg4 ;
+  int arg3 ;
+  double arg4 ;
   double arg5 ;
-  double arg6 ;
   simgrid::surf::Cpu *result = 0 ;
   
   (void)jenv;
   (void)jcls;
   (void)jarg1_;
-  (void)jarg3_;
   arg1 = *(simgrid::surf::Model **)&jarg1; 
   arg2 = 0;
   if (jarg2) {
     arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
     if (!arg2) return 0;
   }
-  arg3 = *(s_xbt_dict **)&jarg3; 
-  arg4 = (int)jarg4; 
+  arg3 = (int)jarg3; 
+  arg4 = (double)jarg4; 
   arg5 = (double)jarg5; 
-  arg6 = (double)jarg6; 
-  result = (simgrid::surf::Cpu *)new SwigDirector_Cpu(jenv,arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
+  result = (simgrid::surf::Cpu *)new SwigDirector_Cpu(jenv,arg1,(char const *)arg2,arg3,arg4,arg5);
   *(simgrid::surf::Cpu **)&jresult = result; 
   {
     
@@ -3603,6 +3577,21 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Link_1updateLatency_1_1SWI
 }
 
 
+SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Link_1getProperties(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jlong jresult = 0 ;
+  simgrid::surf::Link *arg1 = (simgrid::surf::Link *) 0 ;
+  s_xbt_dict *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(simgrid::surf::Link **)&jarg1; 
+  result = (s_xbt_dict *)(arg1)->getProperties();
+  *(s_xbt_dict **)&jresult = result; 
+  return jresult;
+}
+
+
 SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1Action(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2, jboolean jarg3) {
   jlong jresult = 0 ;
   simgrid::surf::Model *arg1 = (simgrid::surf::Model *) 0 ;
@@ -4141,7 +4130,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_swig_1module_1init(JNIEnv
       "SwigDirector_CpuModel_addTraces", "(Lorg/simgrid/surf/CpuModel;)V" 
     },
     {
-      "SwigDirector_CpuModel_createCpu", "(Lorg/simgrid/surf/CpuModel;Ljava/lang/String;[DIDJIIJJ)J" 
+      "SwigDirector_CpuModel_createCpu", "(Lorg/simgrid/surf/CpuModel;Ljava/lang/String;[DIDJIIJ)J" 
     },
     {
       "SwigDirector_Cpu_isUsed", "(Lorg/simgrid/surf/Cpu;)Z" 
index 82b10b6..f7b1a10 100644 (file)
@@ -48,7 +48,7 @@ public:
     virtual simgrid::surf::ActionList *getRunningActionSet();
     virtual void addTraces();
     virtual ~SwigDirector_CpuModel();
-    virtual simgrid::surf::Cpu *createCpu(char const *name, DoubleDynar power_peak, int pstate, double power_scale, tmgr_trace *power_trace, int core, e_surf_resource_state_t state_initial, tmgr_trace *state_trace, s_xbt_dict *cpu_properties);
+    virtual simgrid::surf::Cpu *createCpu(char const *name, DoubleDynar power_peak, int pstate, double power_scale, tmgr_trace *power_trace, int core, e_surf_resource_state_t state_initial, tmgr_trace *state_trace);
 public:
     bool swig_overrides(int n) {
       return (n < 9 ? swig_override[n] : false);
@@ -61,8 +61,8 @@ class SwigDirector_Cpu : public simgrid::surf::Cpu, public Swig::Director {
 
 public:
     void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global);
-    SwigDirector_Cpu(JNIEnv *jenv, simgrid::surf::Model *model, char const *name, s_xbt_dict *props, lmm_constraint *constraint, int core, double powerPeak, double powerScale);
-    SwigDirector_Cpu(JNIEnv *jenv, simgrid::surf::Model *model, char const *name, s_xbt_dict *props, int core, double powerPeak, double powerScale);
+    SwigDirector_Cpu(JNIEnv *jenv, simgrid::surf::Model *model, char const *name, lmm_constraint *constraint, int core, double powerPeak, double powerScale);
+    SwigDirector_Cpu(JNIEnv *jenv, simgrid::surf::Model *model, char const *name, int core, double powerPeak, double powerScale);
     virtual bool isUsed();
     virtual e_surf_resource_state_t getState();
     virtual void updateState(tmgr_trace_event *event_type, double value, double date);
index a20d84c..3b78ab2 100644 (file)
@@ -292,8 +292,7 @@ public:
                               int pstate, double power_scale,
                               tmgr_trace *power_trace, int core,
                               e_surf_resource_state_t state_initial,
-                              tmgr_trace *state_trace,
-                              s_xbt_dict *cpu_properties)=0;
+                              tmgr_trace *state_trace)=0;
 };
 
 class Resource {
@@ -305,16 +304,15 @@ public:
 
   virtual e_surf_resource_state_t getState();
   lmm_constraint *getConstraint();
-  s_xbt_dict *getProperties();
   virtual void updateState(tmgr_trace_event *event_type, double value, double date)=0;
 };
 
 %feature("director") Cpu;
 class Cpu : public Resource {
 public:
-  Cpu(simgrid::surf::Model *model, const char *name, s_xbt_dict *props,
+  Cpu(simgrid::surf::Model *model, const char *name, 
     lmm_constraint *constraint, int core, double powerPeak, double powerScale);
-  Cpu(simgrid::surf::Model *model, const char *name, s_xbt_dict *props,
+  Cpu(simgrid::surf::Model *model, const char *name, 
     int core, double powerPeak, double powerScale);
   virtual ~Cpu();
   virtual double getCurrentPowerPeak();
@@ -338,6 +336,7 @@ public:
   void updateBandwidth(double value, double date=surf_get_clock());
   double getLatency();
   void updateLatency(double value, double date=surf_get_clock());
+  s_xbt_dict *getProperties();
 };
 
 %nodefaultctor Action;
index 1eee7b4..5e01fde 100644 (file)
@@ -300,11 +300,8 @@ static inline const char * surf_cpu_name(surf_cpu_t cpu) {
        return surf_resource_name((surf_cpp_resource_t)cpu);
 }
 
-/** @brief Get the properties of a surf resource (cpu, host, network, â€¦) */
-XBT_PUBLIC(xbt_dict_t) surf_resource_get_properties(surf_cpp_resource_t resource);
-static XBT_INLINE xbt_dict_t surf_host_get_properties(surf_host_t host) {
-       return surf_resource_get_properties((surf_cpp_resource_t)host);
-}
+/** @brief Get the properties of an host */
+XBT_PUBLIC(xbt_dict_t) sg_host_get_properties(sg_host_t host);
 
 
 /** @brief Get the state of a surf resource (cpu, host, network, â€¦) */
@@ -623,6 +620,8 @@ XBT_PUBLIC(sg_size_t) surf_storage_get_free_size(surf_resource_t resource);
  */
 XBT_PUBLIC(sg_size_t) surf_storage_get_used_size(surf_resource_t resource);
 
+/** @brief return the properties set associated to that storage */
+XBT_PUBLIC(xbt_dict_t) surf_storage_get_properties(surf_resource_t resource);
 
 /**
  * @brief Get the data associated to the action
index 3b5c2ea..8162d2e 100644 (file)
@@ -164,7 +164,7 @@ const char *SD_workstation_get_property_value(SD_workstation_t ws,
  */
 xbt_dict_t SD_workstation_get_properties(SD_workstation_t workstation)
 {
-  return surf_host_get_properties(surf_host_resource_priv(workstation));
+  return sg_host_get_properties(workstation);
 }
 
 
index 45f48f9..dce8607 100644 (file)
@@ -162,7 +162,7 @@ const char* SIMIX_host_self_get_name(void)
 }
 
 xbt_dict_t SIMIX_host_get_properties(sg_host_t host){
-  return surf_host_get_properties(surf_host_resource_priv(host));
+  return sg_host_get_properties(host);
 }
 
 
index 3866492..146a80a 100644 (file)
@@ -273,9 +273,7 @@ sg_size_t SIMIX_storage_get_used_size(smx_process_t process, smx_storage_t stora
 }
 
 xbt_dict_t SIMIX_storage_get_properties(smx_storage_t storage){
-  xbt_assert((storage != NULL), "Invalid parameters (simix storage is NULL)");
-  return (xbt_dict_t) surf_resource_get_properties((surf_cpp_resource_t)
-    surf_storage_resource_priv(storage));
+  return surf_storage_get_properties(storage);
 }
 
 const char* SIMIX_storage_get_name(smx_storage_t storage){
index afeb09a..0fe7981 100644 (file)
@@ -103,13 +103,12 @@ Cpu *CpuCas01Model::createCpu(const char *name, xbt_dynar_t speedPeak,
                                  int pstate, double speedScale,
                           tmgr_trace_t speedTrace, int core,
                           e_surf_resource_state_t state_initial,
-                          tmgr_trace_t state_trace,
-                          xbt_dict_t cpu_properties)
+                          tmgr_trace_t state_trace)
 {
   xbt_assert(xbt_dynar_getfirst_as(speedPeak, double) > 0.0,
       "Speed has to be >0.0. Did you forget to specify the mandatory power attribute?");
   xbt_assert(core > 0, "Invalid number of cores %d. Must be larger than 0", core);
-  Cpu *cpu = new CpuCas01(this, name, speedPeak, pstate, speedScale, speedTrace, core, state_initial, state_trace, cpu_properties);
+  Cpu *cpu = new CpuCas01(this, name, speedPeak, pstate, speedScale, speedTrace, core, state_initial, state_trace);
   return cpu;
 }
 
@@ -155,9 +154,8 @@ void CpuCas01Model::addTraces()
  ************/
 CpuCas01::CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t speedPeak,
                          int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
-                         e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
-                         xbt_dict_t properties)
-: Cpu(model, name, properties,
+                         e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace)
+: Cpu(model, name,
          lmm_constraint_new(model->getMaxminSystem(), this, core * speedScale * xbt_dynar_get_as(speedPeak, pstate, double)),
          core, xbt_dynar_get_as(speedPeak, pstate, double), speedScale,
     stateInitial) {
index b98fd23..8d53c81 100644 (file)
@@ -35,8 +35,7 @@ public:
                    double speedScale,
                           tmgr_trace_t speedTrace, int core,
                           e_surf_resource_state_t state_initial,
-                          tmgr_trace_t state_trace,
-                          xbt_dict_t cpu_properties);
+                          tmgr_trace_t state_trace);
   double shareResourcesFull(double now);
   void addTraces();
   ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
@@ -50,8 +49,7 @@ class CpuCas01 : public Cpu {
 public:
   CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t speedPeak,
         int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
-        e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
-       xbt_dict_t properties) ;
+        e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace) ;
   ~CpuCas01();
   void updateState(tmgr_trace_event_t event_type, double value, double date);
   CpuAction *execute(double size);
index d99dad7..0142878 100644 (file)
@@ -145,10 +145,10 @@ Cpu::Cpu()
 }
 
 
-Cpu::Cpu(Model *model, const char *name, xbt_dict_t props,
+Cpu::Cpu(Model *model, const char *name,
          int core, double speedPeak, double speedScale,
          e_surf_resource_state_t stateInitial)
- : Resource(model, name, props, stateInitial)
+ : Resource(model, name, stateInitial)
  , m_core(core)
  , m_speedPeak(speedPeak)
  , m_speedScale(speedScale)
@@ -156,10 +156,10 @@ Cpu::Cpu(Model *model, const char *name, xbt_dict_t props,
 
 }
 
-Cpu::Cpu(Model *model, const char *name, xbt_dict_t props,
+Cpu::Cpu(Model *model, const char *name,
         lmm_constraint_t constraint, int core, double speedPeak,
         double speedScale, e_surf_resource_state_t stateInitial)
- : Resource(model, name, props, constraint, stateInitial)
+ : Resource(model, name, constraint, stateInitial)
  , m_core(core)
  , m_speedPeak(speedPeak)
  , m_speedScale(speedScale)
@@ -181,14 +181,14 @@ Cpu::Cpu(Model *model, const char *name, xbt_dict_t props,
   }
 }
 
-Cpu::Cpu(Model *model, const char *name, xbt_dict_t props,
+Cpu::Cpu(Model *model, const char *name,
   lmm_constraint_t constraint, int core, double speedPeak, double speedScale)
-: Cpu(model, name, props, constraint, core, speedPeak, speedScale, SURF_RESOURCE_ON)
+: Cpu(model, name, constraint, core, speedPeak, speedScale, SURF_RESOURCE_ON)
 {}
 
-Cpu::Cpu(Model *model, const char *name, xbt_dict_t props,
+Cpu::Cpu(Model *model, const char *name,
   int core, double speedPeak, double speedScale)
-: Cpu(model, name, props, core, speedPeak, speedScale, SURF_RESOURCE_ON)
+: Cpu(model, name, core, speedPeak, speedScale, SURF_RESOURCE_ON)
 {}
 
 Cpu::~Cpu(){
index e28d4d3..8e5a7ce 100644 (file)
@@ -76,14 +76,12 @@ public:
    * @param core The number of core of this Cpu
    * @param state_initial [TODO]
    * @param state_trace [TODO]
-   * @param cpu_properties Dictionary of properties associated to this Cpu
    */
   virtual Cpu *createCpu(const char *name, xbt_dynar_t speedPeak,
                       int pstate, double speedScale,
                           tmgr_trace_t speedTrace, int core,
                           e_surf_resource_state_t state_initial,
-                          tmgr_trace_t state_trace,
-                          xbt_dict_t cpu_properties)=0;
+                          tmgr_trace_t state_trace)=0;
 
   void updateActionsStateLazy(double now, double delta);
   void updateActionsStateFull(double now, double delta);
@@ -109,14 +107,13 @@ public:
    *
    * @param model The CpuModel associated to this Cpu
    * @param name The name of the Cpu
-   * @param props Dictionary of properties associated to this Cpu
    * @param constraint The lmm constraint associated to this Cpu if it is part of a LMM component
    * @param core The number of core of this Cpu
    * @param speedPeak The speed peak of this Cpu in flops (max speed)
    * @param speedScale The speed scale of this Cpu in [0;1] (available amount)
    * @param stateInitial whether it is created running or crashed
    */
-  Cpu(simgrid::surf::Model *model, const char *name, xbt_dict_t props,
+  Cpu(simgrid::surf::Model *model, const char *name,
          lmm_constraint_t constraint, int core, double speedPeak, double speedScale,
          e_surf_resource_state_t stateInitial);
 
@@ -125,19 +122,18 @@ public:
    *
    * @param model The CpuModel associated to this Cpu
    * @param name The name of the Cpu
-   * @param props Dictionary of properties associated to this Cpu
    * @param core The number of core of this Cpu
    * @param speedPeak The speed peak of this Cpu in flops (max speed)
    * @param speedScale The speed scale of this Cpu in [0;1] (available amount)
    * @param stateInitial whether it is created running or crashed
    */
-  Cpu(simgrid::surf::Model *model, const char *name, xbt_dict_t props,
+  Cpu(simgrid::surf::Model *model, const char *name,
          int core, double speedPeak, double speedScale,
          e_surf_resource_state_t stateInitial);
 
-  Cpu(simgrid::surf::Model *model, const char *name, xbt_dict_t props,
+  Cpu(simgrid::surf::Model *model, const char *name,
          lmm_constraint_t constraint, int core, double speedPeak, double speedScale);
-  Cpu(simgrid::surf::Model *model, const char *name, xbt_dict_t props,
+  Cpu(simgrid::surf::Model *model, const char *name,
          int core, double speedPeak, double speedScale);
 
   ~Cpu();
index 352b1ea..dd729be 100644 (file)
@@ -442,14 +442,13 @@ Cpu *CpuTiModel::createCpu(const char *name,
                            tmgr_trace_t speedTrace,
                            int core,
                            e_surf_resource_state_t stateInitial,
-                           tmgr_trace_t stateTrace,
-                           xbt_dict_t cpuProperties)
+                           tmgr_trace_t stateTrace)
 {
   xbt_assert(core==1,"Multi-core not handled with this model yet");
   xbt_assert(xbt_dynar_getfirst_as(speedPeak, double) > 0.0,
       "Speed has to be >0.0. Did you forget to specify the mandatory speed attribute?");
   CpuTi *cpu = new CpuTi(this, name, speedPeak, pstate, speedScale, speedTrace,
-                          core, stateInitial, stateTrace, cpuProperties);
+                          core, stateInitial, stateTrace);
   return cpu;
 }
 
@@ -551,9 +550,8 @@ void CpuTiModel::addTraces()
  ************/
 CpuTi::CpuTi(CpuTiModel *model, const char *name, xbt_dynar_t speedPeak,
         int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
-        e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
-             xbt_dict_t properties)
-  : Cpu(model, name, properties, core, 0, speedScale, stateInitial)
+        e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace)
+  : Cpu(model, name, core, 0, speedScale, stateInitial)
 {
   p_speedEvent = NULL;
   m_speedScale = speedScale;
index 75ffbf4..f95c819 100644 (file)
@@ -117,8 +117,7 @@ public:
   CpuTi() {};
   CpuTi(CpuTiModel *model, const char *name, xbt_dynar_t speedPeak,
         int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
-        e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
-       xbt_dict_t properties) ;
+        e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace) ;
   ~CpuTi();
 
   void updateState(tmgr_trace_event_t event_type, double value, double date);
@@ -165,8 +164,7 @@ public:
                           int pstate, double speedScale,
                           tmgr_trace_t speedTrace, int core,
                           e_surf_resource_state_t state_initial,
-                          tmgr_trace_t state_trace,
-                          xbt_dict_t cpu_properties);
+                          tmgr_trace_t state_trace);
   double shareResources(double now);
   void updateActionsState(double now, double delta);
   void addTraces();
index 3465f78..189f709 100644 (file)
@@ -47,8 +47,8 @@ void surf_host_model_init_compound()
 namespace simgrid {
 namespace surf {
 
-Host *HostCLM03Model::createHost(const char *name,RoutingEdge *netElm, Cpu *cpu){
-  Host *host = new simgrid::surf::HostCLM03(surf_host_model, name, NULL,
+Host *HostCLM03Model::createHost(const char *name,RoutingEdge *netElm, Cpu *cpu, xbt_dict_t props){
+  Host *host = new simgrid::surf::HostCLM03(surf_host_model, name, props,
                  (xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL),
                  netElm, cpu);
   XBT_DEBUG("Create host %s with %ld mounted disks", name, xbt_dynar_length(host->p_storage));
index ea0218b..e8eeefd 100644 (file)
@@ -33,8 +33,8 @@ class HostCLM03Model : public HostModel {
 public:
   HostCLM03Model(): HostModel(){}
   ~HostCLM03Model() {}
-  Host *createHost(const char *name, RoutingEdge *netElm, Cpu *cpu);
-  double shareResources(double now);
+  Host *createHost(const char *name, RoutingEdge *netElm, Cpu *cpu, xbt_dict_t props) override;
+  double shareResources(double now) override;
 
   void updateActionsState(double now, double delta);
 
index e2eb602..2d87c0d 100644 (file)
@@ -91,22 +91,23 @@ void Host::init()
 
 Host::Host(simgrid::surf::Model *model, const char *name, xbt_dict_t props,
                                 xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu)
- : Resource(model, name, props)
- , p_storage(storage), p_netElm(netElm), p_cpu(cpu)
+ : Resource(model, name)
+ , p_storage(storage), p_netElm(netElm), p_cpu(cpu), p_properties(props)
 {
   p_params.ramsize = 0;
 }
 
 Host::Host(simgrid::surf::Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint,
                                         xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu)
- : Resource(model, name, props, constraint)
- , p_storage(storage), p_netElm(netElm), p_cpu(cpu)
+ : Resource(model, name, constraint)
+ , p_storage(storage), p_netElm(netElm), p_cpu(cpu), p_properties(props)
 {
   p_params.ramsize = 0;
 }
 
 Host::~Host(){
   surf_callback_emit(hostDestructedCallbacks, this);
+  xbt_dict_free(&p_properties);
 }
 
 void Host::attach(simgrid::Host* host)
@@ -127,7 +128,9 @@ void Host::setState(e_surf_resource_state_t state){
 
 xbt_dict_t Host::getProperties()
 {
-  return p_cpu->getProperties();
+       if (p_properties==NULL)
+               p_properties = xbt_dict_new();
+       return p_properties;
 }
 
 simgrid::surf::Storage *Host::findStorageOnMountList(const char* mount)
index 5c081d2..090c2ed 100644 (file)
@@ -74,7 +74,7 @@ public:
   HostModel() : Model() {}
   ~HostModel() {}
 
-  virtual Host *createHost(const char *name, RoutingEdge *net, Cpu *cpu)=0;
+  virtual Host *createHost(const char *name, RoutingEdge *net, Cpu *cpu, xbt_dict_t props)=0;
   void addTraces(){DIE_IMPOSSIBLE;}
 
   virtual void adjustWeightOfDummyCpuActions();
@@ -269,6 +269,7 @@ public:
   RoutingEdge *p_netElm;
   Cpu *p_cpu;
   simgrid::Host* p_host = nullptr;
+  xbt_dict_t p_properties = NULL;
 
   /** @brief Get the list of virtual machines on the current Host */
   xbt_dynar_t getVms();
index fea3be0..75d589d 100644 (file)
@@ -270,9 +270,9 @@ Action *HostL07Model::executeParallelTask(int host_nb,
   return action;
 }
 
-Host *HostL07Model::createHost(const char *name,RoutingEdge *netElm, Cpu *cpu)
+Host *HostL07Model::createHost(const char *name,RoutingEdge *netElm, Cpu *cpu, xbt_dict_t props)
 {
-  return new HostL07(this, name, NULL, netElm, cpu);
+  return new HostL07(this, name, props, netElm, cpu);
 }
 
 Action *NetworkL07Model::communicate(RoutingEdge *src, RoutingEdge *dst,
@@ -305,12 +305,10 @@ Cpu *CpuL07Model::createCpu(const char *name,  xbt_dynar_t powerPeak,
                           int pstate, double power_scale,
                           tmgr_trace_t power_trace, int core,
                           e_surf_resource_state_t state_initial,
-                          tmgr_trace_t state_trace,
-                          xbt_dict_t cpu_properties)
+                          tmgr_trace_t state_trace)
 {
   double power_initial = xbt_dynar_get_as(powerPeak, pstate, double);
-  CpuL07 *cpu = new CpuL07(this, name, cpu_properties,
-                                    power_initial, power_scale, power_trace,
+  CpuL07 *cpu = new CpuL07(this, name, power_initial, power_scale, power_trace,
                          core, state_initial, state_trace);
   return cpu;
 }
@@ -407,10 +405,10 @@ HostL07::HostL07(HostModel *model, const char* name, xbt_dict_t props, RoutingEd
 {
 }
 
-CpuL07::CpuL07(CpuL07Model *model, const char* name, xbt_dict_t props,
+CpuL07::CpuL07(CpuL07Model *model, const char* name,
                     double speedInitial, double speedScale, tmgr_trace_t speedTrace,
                           int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace)
- : Cpu(model, name, props, lmm_constraint_new(ptask_maxmin_system, this, speedInitial * speedScale),
+ : Cpu(model, name, lmm_constraint_new(ptask_maxmin_system, this, speedInitial * speedScale),
           core, speedInitial, speedScale, state_initial)
 {
   xbt_assert(m_speedScale > 0, "Power has to be >0");
index b4c5509..2c8f1db 100644 (file)
@@ -45,12 +45,12 @@ public:
 
   double shareResources(double now);
   void updateActionsState(double now, double delta);
-  Host *createHost(const char *name,RoutingEdge *netElm, Cpu *cpu);
+  Host *createHost(const char *name,RoutingEdge *netElm, Cpu *cpu, xbt_dict_t props) override;
   Action *executeParallelTask(int host_nb,
                               sg_host_t *host_list,
                                                          double *flops_amount,
                                                          double *bytes_amount,
-                                                         double rate);
+                                                         double rate) override;
   xbt_dynar_t getRoute(Host *src, Host *dst);
   void addTraces();
 };
@@ -63,8 +63,7 @@ public:
                           int pstate, double speedScale,
                           tmgr_trace_t speedTrace, int core,
                           e_surf_resource_state_t state_initial,
-                          tmgr_trace_t state_trace,
-                          xbt_dict_t cpu_properties);
+                          tmgr_trace_t state_trace) override;
   void addTraces() {DIE_IMPOSSIBLE;};
 
   HostL07Model *p_hostModel;
@@ -75,15 +74,14 @@ public:
   NetworkL07Model(HostL07Model *hmodel) : NetworkModel() {p_hostModel = hmodel;};
   ~NetworkL07Model() {surf_network_model = NULL;};
   Link* createLink(const char *name,
-                                                  double bw_initial,
-                                                  tmgr_trace_t bw_trace,
-                                                  double lat_initial,
-                                                  tmgr_trace_t lat_trace,
-                                                  e_surf_resource_state_t
-                                                  state_initial,
-                                                  tmgr_trace_t state_trace,
-                                                  e_surf_link_sharing_policy_t
-                                                  policy, xbt_dict_t properties);
+                 double bw_initial,
+                 tmgr_trace_t bw_trace,
+                 double lat_initial,
+                 tmgr_trace_t lat_trace,
+                 e_surf_resource_state_t state_initial,
+                 tmgr_trace_t state_trace,
+                 e_surf_link_sharing_policy_t policy,
+                 xbt_dict_t properties) override;
 
   Action *communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
   void addTraces() {DIE_IMPOSSIBLE;};
@@ -111,7 +109,7 @@ class CpuL07 : public Cpu {
   tmgr_trace_event_t p_stateEvent;
   tmgr_trace_event_t p_speedEvent;
 public:
-  CpuL07(CpuL07Model *model, const char* name, xbt_dict_t properties,
+  CpuL07(CpuL07Model *model, const char* name,
                 double power_scale, double power_initial, tmgr_trace_t power_trace,
      int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace);
   bool isUsed();
index 14bd060..a6b7937 100644 (file)
@@ -194,7 +194,8 @@ double NetworkModel::shareResourcesFull(double now)
  ************/
 
 Link::Link(simgrid::surf::NetworkModel *model, const char *name, xbt_dict_t props)
-: Resource(model, name, props)
+: Resource(model, name),
+  p_properties(props)
 {
   links->insert({name, this});
 
@@ -205,7 +206,8 @@ Link::Link(simgrid::surf::NetworkModel *model, const char *name, xbt_dict_t prop
                                 lmm_constraint_t constraint,
                             tmgr_history_t history,
                             tmgr_trace_t state_trace)
-: Resource(model, name, props, constraint)
+: Resource(model, name, constraint),
+  p_properties(props)
 {
   if (state_trace)
     p_stateEvent = tmgr_history_add_trace(history, state_trace, 0.0, 0, this);
@@ -218,6 +220,7 @@ Link::Link(simgrid::surf::NetworkModel *model, const char *name, xbt_dict_t prop
 Link::~Link()
 {
   surf_callback_emit(networkLinkDestructedCallbacks, this);
+  xbt_dict_free(&p_properties);
 }
 
 bool Link::isUsed()
@@ -246,6 +249,13 @@ void Link::setState(e_surf_resource_state_t state){
   surf_callback_emit(networkLinkStateChangedCallbacks, this, old, state);
 }
 
+xbt_dict_t Link::getProperties()
+{
+       if (p_properties==NULL)
+               p_properties = xbt_dict_new();
+       return p_properties;
+}
+
 /**********
  * Action *
  **********/
index 0bbd3da..dcd3136 100644 (file)
@@ -252,6 +252,11 @@ public:
 private:
   void *userData = NULL;
 
+public:
+  xbt_dict_t getProperties();
+protected:
+  xbt_dict_t p_properties = NULL;
+
   /* List of all links */
 private:
   static boost::unordered_map<std::string, Link *> *links;
index bc674ce..b189642 100644 (file)
@@ -69,10 +69,9 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host)
         host->speed_trace,
         host->core_amount,
         host->initial_state,
-        host->state_trace,
-        host->properties);
+        host->state_trace);
   cpu->plug(h);
-  surf_host_model->createHost(host->id, net, cpu)->attach(h);
+  surf_host_model->createHost(host->id, net, cpu, host->properties)->attach(h);
   if (TRACE_is_enabled() && TRACE_needs_platform())
     sg_instr_new_host(host);
 }
@@ -182,13 +181,13 @@ void sg_platf_new_storage(sg_platf_storage_cbarg_t storage)
       ((storage_type_t) stype)->type_id,
       storage->content,
       storage->content_type,
-      storage->properties);
+         storage->properties);
 
   surf_storage_model->createStorage(storage->id,
                                      ((storage_type_t) stype)->type_id,
                                      storage->content,
                                      storage->content_type,
-                                     storage->properties,
+                                                                        storage->properties,
                                      storage->attach);
 }
 void sg_platf_new_storage_type(sg_platf_storage_type_cbarg_t storage_type){
index a723966..8b64c56 100644 (file)
@@ -58,11 +58,12 @@ StorageModel::~StorageModel(){
 Storage::Storage(Model *model, const char *name, xbt_dict_t props,
                  const char* type_id, char *content_name, char *content_type,
                  sg_size_t size)
- : Resource(model, name, props)
+ : Resource(model, name)
  , p_contentType(content_type)
  , m_size(size), m_usedSize(0)
  , p_typeId(xbt_strdup(type_id))
  , p_writeActions(xbt_dynar_new(sizeof(Action*),NULL))
+ , p_properties(props)
 {
   p_content = parseContent(content_name);
   setState(SURF_RESOURCE_ON);
@@ -72,11 +73,13 @@ Storage::Storage(Model *model, const char *name, xbt_dict_t props,
                  lmm_system_t maxminSystem, double bread, double bwrite,
                  double bconnection, const char* type_id, char *content_name,
                  char *content_type, sg_size_t size, char *attach)
- :  Resource(model, name, props, lmm_constraint_new(maxminSystem, this, bconnection))
+ :  Resource(model, name, lmm_constraint_new(maxminSystem, this, bconnection))
  , p_contentType(content_type)
  , m_size(size), m_usedSize(0)
  , p_typeId(xbt_strdup(type_id))
- , p_writeActions(xbt_dynar_new(sizeof(Action*),NULL)) {
+ , p_writeActions(xbt_dynar_new(sizeof(Action*),NULL))
+ , p_properties(props)
+{
   p_content = parseContent(content_name);
   p_attach = xbt_strdup(attach);
   setState(SURF_RESOURCE_ON);
@@ -88,6 +91,7 @@ Storage::Storage(Model *model, const char *name, xbt_dict_t props,
 Storage::~Storage(){
   surf_callback_emit(storageDestructedCallbacks, this);
   xbt_dict_free(&p_content);
+  xbt_dict_free(&p_properties);
   xbt_dynar_free(&p_writeActions);
   free(p_typeId);
   free(p_contentType);
@@ -176,6 +180,13 @@ sg_size_t Storage::getUsedSize(){
   return m_usedSize;
 }
 
+xbt_dict_t Storage::getProperties()
+{
+       if (p_properties==NULL)
+               p_properties = xbt_dict_new();
+       return p_properties;
+}
+
 /**********
  * Action *
  **********/
index 4d30a14..3be52e9 100644 (file)
@@ -241,6 +241,12 @@ public:
 
   lmm_constraint_t p_constraintWrite;    /* Constraint for maximum write bandwidth*/
   lmm_constraint_t p_constraintRead;     /* Constraint for maximum write bandwidth*/
+
+public:
+  xbt_dict_t getProperties();
+protected:
+  xbt_dict_t p_properties = NULL;
+
 };
 
 /**********
index 4b6ca5a..bc658f3 100644 (file)
@@ -242,10 +242,6 @@ const char *surf_resource_name(surf_cpp_resource_t resource){
   return resource->getName();
 }
 
-xbt_dict_t surf_resource_get_properties(surf_cpp_resource_t resource){
-  return resource->getProperties();
-}
-
 e_surf_resource_state_t surf_resource_get_state(surf_cpp_resource_t resource){
   return resource->getState();
 }
@@ -258,6 +254,10 @@ surf_action_t surf_host_sleep(sg_host_t host, double duration){
   return get_casted_host(host)->sleep(duration);
 }
 
+xbt_dict_t sg_host_get_properties(sg_host_t host) {
+       return get_casted_host(host)->getProperties();
+}
+
 double surf_host_get_speed(sg_host_t host, double load){
   return sg_host_surfcpu(host)->getSpeed(load);
 }
@@ -447,6 +447,10 @@ sg_size_t surf_storage_get_used_size(surf_resource_t resource){
   return static_cast<simgrid::surf::Storage*>(surf_storage_resource_priv(resource))->getUsedSize();
 }
 
+xbt_dict_t surf_storage_get_properties(surf_resource_t resource){
+  return static_cast<simgrid::surf::Storage*>(surf_storage_resource_priv(resource))->getProperties();
+}
+
 const char* surf_storage_get_host(surf_resource_t resource){
   return static_cast<simgrid::surf::Storage*>(surf_storage_resource_priv(resource))->p_attach;
 }
index 0f43bcf..3f7d33a 100644 (file)
@@ -591,32 +591,31 @@ namespace simgrid {
 namespace surf {
 
 Resource::Resource()
-: p_name(NULL), p_properties(NULL), p_model(NULL)
+: p_name(NULL), p_model(NULL)
 {}
 
-Resource::Resource(Model *model, const char *name, xbt_dict_t props)
-  : Resource(model, name, props, SURF_RESOURCE_ON)
+Resource::Resource(Model *model, const char *name)
+  : Resource(model, name, SURF_RESOURCE_ON)
 {}
 
-Resource::Resource(Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint)
-  : Resource(model, name, props, constraint, SURF_RESOURCE_ON)
+Resource::Resource(Model *model, const char *name, lmm_constraint_t constraint)
+  : Resource(model, name, constraint, SURF_RESOURCE_ON)
 {}
   
 Resource::Resource(
-  Model *model, const char *name, xbt_dict_t props,
+  Model *model, const char *name,
   lmm_constraint_t constraint, e_surf_resource_state_t stateInit)
-  : p_name(xbt_strdup(name)), p_properties(props), p_model(model)
+  : p_name(xbt_strdup(name)), p_model(model)
   , m_running(true), m_stateCurrent(stateInit), p_constraint(constraint)
 {}
 
-Resource::Resource(Model *model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit)
-  : p_name(xbt_strdup(name)), p_properties(props), p_model(model)
+Resource::Resource(Model *model, const char *name, e_surf_resource_state_t stateInit)
+  : p_name(xbt_strdup(name)), p_model(model)
   , m_running(true), m_stateCurrent(stateInit)
 {}
 
 Resource::~Resource() {
   xbt_free((void*)p_name);
-  xbt_dict_free(&p_properties);
 }
 
 e_surf_resource_state_t Resource::getState()
@@ -656,12 +655,6 @@ const char *Resource::getName() {
   return p_name;
 }
 
-xbt_dict_t Resource::getProperties() {
-  if (p_properties==NULL)
-    p_properties = xbt_dict_new();
-  return p_properties;
-}
-
 lmm_constraint_t Resource::getConstraint() {
   return p_constraint;
 }
index 3bccf4d..ae7266f 100644 (file)
@@ -432,31 +432,28 @@ public:
    *
    * @param model Model associated to this Resource
    * @param name The name of the Resource
-   * @param props Dictionary of properties associated to this Resource
    */
-  Resource(Model *model, const char *name, xbt_dict_t props);
+  Resource(Model *model, const char *name);
 
   /**
    * @brief Constructor of LMM Resources
    *
    * @param model Model associated to this Resource
    * @param name The name of the Resource
-   * @param props Dictionary of properties associated to this Resource
    * @param constraint The lmm constraint associated to this Resource if it is part of a LMM component
    */
-  Resource(Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint);
+  Resource(Model *model, const char *name, lmm_constraint_t constraint);
 
-  Resource(Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint, e_surf_resource_state_t stateInit);
+  Resource(Model *model, const char *name, lmm_constraint_t constraint, e_surf_resource_state_t stateInit);
 
   /**
    * @brief Resource constructor
    *
    * @param model Model associated to this Resource
    * @param name The name of the Resource
-   * @param props Dictionary of properties associated to this Resource
    * @param stateInit the initial state of the Resource
    */
-  Resource(Model *model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit);
+  Resource(Model *model, const char *name, e_surf_resource_state_t stateInit);
 
   virtual ~Resource();
 
@@ -466,9 +463,6 @@ public:
   /** @brief Get the name of the current Resource */
   const char *getName();
 
-  /** @brief Get the properties of the current Resource */
-  virtual xbt_dict_t getProperties();
-
   /**
    * @brief Update the state of the current Resource
    * @details [TODO]
@@ -496,7 +490,6 @@ public:
 
 private:
   const char *p_name;
-  xbt_dict_t p_properties;
   Model *p_model;
   bool m_running;
   e_surf_resource_state_t m_stateCurrent;
index a7d99e4..2de593b 100644 (file)
@@ -111,7 +111,7 @@ public:
   VMModel() :HostModel(){}
   ~VMModel(){};
 
-  Host *createHost(const char *name, RoutingEdge *netElm, Cpu *cpu){DIE_IMPOSSIBLE;}
+  Host *createHost(const char *name, RoutingEdge *netElm, Cpu *cpu,xbt_dict_t props) override {DIE_IMPOSSIBLE;}
 
   /**
    * @brief Create a new VM
index f0c0ce8..428c515 100644 (file)
@@ -197,8 +197,7 @@ VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props,
       NULL,                       // host->power_trace,
       1,                          // host->core_amount,
       SURF_RESOURCE_ON,           // host->initial_state,
-      NULL,                       // host->state_trace,
-      NULL);                       // host->properties,
+      NULL);                      // host->state_trace,
   p_cpu->plug(host);
 
   /* We create cpu_action corresponding to a VM process on the host operating system. */