From: mquinson Date: Thu, 2 Jul 2009 08:00:36 +0000 (+0000) Subject: Make sure upper layer can retrieve the properties of workstations (and that's the... X-Git-Tag: SVN~1199 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/010ea2bb6479947b8488541f925d8cda99fc72af Make sure upper layer can retrieve the properties of workstations (and that's the only properties they are interested in) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6442 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index ce16cd1cb0..288bc40905 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -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 */ diff --git a/src/simdag/sd_workstation.c b/src/simdag/sd_workstation.c index cad1f73705..6918b417b5 100644 --- a/src/simdag/sd_workstation.c +++ b/src/simdag/sd_workstation.c @@ -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); } diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index 73f4cfb730..6b851bc4da 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -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); } diff --git a/src/surf/cpu.c b/src/surf/cpu.c index 388e1c201f..2311d336c3 100644 --- a/src/surf/cpu.c +++ b/src/surf/cpu.c @@ -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; diff --git a/src/surf/surf_private.h b/src/surf/surf_private.h index bd935818eb..a52ff94aff 100644 --- a/src/surf/surf_private.h +++ b/src/surf/surf_private.h @@ -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 */ diff --git a/src/surf/workstation.c b/src/surf/workstation.c index 92e8a9dc8f..503b6eb1df 100644 --- a/src/surf/workstation.c +++ b/src/surf/workstation.c @@ -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; } /********************************************************************/ diff --git a/src/surf/workstation_ptask_L07.c b/src/surf/workstation_ptask_L07.c index a1b38faa6a..f95cc84506 100644 --- a/src/surf/workstation_ptask_L07.c +++ b/src/surf/workstation_ptask_L07.c @@ -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();