From: Pierre Veyre Date: Thu, 20 Feb 2014 09:04:49 +0000 (+0100) Subject: Introduce model specific properties for storage_type X-Git-Tag: v3_11_beta~13 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/22ba465f862e53b6910362d9fb4369a4bbc034db Introduce model specific properties for storage_type --- diff --git a/doc/doxygen/platform.doc b/doc/doxygen/platform.doc index c2712b6756..5564c834df 100644 --- a/doc/doxygen/platform.doc +++ b/doc/doxygen/platform.doc @@ -609,14 +609,26 @@ find /path/you/want -type f -exec ls -l {} \; 2>/dev/null > ./content.txt \li content: default value 0. The file containing the disk content. (may be moved soon or later to storage tag. -The tag must contains some predefined prop, as may do some other -resources tags. This should moved to attributes soon or later. -storage_type mandatory prop : +The tag must contains some predefined model prop, as may do some other +resources tags. +storage_type mandatory model_prop : \li Bwrite: value in B/s. Write throughput \li Bread: value in B/s. Read throughput \li Bconnexion: value in B/s. Connection throughput (i.e. the throughput of the storage connector). +A storage_type can also contain the prop 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. + + + + + + + + \subsubsection pf_sto_st storage storage_type attributes : diff --git a/examples/platforms/storage.xml b/examples/platforms/storage.xml index 7ee2c200cd..7f755de7d1 100644 --- a/examples/platforms/storage.xml +++ b/examples/platforms/storage.xml @@ -12,15 +12,15 @@ - - - + + + - - - + + + diff --git a/include/simgrid/platf.h b/include/simgrid/platf.h index 9ba24217e9..f3619f3bd5 100644 --- a/include/simgrid/platf.h +++ b/include/simgrid/platf.h @@ -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; diff --git a/include/xbt/graphxml.h b/include/xbt/graphxml.h index ed96e74d6d..6c925086b6 100644 --- a/include/xbt/graphxml.h +++ b/include/xbt/graphxml.h @@ -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); diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 2a230ce698..b243c912f2 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -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); diff --git a/src/surf/simgrid.dtd b/src/surf/simgrid.dtd index a55762ef47..6438fc4fd4 100644 --- a/src/surf/simgrid.dtd +++ b/src/surf/simgrid.dtd @@ -29,7 +29,7 @@ - + @@ -171,3 +171,7 @@ + + + + diff --git a/src/surf/storage_interface.hpp b/src/surf/storage_interface.hpp index b014d25f8e..bd0cd4f176 100644 --- a/src/surf/storage_interface.hpp +++ b/src/surf/storage_interface.hpp @@ -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; diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index 7146a711c4..63a8d0a73a 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -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); } diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 9ed3fd5422..6c757e587c 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -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 */ diff --git a/teshsuite/msg/storage/platform.xml b/teshsuite/msg/storage/platform.xml index caec3dabcd..e62f3a0e99 100644 --- a/teshsuite/msg/storage/platform.xml +++ b/teshsuite/msg/storage/platform.xml @@ -5,22 +5,22 @@ - - - + + + - - - + + + - - - + + +