Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Introduce model specific properties for storage_type
authorPierre Veyre <pierre.veyre@cc.in2p3.fr>
Thu, 20 Feb 2014 09:04:49 +0000 (10:04 +0100)
committerPierre Veyre <pierre.veyre@cc.in2p3.fr>
Thu, 20 Feb 2014 09:04:49 +0000 (10:04 +0100)
doc/doxygen/platform.doc
examples/platforms/storage.xml
include/simgrid/platf.h
include/xbt/graphxml.h
src/include/surf/surf.h
src/surf/simgrid.dtd
src/surf/storage_interface.hpp
src/surf/storage_n11.cpp
src/surf/surfxml_parse.c
teshsuite/msg/storage/platform.xml

index c2712b6..5564c83 100644 (file)
@@ -609,14 +609,26 @@ find /path/you/want -type f -exec ls -l {} \; 2>/dev/null > ./content.txt
 \li <b>content</b>: default value 0. The file containing the disk
     content. (may be moved soon or later to <b>storage</b> tag. 
 
-The tag must contains some predefined prop, as may do some other
-resources tags. This should moved to attributes soon or later. 
-<b>storage_type</b> mandatory <b>prop</b> :
+The tag must contains some predefined model prop, as may do some other
+resources tags.
+<b>storage_type</b> mandatory <b>model_prop</b> :
 \li <b>Bwrite</b>: value in B/s. Write throughput
 \li <b>Bread</b>: value in B/s. Read throughput
 \li <b>Bconnexion</b>: value in B/s. Connection throughput (i.e. the
     throughput of the storage connector). 
 
+A storage_type can also contain the <b>prop</b> tag. The prop tag allows you
+to define additional information on this storage_type following the
+attribute/value schema. You may want to use it to give information to
+the tool you use for rendering your simulation, for example.
+
+<storage_type id="single_HDD" model="linear_no_lat" size="4000" content_type="txt_unix">
+  <model_prop id="Bwrite" value="30MBps" />
+  <model_prop id="Bread" value="100MBps" />
+  <model_prop id="Bconnection" value="150MBps" />
+  <b><prop id="Brand" value="Western Digital" /></b>
+</storage_type>
+
 \subsubsection pf_sto_st storage
 
 <b>storage_type</b> attributes :
index 7ee2c20..7f755de 100644 (file)
    <storage_type id="single_HDD" model="linear_no_lat" 
                  content="content/storage_content.txt" size="500GiB"
                  content_type="txt_unix">
-      <prop id="Bwrite" value="30MBps" />
-      <prop id="Bread" value="100MBps" />
-      <prop id="Bconnection" value="120MBps" />
+      <model_prop id="Bwrite" value="30MBps" />
+      <model_prop id="Bread" value="100MBps" />
+      <model_prop id="Bconnection" value="120MBps" />
    </storage_type>
 
    <storage_type id="single_SSD" model="linear_no_lat" size="500GiB">
-      <prop id="Bwrite" value="60MBps" />
-      <prop id="Bread" value="200MBps" />
-      <prop id="Bconnection" value="220MBps" />
+      <model_prop id="Bwrite" value="60MBps" />
+      <model_prop id="Bread" value="200MBps" />
+      <model_prop id="Bconnection" value="220MBps" />
    </storage_type>
 
     <storage id="Disk1" typeId="single_HDD" />
index 9ba2421..f3619f3 100644 (file)
@@ -251,6 +251,7 @@ typedef struct {
   const char* content;
   const char* content_type;
   xbt_dict_t properties;
+  xbt_dict_t model_properties;
   sg_size_t size;
 } s_sg_platf_storage_type_cbarg_t, *sg_platf_storage_type_cbarg_t;
 
index ed96e74..6c92508 100644 (file)
@@ -56,70 +56,70 @@ XBT_PUBLIC(void) STag_graphxml_edge(void);
 XBT_PUBLIC(void) ETag_graphxml_edge(void);
 
 /* XML application data. */
+typedef int AT_graphxml_node_name;
+#define AU_graphxml_node_name NULL
 typedef int AT_graphxml_edge_source;
 #define AU_graphxml_edge_source NULL
-typedef int AT_graphxml_edge_length;
-#define AU_graphxml_edge_length NULL
+typedef int AT_graphxml_node_position___y;
+#define AU_graphxml_node_position___y NULL
 typedef int AT_graphxml_node_position___x;
 #define AU_graphxml_node_position___x NULL
+typedef int AT_graphxml_edge_data;
+#define AU_graphxml_edge_data NULL
+typedef int AT_graphxml_edge_target;
+#define AU_graphxml_edge_target NULL
 typedef enum { AU_graphxml_graph_isDirected, A_graphxml_graph_isDirected_true,A_graphxml_graph_isDirected_false } AT_graphxml_graph_isDirected;
+typedef int AT_graphxml_node_label;
+#define AU_graphxml_node_label NULL
 typedef int AT_graphxml_node_data;
 #define AU_graphxml_node_data NULL
-typedef int AT_graphxml_edge_name;
-#define AU_graphxml_edge_name NULL
-typedef int AT_graphxml_node_name;
-#define AU_graphxml_node_name NULL
 typedef int AT_graphxml_edge_label;
 #define AU_graphxml_edge_label NULL
-typedef int AT_graphxml_node_position___y;
-#define AU_graphxml_node_position___y NULL
-typedef int AT_graphxml_edge_target;
-#define AU_graphxml_edge_target NULL
-typedef int AT_graphxml_edge_data;
-#define AU_graphxml_edge_data NULL
-typedef int AT_graphxml_node_label;
-#define AU_graphxml_node_label NULL
+typedef int AT_graphxml_edge_length;
+#define AU_graphxml_edge_length NULL
+typedef int AT_graphxml_edge_name;
+#define AU_graphxml_edge_name NULL
 
 /* FleXML-provided data. */
 XBT_PUBLIC_DATA(int) graphxml_pcdata_ix;
 XBT_PUBLIC_DATA(char *) graphxml_bufferstack;
 #define graphxml_pcdata (graphxml_bufferstack + graphxml_pcdata_ix)
+XBT_PUBLIC_DATA(AT_graphxml_node_name) AX_graphxml_node_name;
+#define A_graphxml_node_name (graphxml_bufferstack + AX_graphxml_node_name)
+XBT_PUBLIC_DATA(short int) graphxml_node_name_isset;
 XBT_PUBLIC_DATA(AT_graphxml_edge_source) AX_graphxml_edge_source;
 #define A_graphxml_edge_source (graphxml_bufferstack + AX_graphxml_edge_source)
 XBT_PUBLIC_DATA(short int) graphxml_edge_source_isset;
-XBT_PUBLIC_DATA(AT_graphxml_edge_length) AX_graphxml_edge_length;
-#define A_graphxml_edge_length (graphxml_bufferstack + AX_graphxml_edge_length)
-XBT_PUBLIC_DATA(short int) graphxml_edge_length_isset;
+XBT_PUBLIC_DATA(AT_graphxml_node_position___y) AX_graphxml_node_position___y;
+#define A_graphxml_node_position___y (graphxml_bufferstack + AX_graphxml_node_position___y)
+XBT_PUBLIC_DATA(short int) graphxml_node_position___y_isset;
 XBT_PUBLIC_DATA(AT_graphxml_node_position___x) AX_graphxml_node_position___x;
 #define A_graphxml_node_position___x (graphxml_bufferstack + AX_graphxml_node_position___x)
 XBT_PUBLIC_DATA(short int) graphxml_node_position___x_isset;
+XBT_PUBLIC_DATA(AT_graphxml_edge_data) AX_graphxml_edge_data;
+#define A_graphxml_edge_data (graphxml_bufferstack + AX_graphxml_edge_data)
+XBT_PUBLIC_DATA(short int) graphxml_edge_data_isset;
+XBT_PUBLIC_DATA(AT_graphxml_edge_target) AX_graphxml_edge_target;
+#define A_graphxml_edge_target (graphxml_bufferstack + AX_graphxml_edge_target)
+XBT_PUBLIC_DATA(short int) graphxml_edge_target_isset;
 XBT_PUBLIC_DATA(AT_graphxml_graph_isDirected) AX_graphxml_graph_isDirected;
 #define A_graphxml_graph_isDirected AX_graphxml_graph_isDirected
 XBT_PUBLIC_DATA(short int) graphxml_graph_isDirected_isset;
+XBT_PUBLIC_DATA(AT_graphxml_node_label) AX_graphxml_node_label;
+#define A_graphxml_node_label (graphxml_bufferstack + AX_graphxml_node_label)
+XBT_PUBLIC_DATA(short int) graphxml_node_label_isset;
 XBT_PUBLIC_DATA(AT_graphxml_node_data) AX_graphxml_node_data;
 #define A_graphxml_node_data (graphxml_bufferstack + AX_graphxml_node_data)
 XBT_PUBLIC_DATA(short int) graphxml_node_data_isset;
-XBT_PUBLIC_DATA(AT_graphxml_edge_name) AX_graphxml_edge_name;
-#define A_graphxml_edge_name (graphxml_bufferstack + AX_graphxml_edge_name)
-XBT_PUBLIC_DATA(short int) graphxml_edge_name_isset;
-XBT_PUBLIC_DATA(AT_graphxml_node_name) AX_graphxml_node_name;
-#define A_graphxml_node_name (graphxml_bufferstack + AX_graphxml_node_name)
-XBT_PUBLIC_DATA(short int) graphxml_node_name_isset;
 XBT_PUBLIC_DATA(AT_graphxml_edge_label) AX_graphxml_edge_label;
 #define A_graphxml_edge_label (graphxml_bufferstack + AX_graphxml_edge_label)
 XBT_PUBLIC_DATA(short int) graphxml_edge_label_isset;
-XBT_PUBLIC_DATA(AT_graphxml_node_position___y) AX_graphxml_node_position___y;
-#define A_graphxml_node_position___y (graphxml_bufferstack + AX_graphxml_node_position___y)
-XBT_PUBLIC_DATA(short int) graphxml_node_position___y_isset;
-XBT_PUBLIC_DATA(AT_graphxml_edge_target) AX_graphxml_edge_target;
-#define A_graphxml_edge_target (graphxml_bufferstack + AX_graphxml_edge_target)
-XBT_PUBLIC_DATA(short int) graphxml_edge_target_isset;
-XBT_PUBLIC_DATA(AT_graphxml_edge_data) AX_graphxml_edge_data;
-#define A_graphxml_edge_data (graphxml_bufferstack + AX_graphxml_edge_data)
-XBT_PUBLIC_DATA(short int) graphxml_edge_data_isset;
-XBT_PUBLIC_DATA(AT_graphxml_node_label) AX_graphxml_node_label;
-#define A_graphxml_node_label (graphxml_bufferstack + AX_graphxml_node_label)
-XBT_PUBLIC_DATA(short int) graphxml_node_label_isset;
+XBT_PUBLIC_DATA(AT_graphxml_edge_length) AX_graphxml_edge_length;
+#define A_graphxml_edge_length (graphxml_bufferstack + AX_graphxml_edge_length)
+XBT_PUBLIC_DATA(short int) graphxml_edge_length_isset;
+XBT_PUBLIC_DATA(AT_graphxml_edge_name) AX_graphxml_edge_name;
+#define A_graphxml_edge_name (graphxml_bufferstack + AX_graphxml_edge_name)
+XBT_PUBLIC_DATA(short int) graphxml_edge_name_isset;
 
 /* XML application utilities. */
 XBT_PUBLIC(int) graphxml_element_context(int);
index 2a230ce..b243c91 100644 (file)
@@ -1267,6 +1267,9 @@ XBT_PUBLIC(void) surf_exit(void);
 /* Prototypes of the functions that handle the properties */
 XBT_PUBLIC_DATA(xbt_dict_t) current_property_set;       /* the prop set for the currently parsed element (also used in SIMIX) */
 
+/* The same for model_prop set*/
+XBT_PUBLIC_DATA(xbt_dict_t) current_model_property_set;
+
 /* surf parse file related (public because called from a test suite) */
 XBT_PUBLIC(void) parse_platform_file(const char *file);
 
index a55762e..6438fc4 100644 (file)
@@ -29,7 +29,7 @@
 <!ATTLIST AS id CDATA #REQUIRED>
 <!ATTLIST AS routing (Full|Floyd|Dijkstra|DijkstraCache|None|Vivaldi|Cluster|Cluster_torus) #REQUIRED>
 
-<!ELEMENT storage_type (prop*)>
+<!ELEMENT storage_type ((model_prop|prop)*)>
 <!ATTLIST storage_type id       CDATA #REQUIRED>
 <!ATTLIST storage_type model    CDATA #REQUIRED>
 <!ATTLIST storage_type size     CDATA #REQUIRED>
 <!ELEMENT prop EMPTY>
 <!ATTLIST prop id CDATA #REQUIRED> <!-- <!ATTLIST prop key CDATA #REQUIRED> -->
 <!ATTLIST prop value CDATA #REQUIRED>
+
+<!ELEMENT model_prop EMPTY>
+<!ATTLIST model_prop id CDATA #REQUIRED> <!-- <!ATTLIST model_prop key CDATA #REQUIRED> -->
+<!ATTLIST model_prop value CDATA #REQUIRED>
index b014d25..bd0cd4f 100644 (file)
@@ -112,6 +112,7 @@ public:
    * @param content_name [description]
    * @param content_type [description]
    * @param size [description]
+   * @param model_props Dictionary of model specific properties associated to this Storage
    */
   Storage(ModelPtr model, const char *name, xbt_dict_t props,
           const char* type_id, char *content_name, char *content_type,
@@ -307,6 +308,7 @@ typedef struct s_storage_type {
   char *content_type;
   char *type_id;
   xbt_dict_t properties;
+  xbt_dict_t model_properties;
   sg_size_t size;
 } s_storage_type_t, *storage_type_t;
 
index 7146a71..63a8d0a 100644 (file)
@@ -24,7 +24,7 @@ static XBT_INLINE void routing_storage_type_free(void *r)
   free(stype->content);
   free(stype->content_type);
   xbt_dict_free(&(stype->properties));
-  xbt_dict_free(&(stype->properties));
+  xbt_dict_free(&(stype->model_properties));
   free(stype);
 }
 
@@ -60,7 +60,7 @@ static void parse_storage_init(sg_platf_storage_cbarg_t storage)
 
   XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s' "
       "\n\t\tmodel '%s' \n\t\tcontent '%s'\n\t\tcontent_type '%s' "
-      "\n\t\tproperties '%p'\n",
+      "\n\t\tproperties '%p''\n",
       storage->id,
       ((storage_type_t) stype)->model,
       ((storage_type_t) stype)->type_id,
@@ -124,6 +124,7 @@ static void storage_parse_storage_type(sg_platf_storage_type_cbarg_t storage_typ
   stype->content_type = xbt_strdup(storage_type->content_type);
   stype->type_id = xbt_strdup(storage_type->id);
   stype->size = storage_type->size;
+  stype->model_properties = storage_type->model_properties;
 
   XBT_DEBUG("ROUTING Create a storage type id '%s' with model '%s', "
       "content '%s', and content_type '%s'",
@@ -242,9 +243,9 @@ StoragePtr StorageN11Model::createResource(const char* id, const char* type_id,
 
   storage_type_t storage_type = (storage_type_t) xbt_lib_get_or_null(storage_type_lib, type_id,ROUTING_STORAGE_TYPE_LEVEL);
 
-  double Bread  = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->properties, "Bread"));
-  double Bwrite = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->properties, "Bwrite"));
-  double Bconnection   = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->properties, "Bconnection"));
+  double Bread  = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bread"));
+  double Bwrite = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bwrite"));
+  double Bconnection   = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bconnection"));
 
   StoragePtr storage = new StorageN11(this, id, properties, p_maxminSystem,
                  Bread, Bwrite, Bconnection,
@@ -317,7 +318,6 @@ void StorageN11Model::updateActionsState(double /*now*/, double delta)
 
       sg_size_t *psize = xbt_new(sg_size_t,1);
       *psize = action->p_file->size;
-
       xbt_dict_t content_dict = action->p_storage->p_content;
       xbt_dict_set(content_dict, action->p_file->name, psize, NULL);
     }
index 9ed3fd5..6c757e5 100644 (file)
@@ -203,6 +203,7 @@ double surf_parse_get_power(const char *string)
 
 /* The default current property receiver. Setup in the corresponding opening callbacks. */
 xbt_dict_t current_property_set = NULL;
+xbt_dict_t current_model_property_set = NULL;
 xbt_dict_t as_current_property_set = NULL;
 int AS_TAG = 0;
 char* as_name_tab[1024];
@@ -246,6 +247,7 @@ void STag_surfxml_storage___type(void)
   AS_TAG = 0;
   XBT_DEBUG("STag_surfxml_storage___type");
   xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
+  xbt_assert(current_model_property_set == NULL, "Someone forgot to reset the model property set to NULL in its closing tag (or XML malformed)");
 }
 void ETag_surfxml_storage___type(void)
 {
@@ -257,9 +259,11 @@ void ETag_surfxml_storage___type(void)
   storage_type.id = A_surfxml_storage___type_id;
   storage_type.model = A_surfxml_storage___type_model;
   storage_type.properties = current_property_set;
+  storage_type.model_properties = current_model_property_set;
   storage_type.size = surf_parse_get_size(A_surfxml_storage___type_size);
   sg_platf_new_storage_type(&storage_type);
   current_property_set = NULL;
+  current_model_property_set = NULL;
 }
 void STag_surfxml_mstorage(void)
 {
@@ -945,6 +949,13 @@ void STag_surfxml_argument(void){
   argv[(argc) - 1] = xbt_strdup(A_surfxml_argument_value);
 }
 
+void STag_surfxml_model___prop(void){
+  if (!current_model_property_set)
+    current_model_property_set = xbt_dict_new_homogeneous(xbt_free_f);
+
+  xbt_dict_set(current_model_property_set, A_surfxml_model___prop_id, xbt_strdup(A_surfxml_model___prop_value), NULL);
+}
+
 /* ***************************************** */
 /* TUTORIAL: New TAG                         */
 void STag_surfxml_gpu(void)
@@ -975,6 +986,7 @@ void ETag_surfxml_peer(void){}
 void STag_surfxml_backbone(void){}
 void ETag_surfxml_link___ctn(void){}
 void ETag_surfxml_argument(void){}
+void ETag_surfxml_model___prop(void){}
 
 /* Open and Close parse file */
 
index caec3da..e62f3a0 100644 (file)
@@ -5,22 +5,22 @@
        <AS id="AS0" routing="Full">
                <!-- STORAGE TYPES -->
                <storage_type id="crucial" model="SSD" size="500">
-                       <prop id="Bwrite" value="30000000" /> <!-- 30Mo/s -->
-                       <prop id="Bread" value="100000000" /> <!-- 100Mo/s -->
-                       <prop id="Bconnection" value="150000000" /> <!-- 150Mo/s -->
+                       <model_prop id="Bwrite" value="30000000" /> <!-- 30Mo/s -->
+                       <model_prop id="Bread" value="100000000" /> <!-- 100Mo/s -->
+                       <model_prop id="Bconnection" value="150000000" /> <!-- 150Mo/s -->
                </storage_type>
 
                <storage_type id="single_HDD" model="linear_no_lat" size="500GiB" content_type="txt_unix">
-                       <prop id="Bwrite" value="30MBps" />
-                       <prop id="Bread" value="100MBps" />
-                       <prop id="Bconnection" value="150MBps" />
+                       <model_prop id="Bwrite" value="30MBps" />
+                       <model_prop id="Bread" value="100MBps" />
+                       <model_prop id="Bconnection" value="150MBps" />
                </storage_type>
 
                <storage_type id="single_SSD" model="linear_no_lat"
                        content="content/storage_content.txt" size="500GiB">
-                       <prop id="Bwrite" value="30MBps" />
-                       <prop id="Bread" value="100MBps" />
-                       <prop id="Bconnection" value="150MBps" />
+                       <model_prop id="Bwrite" value="30MBps" />
+                       <model_prop id="Bread" value="100MBps" />
+                       <model_prop id="Bconnection" value="150MBps" />
                </storage_type>
 
                <!-- DISKS -->