- for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end())
- ; it != itend ; it=itNext) {
- ++itNext;
- action = static_cast<StorageAction*>(&*it);
-
- if(action->m_type == WRITE){
- // Update the disk usage
- // Update the file size
- // For each action of type write
- double current_progress =
- delta * lmm_variable_getvalue(action->getVariable());
- long int incr = current_progress;
-
- XBT_DEBUG("%s:\n\t progress = %.2f, current_progress = %.2f, incr = %ld, lrint(1) = %ld, lrint(2) = %ld",
- action->p_file->name,
- action->progress, current_progress, incr,
- lrint(action->progress + current_progress),
- lrint(action->progress)+ incr);
-
- /* take care of rounding error accumulation */
- if (lrint(action->progress + current_progress) > lrint(action->progress)+ incr)
- incr++;
-
- action->progress +=current_progress;
-
- action->p_storage->usedSize_ += incr; // disk usage
- action->p_file->current_position+= incr; // current_position
- // which becomes the new file size
- action->p_file->size = action->p_file->current_position ;
-
- sg_size_t *psize = xbt_new(sg_size_t,1);
- *psize = action->p_file->size;
- xbt_dict_t content_dict = action->p_storage->content_;
- xbt_dict_set(content_dict, action->p_file->name, psize, nullptr);
+ ActionList::iterator it(actionSet->begin());
+ ActionList::iterator itend(actionSet->end());
+ while (it != itend) {
+ StorageAction *action = static_cast<StorageAction*>(&*it);
+ ++it;
+ double current_progress = lrint(lmm_variable_getvalue(action->getVariable()) * delta);
+
+ action->updateRemains(current_progress);
+ if (action->type_ == WRITE) {
+ action->storage_->usedSize_ += current_progress;
+ action->file_->incrPosition(current_progress);
+ action->file_->setSize(action->file_->tell());
+
+ action->storage_->getContent()->erase(action->file_->getCname());
+ action->storage_->getContent()->insert({action->file_->getCname(), action->file_->size()});