static xbt_dict_t parse_storage_content(char *filename, unsigned long *used_size);
static void storage_action_state_set(surf_action_t action, e_surf_action_state_t state);
-static surf_action_t storage_action_execute (void *storage, size_t size, e_surf_action_storage_type_t type);
+static surf_action_t storage_action_execute (void *storage, double size, e_surf_action_storage_type_t type);
static surf_action_t storage_action_stat(void *storage, surf_file_t stream)
{
static surf_action_t storage_action_close(void *storage, surf_file_t fp)
{
char *filename = fp->name;
- XBT_DEBUG("\tClose file '%s' size '%ld'",filename,fp->content->stat.size);
+ XBT_DEBUG("\tClose file '%s' size '%f'",filename,fp->content->stat.size);
free(fp->name);
fp->content = NULL;
xbt_free(fp);
return action;
}
-static surf_action_t storage_action_read(void *storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream)
+static surf_action_t storage_action_read(void *storage, void* ptr, double size, size_t nmemb, surf_file_t stream)
{
- char *filename = stream->name;
surf_stat_t content = stream->content;
- XBT_DEBUG("\tRead file '%s' size '%zu/%zu'",filename,size,content->stat.size);
if(size > content->stat.size)
size = content->stat.size;
surf_action_t action = storage_action_execute(storage,size,READ);
{
char *filename = stream->name;
surf_stat_t content = stream->content;
- XBT_DEBUG("\tWrite file '%s' size '%zu/%zu'",filename,size,content->stat.size);
+ XBT_DEBUG("\tWrite file '%s' size '%zu/%f'",filename,size,content->stat.size);
surf_action_t action = storage_action_execute(storage,size,WRITE);
action->file = stream;
return action;
}
-static surf_action_t storage_action_execute (void *storage, size_t size, e_surf_action_storage_type_t type)
+static surf_action_t storage_action_execute (void *storage, double size, e_surf_action_storage_type_t type)
{
surf_action_storage_t action = NULL;
storage_t STORAGE = storage;
- XBT_IN("(%s,%zu)", surf_resource_name(STORAGE), size);
+ XBT_IN("(%s,%f)", surf_resource_name(STORAGE), size);
action =
surf_action_new(sizeof(s_surf_action_storage_t), size, surf_storage_model,
STORAGE->state_current != SURF_RESOURCE_ON);
}
xbt_swag_foreach_safe(action, next_action, running_actions) {
+
double_update(&(GENERIC_ACTION(action).remains),
lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable) * delta);
+
if (GENERIC_LMM_ACTION(action).generic_action.max_duration != NO_MAX_DURATION)
double_update(&(GENERIC_ACTION(action).max_duration), delta);
+
if(GENERIC_ACTION(action).remains > 0 &&
lmm_get_variable_weight(GENERIC_LMM_ACTION(action).variable) > 0 &&
- ((storage_t)action->storage)->used_size == ((storage_t)action->storage)->size) {
+ ((storage_t)action->storage)->used_size == ((storage_t)action->storage)->size)
+ {
GENERIC_ACTION(action).finish = surf_get_clock();
storage_action_state_set((surf_action_t) action, SURF_ACTION_FAILED);
- } else
- if ((GENERIC_ACTION(action).remains <= 0) &&
- (lmm_get_variable_weight(GENERIC_LMM_ACTION(action).variable) > 0)) {
+ } else if ((GENERIC_ACTION(action).remains <= 0) &&
+ (lmm_get_variable_weight(GENERIC_LMM_ACTION(action).variable) > 0))
+ {
GENERIC_ACTION(action).finish = surf_get_clock();
storage_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
} else if ((GENERIC_ACTION(action).max_duration != NO_MAX_DURATION) &&
- (GENERIC_ACTION(action).max_duration <= 0)) {
+ (GENERIC_ACTION(action).max_duration <= 0))
+ {
GENERIC_ACTION(action).finish = surf_get_clock();
storage_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
}
char time[12];
char path[1024];
int nb;
- long size;
+ unsigned long size;
surf_stat_t content;