long dataset_number(std::string& host_name, std::string storage_type){ /** Returns a number of dataset on a given storage. Parameters: ---------- @host_name -- name of host @storage_type -- DISK or TAPE */ std::string storage_name = host_name + storage_type; msg_storage_t st = MSG_storage_get_by_name(storage_name.c_str()); xbt_dict_cursor_t cursor = NULL; char *key; double data; long amount = 0; xbt_dict_t storage_content = MSG_storage_get_content(st); xbt_dict_foreach(storage_content, cursor, key, data){ amount++; } xbt_dict_free(&storage_content); xbt_dict_cursor_free(&cursor); return amount; }
static void display_storage_content(msg_storage_t storage){ XBT_INFO("Print the content of the storage element: %s",MSG_storage_get_name(storage)); xbt_dict_cursor_t cursor = NULL; char *file; sg_size_t *psize; xbt_dict_t content = MSG_storage_get_content(storage); if (content){ xbt_dict_foreach(content, cursor, file, psize) XBT_INFO("\t%s size: %llu bytes", file, *psize); } else { XBT_INFO("\tNo content."); } xbt_dict_free(&content); }