X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5873e2ce9c66711a168e9b419f0d1b6384ce1ffa..283ef6cc1f81be56f55c176f5b4c1f8f531a29e5:/src/surf/surf.c diff --git a/src/surf/surf.c b/src/surf/surf.c index 84ccf39437..a1d6ebf4ec 100644 --- a/src/surf/surf.c +++ b/src/surf/surf.c @@ -125,16 +125,11 @@ const char *surf_action_state_names[6] = { "SURF_ACTION_NOT_IN_THE_SYSTEM" }; -int surf_network_model_description_size = 3 -#ifdef HAVE_GTNETS - + 1 -#endif -#ifdef HAVE_SDP - + 1 -#endif - ; + s_surf_model_description_t surf_network_model_description[] = { + {"Constant", NULL, surf_network_model_init_Constant}, {"CM02", NULL, surf_network_model_init_CM02}, + {"LegrandVelho", NULL, surf_network_model_init_LegrandVelho}, #ifdef HAVE_GTNETS {"GTNets", NULL, surf_network_model_init_GTNETS}, #endif @@ -142,43 +137,43 @@ s_surf_model_description_t surf_network_model_description[] = { {"SDP", NULL, surf_network_model_init_SDP}, #endif {"Reno", NULL, surf_network_model_init_Reno}, - {"Vegas", NULL, surf_network_model_init_Vegas} + {"Reno2", NULL, surf_network_model_init_Reno2}, + {"Vegas", NULL, surf_network_model_init_Vegas}, + { NULL,NULL,NULL} /* this array must be NULL terminated */ }; -int surf_cpu_model_description_size = 1; s_surf_model_description_t surf_cpu_model_description[] = { {"Cas01", NULL, surf_cpu_model_init_Cas01}, + { NULL,NULL,NULL} /* this array must be NULL terminated */ }; -int surf_workstation_model_description_size = 4; s_surf_model_description_t surf_workstation_model_description[] = { - {"CLM03", NULL, surf_workstation_model_init_CLM03}, - {"KCCFLN05", NULL, surf_workstation_model_init_KCCFLN05}, - {"compound", NULL, surf_workstation_model_init_compound}, - {"ptask_L07", NULL, surf_workstation_model_init_ptask_L07} + {"CLM03", NULL, surf_workstation_model_init_CLM03, create_workstations}, + {"compound", NULL, surf_workstation_model_init_compound, create_workstations}, + {"ptask_L07", NULL, surf_workstation_model_init_ptask_L07, NULL}, + { NULL,NULL,NULL} /* this array must be NULL terminated */ }; void update_model_description(s_surf_model_description_t * table, - int table_size, - const char *name, - surf_model_t model) + const char *name, + surf_model_t model) { - int i = find_model_description(table, table_size, name); + int i = find_model_description(table, name); table[i].model = model; } int find_model_description(s_surf_model_description_t * table, - int table_size, const char *name) + const char *name) { int i; char *name_list = NULL; - for (i = 0; i < table_size; i++) + for (i = 0; table[i].name; i++) if (!strcmp(name, table[i].name)) { return i; } name_list = strdup(table[0].name); - for (i = 1; i < table_size; i++) { + for (i = 1; table[i].name; i++) { name_list = xbt_realloc(name_list, strlen(name_list) + strlen(table[i].name) + 2); @@ -221,8 +216,6 @@ double generic_maxmin_share_resources(xbt_swag_t running_actions, } else min = action->max_duration; - DEBUG5("Found action (%p: duration = %f, remains = %f, value = %f) ! %f", - action, action->max_duration, action->remains, value, min); for (action = xbt_swag_getNext(action, running_actions->offset); action; @@ -311,6 +304,24 @@ void surf_action_set_data(surf_action_t action, void *data) action->data = data; } +XBT_LOG_EXTERNAL_CATEGORY(surf_cpu); +XBT_LOG_EXTERNAL_CATEGORY(surf_kernel); +XBT_LOG_EXTERNAL_CATEGORY(surf_lagrange); +XBT_LOG_EXTERNAL_CATEGORY(surf_lagrange_dichotomy); +XBT_LOG_EXTERNAL_CATEGORY(surf_maxmin); +XBT_LOG_EXTERNAL_CATEGORY(surf_network); +XBT_LOG_EXTERNAL_CATEGORY(surf_parse); +XBT_LOG_EXTERNAL_CATEGORY(surf_timer); +XBT_LOG_EXTERNAL_CATEGORY(surf_workstation); + +#ifdef HAVE_SDP + XBT_LOG_EXTERNAL_CATEGORY(surf_sdp_out); + XBT_LOG_EXTERNAL_CATEGORY(surf_sdp); +#endif +#ifdef HAVE_GTNETS + XBT_LOG_EXTERNAL_CATEGORY(surf_network_gtnets); +#endif + void surf_init(int *argc, char **argv) { int i, j; @@ -318,6 +329,25 @@ void surf_init(int *argc, char **argv) const char *initial_path; + /* Connect our log channels: that must be done manually under windows */ + XBT_LOG_CONNECT(surf_cpu, surf); + XBT_LOG_CONNECT(surf_kernel, surf); + XBT_LOG_CONNECT(surf_lagrange, surf); + XBT_LOG_CONNECT(surf_lagrange_dichotomy, surf_lagrange); + XBT_LOG_CONNECT(surf_maxmin, surf); + XBT_LOG_CONNECT(surf_network, surf); + XBT_LOG_CONNECT(surf_parse, surf); + XBT_LOG_CONNECT(surf_timer, surf); + XBT_LOG_CONNECT(surf_workstation, surf); + +#ifdef HAVE_SDP + XBT_LOG_CONNECT(surf_sdp_out, surf); + XBT_LOG_CONNECT(surf_sdp, surf); +#endif +#ifdef HAVE_GTNETS + XBT_LOG_CONNECT(surf_network_gtnets, surf); +#endif + xbt_init(argc, argv); if (!surf_path) { @@ -427,20 +457,14 @@ void surf_exit(void) xbt_exit(); } -double surf_solve(void) -{ - static int first_run = 1; - - double min = -1.0; +void surf_presolve(void) { double next_event_date = -1.0; - double model_next_action_end = -1.0; + tmgr_trace_event_t event = NULL; double value = -1.0; surf_model_object_t model_obj = NULL; surf_model_t model = NULL; - tmgr_trace_event_t event = NULL; unsigned int iter; - - if (first_run) { + DEBUG0 ("First Run! Let's \"purge\" events and put models in the right state"); while ((next_event_date = tmgr_history_next_date(history)) != -1.0) { @@ -451,15 +475,24 @@ double surf_solve(void) &value, (void **) &model_obj))) { model_obj->model->common_private-> - update_resource_state(model_obj, event, value); + update_resource_state(model_obj, event, value,NOW); } } xbt_dynar_foreach(model_list, iter, model) { model->common_private->update_actions_state(NOW, 0.0); } - first_run = 0; - return 0.0; - } +} + +double surf_solve(void) +{ + double min = -1.0; + double next_event_date = -1.0; + double model_next_action_end = -1.0; + double value = -1.0; + surf_model_object_t model_obj = NULL; + surf_model_t model = NULL; + tmgr_trace_event_t event = NULL; + unsigned int iter; min = -1.0; @@ -499,7 +532,7 @@ double surf_solve(void) /* update state of model_obj according to new value. Does not touch lmm. It will be modified if needed when updating actions */ model_obj->model->common_private-> - update_resource_state(model_obj, event, value); + update_resource_state(model_obj, event, value,NOW+min); } }