/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include <algorithm>
#include <vector>
#include "simgrid/host.h"
// ========= storage related functions ============
xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host){
- return host->pimpl_->getMountedStorageList();
+ xbt_assert((host != nullptr), "Invalid parameters");
+ xbt_dict_t res = xbt_dict_new_homogeneous(nullptr);
+ for (auto elm : host->mountedStorages()) {
+ const char* mount_name = elm.first.c_str();
+ sg_storage_t storage = elm.second;
+ xbt_dict_set(res, mount_name, (void*)storage->name(), nullptr);
+ }
+
+ return res;
}
xbt_dynar_t sg_host_get_attached_storage_list(sg_host_t host){
/** @brief Returns the number of power states for a host.
*
- * See also @ref SURF_plugin_energy.
+ * See also @ref plugin_energy.
*/
int sg_host_get_nb_pstates(sg_host_t host) {
return host->pstatesCount();
/** @brief Gets the pstate at which that host currently runs.
*
- * See also @ref SURF_plugin_energy.
+ * See also @ref plugin_energy.
*/
int sg_host_get_pstate(sg_host_t host) {
return host->pstate();
}
/** @brief Sets the pstate at which that host should run.
*
- * See also @ref SURF_plugin_energy.
+ * See also @ref plugin_energy.
*/
void sg_host_set_pstate(sg_host_t host,int pstate) {
host->setPstate(pstate);
void sg_host_dump(sg_host_t host)
{
xbt_dict_t props;
- xbt_dict_cursor_t cursor=nullptr;
- char *key,*data;
XBT_INFO("Displaying host %s", host->cname());
XBT_INFO(" - speed: %.0f", host->speed());
XBT_INFO(" - available speed: %.2f", sg_host_get_available_speed(host));
props = host->properties();
- if (!xbt_dict_is_empty(props)){
+ if (not xbt_dict_is_empty(props)) {
XBT_INFO(" - properties:");
+ xbt_dict_cursor_t cursor = nullptr;
+ char* key;
+ char* data;
xbt_dict_foreach(props,cursor,key,data) {
XBT_INFO(" %s->%s",key,data);