X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/90750b2b8f84e51c766470561fbaed1de51e91b0..688697437ee29632f93998b1d41fcc0f8cb9faee:/src/surf/workstation_KCCFLN05.c diff --git a/src/surf/workstation_KCCFLN05.c b/src/surf/workstation_KCCFLN05.c index f6a709e265..c91ad04542 100644 --- a/src/surf/workstation_KCCFLN05.c +++ b/src/surf/workstation_KCCFLN05.c @@ -9,7 +9,7 @@ #include "xbt/dict.h" #include "workstation_KCCFLN05_private.h" -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(workstation_KCCFLN05, surf, +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_workstation, surf, "Logging specific to the SURF workstation module (KCCFLN05)"); static int nb_workstation = 0; @@ -17,7 +17,7 @@ static s_route_KCCFLN05_t *routing_table = NULL; #define ROUTE(i,j) routing_table[(i)+(j)*nb_workstation] static network_link_KCCFLN05_t loopback = NULL; -static xbt_dict_t network_link_set = NULL; +/*xbt_dict_t network_link_set = NULL;*/ /* convenient function */ static void __update_cpu_usage(cpu_KCCFLN05_t cpu) @@ -466,6 +466,11 @@ static double get_speed(void *cpu, double load) return load*(((cpu_KCCFLN05_t) cpu)->power_scale); } +static double get_available_speed(void *cpu) +{ + return ((cpu_KCCFLN05_t) cpu)->power_current; +} + static surf_action_t communicate(void *src, void *dst, double size, double rate) { surf_action_workstation_KCCFLN05_t action = NULL; @@ -555,6 +560,19 @@ static surf_action_t execute_parallel_task(int cpu_nb, return NULL; } +/* returns a NULL-terminated array of network_link_KCCFLN05_t */ +static const void** get_route(void *src, void *dst) { + cpu_KCCFLN05_t card_src = src; + cpu_KCCFLN05_t card_dst = dst; + route_KCCFLN05_t route = &(ROUTE(card_src->id, card_dst->id)); + int route_size = route->size; + + /* add NULL at the end of the array if not present */ + route->links = xbt_realloc(route->links, (route_size+1) * sizeof(route_KCCFLN05_t)); + route->links[route_size] = NULL; + + return (const void**) route->links; +} /**************************************/ /*** Resource Creation & Destruction **/ @@ -902,8 +920,10 @@ static void resource_init_internal(void) surf_workstation_resource->extension_public->sleep = action_sleep; surf_workstation_resource->extension_public->get_state = resource_get_state; surf_workstation_resource->extension_public->get_speed = get_speed; + surf_workstation_resource->extension_public->get_available_speed = get_available_speed; surf_workstation_resource->extension_public->communicate = communicate; surf_workstation_resource->extension_public->execute_parallel_task = execute_parallel_task; + surf_workstation_resource->extension_public->get_route = get_route; workstation_set = xbt_dict_new(); network_link_set = xbt_dict_new();