X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/686dec33de79ebdb24cfc595fd679b63b466bc77..a66bb361bd220a821b4f65bead824e459aa387aa:/src/surf/surf.c diff --git a/src/surf/surf.c b/src/surf/surf.c index c5012a408c..154ce3df76 100644 --- a/src/surf/surf.c +++ b/src/surf/surf.c @@ -8,20 +8,27 @@ #include "surf_private.h" #include "xbt/module.h" +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_main, surf, + "Logging specific to the SURF maxmin module"); + typedef struct surf_resource_object { surf_resource_t resource; } s_surf_resource_object_t, *surf_resource_object_t; -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_global, surf, - "Logging specific to the SURF global module"); - - static double NOW = 0; xbt_dynar_t resource_list = NULL; tmgr_history_t history = NULL; lmm_system_t maxmin_system = NULL; xbt_dynar_t surf_path = NULL; +const char *surf_action_state_names[6] = { + "SURF_ACTION_READY", + "SURF_ACTION_RUNNING", + "SURF_ACTION_FAILED", + "SURF_ACTION_DONE", + "SURF_ACTION_TO_FREE", + "SURF_ACTION_NOT_IN_THE_SYSTEM" +}; double generic_maxmin_share_resources(xbt_swag_t running_actions, size_t offset) @@ -51,7 +58,7 @@ double generic_maxmin_share_resources2(xbt_swag_t running_actions, return -1.0; if (value > 0) { - min = value = action->remains / value; + min = action->remains / value; if ((action->max_duration >= 0) && (action->max_duration < min)) min = action->max_duration; } else @@ -102,7 +109,7 @@ void surf_action_change_state(surf_action_t action, { surf_action_state_t action_state = &(action->resource_type->common_public->states); - + XBT_IN2("(%p,%s)", action, surf_action_state_names[state]); xbt_swag_remove(action, action->state_set); if (state == SURF_ACTION_READY) @@ -118,6 +125,7 @@ void surf_action_change_state(surf_action_t action, if (action->state_set) xbt_swag_insert(action, action->state_set); + XBT_OUT; } void surf_action_set_data(surf_action_t action, @@ -195,7 +203,7 @@ FILE *surf_fopen(const char *name, const char *mode) return file; } -void surf_finalize(void) +void surf_exit(void) { int i; surf_resource_t resource = NULL; @@ -224,6 +232,7 @@ void surf_finalize(void) free(path_name); path_name = NULL; } + xbt_exit(); } double surf_solve(void)