X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/bf09b292c26915b00ceefc9f5d044d8dc7288636..6a6935148284f51d20bceed365ed0edea8b5a70e:/src/surf/StorageImpl.cpp diff --git a/src/surf/StorageImpl.cpp b/src/surf/StorageImpl.cpp index 7b8980c70b..a6b13179b0 100644 --- a/src/surf/StorageImpl.cpp +++ b/src/surf/StorageImpl.cpp @@ -11,12 +11,9 @@ #include #include #include -#include XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_storage, surf, "Logging specific to the SURF storage module"); -xbt_lib_t storage_lib; -int SURF_STORAGE_LEVEL = -1; simgrid::surf::StorageModel* surf_storage_model = nullptr; namespace simgrid { @@ -71,7 +68,7 @@ StorageImpl::StorageImpl(Model* model, const char* name, lmm_system_t maxminSyst , writeActions_(std::vector()) { content_ = parseContent(content_name); - attach_ = xbt_strdup(attach); + attach_ = attach; turnOn(); XBT_DEBUG("Create resource with Bread '%f' Bwrite '%f' and Size '%llu'", bread, bwrite, size); constraintRead_ = lmm_constraint_new(maxminSystem, this, bread); @@ -82,22 +79,19 @@ StorageImpl::StorageImpl(Model* model, const char* name, lmm_system_t maxminSyst StorageImpl::~StorageImpl() { storageDestructedCallbacks(this); - if (content_ != nullptr) { - for (auto entry : *content_) - delete entry.second; + if (content_ != nullptr) delete content_; - } + free(typeId_); - free(attach_); } -std::map* StorageImpl::parseContent(const char* filename) +std::map* StorageImpl::parseContent(const char* filename) { usedSize_ = 0; if ((not filename) || (strcmp(filename, "") == 0)) return nullptr; - std::map* parse_content = new std::map(); + std::map* parse_content = new std::map(); std::ifstream* fs = surf_ifsopen(filename); @@ -112,9 +106,7 @@ std::map* StorageImpl::parseContent(const char* filenam sg_size_t size = std::stoull(tokens.at(1)); usedSize_ += size; - sg_size_t* psize = new sg_size_t; - *psize = size; - parse_content->insert({tokens.front(), psize}); + parse_content->insert({tokens.front(), size}); } } while (not fs->eof()); delete fs; @@ -147,7 +139,7 @@ void StorageImpl::turnOff() } } -std::map* StorageImpl::getContent() +std::map* StorageImpl::getContent() { /* For the moment this action has no cost, but in the future we could take in account access latency of the disk */ return content_;