Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make sure upper layer can retrieve the properties of workstations (and that's the...
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 2 Jul 2009 08:00:36 +0000 (08:00 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 2 Jul 2009 08:00:36 +0000 (08:00 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6442 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/include/surf/surf.h
src/simdag/sd_workstation.c
src/simix/smx_host.c
src/surf/cpu.c
src/surf/surf_private.h
src/surf/workstation.c
src/surf/workstation_ptask_L07.c

index ce16cd1..288bc40 100644 (file)
@@ -216,6 +216,7 @@ XBT_PUBLIC(int) find_model_description(s_surf_model_description_t * table,
        double (*get_link_bandwidth) (const void *link);                                    /**< Return the current bandwidth of a network link */
        double (*get_link_latency) (const void *link);                                      /**< Return the current latency of a network link */
        int (*link_shared) (const void *link);
+       xbt_dict_t (*get_properties)(const void*resource);
      } s_surf_model_extension_workstation_t;
 
 /** \brief Model datatype
@@ -273,7 +274,6 @@ XBT_PUBLIC(int) find_model_description(s_surf_model_description_t * table,
      } s_surf_resource_t, *surf_resource_t;
 
      XBT_PUBLIC(const char*) surf_resource_name(const void *resource);
-     XBT_PUBLIC(xbt_dict_t) surf_resource_properties(const void *resource);
 XBT_PUBLIC(void) surf_resource_free(void* resource);
 /**************************************/
 /* Implementations of model object */
index cad1f73..6918b41 100644 (file)
@@ -162,7 +162,7 @@ xbt_dict_t SD_workstation_get_properties(SD_workstation_t workstation)
   SD_CHECK_INIT_DONE();
   xbt_assert0((workstation != NULL), "Invalid parameters");
 
-  return surf_resource_properties(workstation->surf_workstation);
+  return surf_workstation_model->extension.workstation.get_properties(workstation->surf_workstation);
 
 }
 
index 73f4cfb..6b851bc 100644 (file)
@@ -233,7 +233,7 @@ xbt_dict_t SIMIX_host_get_properties(smx_host_t host)
 {
   xbt_assert0((host != NULL), "Invalid parameters");
 
-  return surf_resource_properties(host->simdata->host);
+  return surf_workstation_model->extension.workstation.get_properties(host->simdata->host);
 
 }
 
index 388e1c2..2311d33 100644 (file)
@@ -42,7 +42,7 @@ static cpu_Cas01_t cpu_new(char *name, double power_scale,
               "Host '%s' declared several times in the platform file", name);
   cpu->generic_resource.model = surf_cpu_model;
   cpu->generic_resource.name = name;
-  current_property_set = cpu->generic_resource.properties = cpu_properties;
+  cpu->generic_resource.properties = cpu_properties;
   cpu->power_scale = power_scale;
   xbt_assert0(cpu->power_scale > 0, "Power has to be >0");
   cpu->power_current = power_initial;
index bd93581..a52ff94 100644 (file)
@@ -98,4 +98,10 @@ struct s_routing {
 };
 XBT_PUBLIC(void) routing_model_create(size_t size_of_link,void *loopback);
 
+
+/*
+ * Resource protected methods
+ */
+XBT_PUBLIC(xbt_dict_t) surf_resource_properties(const void *resource);
+
 #endif /* _SURF_SURF_PRIVATE_H */
index 92e8a9d..503b6eb 100644 (file)
@@ -255,6 +255,9 @@ static void finalize(void)
   surf_model_exit(surf_workstation_model);
   surf_workstation_model = NULL;
 }
+static xbt_dict_t get_properties(const void*ws){
+  return surf_resource_properties(((workstation_CLM03_t)ws)->cpu);
+}
 
 static void surf_workstation_model_init_internal(void)
 {
@@ -295,6 +298,7 @@ static void surf_workstation_model_init_internal(void)
   surf_workstation_model->extension.workstation.get_link_latency =
     get_link_latency;
   surf_workstation_model->extension.workstation.link_shared = link_shared;
+  surf_workstation_model->extension.workstation.get_properties = get_properties;
 }
 
 /********************************************************************/
index a1b38fa..f95cc84 100644 (file)
@@ -841,6 +841,8 @@ static void model_init_internal(void)
   surf_workstation_model->extension.workstation.get_link_latency =
     get_link_latency;
   surf_workstation_model->extension.workstation.link_shared = link_shared;
+  surf_workstation_model->extension.workstation.get_properties = surf_resource_properties;
+
 
   if (!ptask_maxmin_system)
     ptask_maxmin_system = lmm_system_new();