Mailbox::getCname() instead to get a char*.
- Storage::getName() changed to return a std::string, use
Storage::getCname() instead to get a char*.
+ - simgrid::s4u::allStorages() becomes
+ simgrid::s4u::getStorageList(whereTo) to have both allocation
+ and deallocation of the map in user space.
MSG
- Deprecate MSG_task_get_flops_amount(). Its semantic was weird:
e.loadPlatform(argv[1]);
e.registerFunction("host", host);
e.loadDeployment(argv[2]);
- std::map<std::string, simgrid::s4u::Storage*>* allStorages = simgrid::s4u::allStorages();
+ std::map<std::string, simgrid::s4u::Storage*>* allStorages = new std::map<std::string, simgrid::s4u::Storage*>;
+ simgrid::s4u::getStorageList(allStorages);
for (auto const& s : *allStorages) {
XBT_INFO("Init: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s.second) / INMEGA,
}
namespace s4u {
-XBT_ATTRIB_PUBLIC std::map<std::string, Storage*>* allStorages();
+XBT_ATTRIB_PUBLIC void getStorageList(std::map<std::string, Storage*>* whereTo);
XBT_PUBLIC_CLASS Storage : public simgrid::xbt::Extendable<Storage>
{
*/
xbt_dynar_t MSG_storages_as_dynar()
{
- std::map<std::string, simgrid::s4u::Storage*>* storage_map = simgrid::s4u::allStorages();
+ std::map<std::string, simgrid::s4u::Storage*>* storage_list = new std::map<std::string, simgrid::s4u::Storage*>;
+ simgrid::s4u::getStorageList(storage_list);
xbt_dynar_t res = xbt_dynar_new(sizeof(msg_storage_t),nullptr);
- for (auto const& s : *storage_map)
+ for (auto const& s : *storage_list)
xbt_dynar_push(res, &(s.second));
- delete storage_map;
+ delete storage_list;
return res;
}
namespace s4u {
-std::map<std::string, Storage*>* allStorages()
+void getStorageList(std::map<std::string, Storage*>* whereTo)
{
- std::unordered_map<std::string, surf::StorageImpl*>* map = surf::StorageImpl::storagesMap();
- std::map<std::string, Storage*>* res = new std::map<std::string, Storage*>;
- for (auto const& s : *map)
- res->insert({s.first, &(s.second->piface_)}); // Convert each entry into its interface
-
- return res;
+ for (auto const& s : *surf::StorageImpl::storagesMap())
+ whereTo->insert({s.first, &(s.second->piface_)}); // Convert each entry into its interface
}
Storage* Storage::byName(std::string name)
static void dump_platform_storages()
{
- std::map<std::string, simgrid::s4u::Storage*>* storages = simgrid::s4u::allStorages();
+ std::map<std::string, simgrid::s4u::Storage*>* storages = new std::map<std::string, simgrid::s4u::Storage*>;
+ simgrid::s4u::getStorageList(storages);
for (auto const& storage : *storages) {
XBT_INFO("Storage %s is attached to %s", storage.first.c_str(), storage.second->getHost()->getCname());