Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Constify pointer and reference parameters in src/plugins/.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 28 Dec 2019 22:02:11 +0000 (23:02 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 28 Dec 2019 22:29:03 +0000 (23:29 +0100)
14 files changed:
include/simgrid/forward.h
include/simgrid/plugins/energy.h
include/simgrid/plugins/file_system.h
include/simgrid/plugins/live_migration.h
include/simgrid/plugins/load.h
include/simgrid/vm.h
src/plugins/dirty_page_tracking.cpp
src/plugins/file_system/s4u_FileSystem.cpp
src/plugins/host_dvfs.cpp
src/plugins/host_energy.cpp
src/plugins/host_load.cpp
src/plugins/link_energy.cpp
src/plugins/vm/VmLiveMigration.cpp
src/plugins/vm/s4u_VirtualMachine.cpp

index b6a2b5c..eb8125a 100644 (file)
@@ -232,11 +232,17 @@ typedef s4u_Mutex* sg_mutex_t;
 typedef s4u_Semaphore* sg_sem_t;
 typedef s4u_NetZone* sg_netzone_t;
 typedef s4u_Host* sg_host_t;
+typedef const s4u_Host* const_sg_host_t;
 typedef s4u_Link* sg_link_t;
+typedef const s4u_Link* const_sg_link_t;
 typedef s4u_Disk* sg_disk_t;
+typedef const s4u_Disk* const_sg_disk_t;
 typedef s4u_Storage* sg_storage_t;
+typedef const s4u_Storage* const_sg_storage_t;
 typedef s4u_File* sg_file_t;
+typedef const s4u_File* const_sg_file_t;
 typedef s4u_VM* sg_vm_t;
+typedef const s4u_VM* const_sg_vm_t;
 typedef s4u_Actor* sg_actor_t;
 typedef const s4u_Actor* const_sg_actor_t;
 
index 630d327..e886e78 100644 (file)
@@ -13,16 +13,16 @@ SG_BEGIN_DECL
 
 XBT_PUBLIC void sg_host_energy_plugin_init();
 XBT_PUBLIC void sg_host_energy_update_all();
-XBT_PUBLIC double sg_host_get_consumed_energy(sg_host_t host);
-XBT_PUBLIC double sg_host_get_idle_consumption(sg_host_t host);
-XBT_PUBLIC double sg_host_get_idle_consumption_at(sg_host_t host, int pstate);
-XBT_PUBLIC double sg_host_get_wattmin_at(sg_host_t host, int pstate);
-XBT_PUBLIC double sg_host_get_wattmax_at(sg_host_t host, int pstate);
-XBT_PUBLIC double sg_host_get_power_range_slope_at(sg_host_t host, int pstate);
-XBT_PUBLIC double sg_host_get_current_consumption(sg_host_t host);
+XBT_PUBLIC double sg_host_get_consumed_energy(const_sg_host_t host);
+XBT_PUBLIC double sg_host_get_idle_consumption(const_sg_host_t host);
+XBT_PUBLIC double sg_host_get_idle_consumption_at(const_sg_host_t host, int pstate);
+XBT_PUBLIC double sg_host_get_wattmin_at(const_sg_host_t host, int pstate);
+XBT_PUBLIC double sg_host_get_wattmax_at(const_sg_host_t host, int pstate);
+XBT_PUBLIC double sg_host_get_power_range_slope_at(const_sg_host_t host, int pstate);
+XBT_PUBLIC double sg_host_get_current_consumption(const_sg_host_t host);
 
 XBT_PUBLIC void sg_link_energy_plugin_init();
-XBT_PUBLIC double sg_link_get_consumed_energy(sg_link_t link);
+XBT_PUBLIC double sg_link_get_consumed_energy(const_sg_link_t link);
 
 XBT_PUBLIC int sg_link_energy_is_inited();
 
index a7e090e..3506aa5 100644 (file)
@@ -27,12 +27,12 @@ XBT_PUBLIC void sg_storage_file_system_init();
 XBT_PUBLIC sg_file_t sg_file_open(const char* fullpath, void* data);
 XBT_PUBLIC sg_size_t sg_file_read(sg_file_t fd, sg_size_t size);
 XBT_PUBLIC sg_size_t sg_file_write(sg_file_t fd, sg_size_t size);
-XBT_PUBLIC void sg_file_close(sg_file_t fd);
+XBT_PUBLIC void sg_file_close(const_sg_file_t fd);
 
 XBT_PUBLIC const char* sg_file_get_name(sg_file_t fd);
 XBT_PUBLIC sg_size_t sg_file_get_size(sg_file_t fd);
 XBT_PUBLIC void sg_file_dump(sg_file_t fd);
-XBT_PUBLIC void* sg_file_get_data(sg_file_t fd);
+XBT_PUBLIC void* sg_file_get_data(const_sg_file_t fd);
 XBT_PUBLIC void sg_file_set_data(sg_file_t fd, void* data);
 XBT_PUBLIC void sg_file_seek(sg_file_t fd, sg_offset_t offset, int origin);
 XBT_PUBLIC sg_size_t sg_file_tell(sg_file_t fd);
@@ -41,15 +41,15 @@ XBT_PUBLIC void sg_file_unlink(sg_file_t fd);
 XBT_PUBLIC int sg_file_rcopy(sg_file_t file, sg_host_t host, const char* fullpath);
 XBT_PUBLIC int sg_file_rmove(sg_file_t file, sg_host_t host, const char* fullpath);
 
-XBT_PUBLIC sg_size_t sg_disk_get_size_free(sg_disk_t d);
-XBT_PUBLIC sg_size_t sg_disk_get_size_used(sg_disk_t d);
-XBT_PUBLIC sg_size_t sg_disk_get_size(sg_disk_t d);
-XBT_PUBLIC const char* sg_disk_get_mount_point(sg_disk_t d);
+XBT_PUBLIC sg_size_t sg_disk_get_size_free(const_sg_disk_t d);
+XBT_PUBLIC sg_size_t sg_disk_get_size_used(const_sg_disk_t d);
+XBT_PUBLIC sg_size_t sg_disk_get_size(const_sg_disk_t d);
+XBT_PUBLIC const char* sg_disk_get_mount_point(const_sg_disk_t d);
 
-XBT_PUBLIC sg_size_t sg_storage_get_size_free(sg_storage_t st);
-XBT_PUBLIC sg_size_t sg_storage_get_size_used(sg_storage_t st);
-XBT_PUBLIC sg_size_t sg_storage_get_size(sg_storage_t st);
-XBT_PUBLIC xbt_dict_t sg_storage_get_content(sg_storage_t storage);
+XBT_PUBLIC sg_size_t sg_storage_get_size_free(const_sg_storage_t st);
+XBT_PUBLIC sg_size_t sg_storage_get_size_used(const_sg_storage_t st);
+XBT_PUBLIC sg_size_t sg_storage_get_size(const_sg_storage_t st);
+XBT_PUBLIC xbt_dict_t sg_storage_get_content(const_sg_storage_t storage);
 
 XBT_PUBLIC xbt_dict_t sg_host_get_storage_content(sg_host_t host);
 
@@ -103,7 +103,7 @@ class XBT_PUBLIC File : public xbt::Extendable<File> {
   sg_size_t current_position_ = SEEK_SET;
 
   Storage* find_local_storage_on(Host* host);
-  Disk* find_local_disk_on(Host* host);
+  Disk* find_local_disk_on(const Host* host);
   sg_size_t write_on_storage(sg_size_t size, bool write_inside);
   sg_size_t write_on_disk(sg_size_t size, bool write_inside);
 
@@ -150,7 +150,7 @@ public:
 class XBT_PUBLIC FileSystemDiskExt {
 public:
   static simgrid::xbt::Extension<Disk, FileSystemDiskExt> EXTENSION_ID;
-  explicit FileSystemDiskExt(Disk* ptr);
+  explicit FileSystemDiskExt(const Disk* ptr);
   FileSystemDiskExt(const FileSystemDiskExt&) = delete;
   FileSystemDiskExt& operator=(const FileSystemDiskExt&) = delete;
   std::map<std::string, sg_size_t>* parse_content(const std::string& filename);
@@ -177,7 +177,7 @@ private:
 class XBT_PUBLIC FileSystemStorageExt {
 public:
   static simgrid::xbt::Extension<Storage, FileSystemStorageExt> EXTENSION_ID;
-  explicit FileSystemStorageExt(Storage* ptr);
+  explicit FileSystemStorageExt(const Storage* ptr);
   FileSystemStorageExt(const FileSystemStorageExt&) = delete;
   FileSystemStorageExt& operator=(const FileSystemStorageExt&) = delete;
   std::map<std::string, sg_size_t>* parse_content(const std::string& filename);
index 18e747b..94fea7d 100644 (file)
@@ -13,18 +13,18 @@ SG_BEGIN_DECL
 
 XBT_PUBLIC void sg_vm_live_migration_plugin_init();
 XBT_PRIVATE void sg_vm_dirty_page_tracking_init();
-XBT_PUBLIC void sg_vm_start_dirty_page_tracking(sg_vm_t vm);
-XBT_PUBLIC void sg_vm_stop_dirty_page_tracking(sg_vm_t vm);
-XBT_PUBLIC double sg_vm_lookup_computed_flops(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_start_dirty_page_tracking(const_sg_vm_t vm);
+XBT_PUBLIC void sg_vm_stop_dirty_page_tracking(const_sg_vm_t vm);
+XBT_PUBLIC double sg_vm_lookup_computed_flops(const_sg_vm_t vm);
 XBT_PUBLIC void sg_vm_migrate(sg_vm_t vm, sg_host_t dst_pm);
-XBT_PUBLIC void sg_vm_set_dirty_page_intensity(sg_vm_t vm, double intensity);
-XBT_PUBLIC double sg_vm_get_dirty_page_intensity(sg_vm_t vm);
-XBT_PUBLIC void sg_vm_set_working_set_memory(sg_vm_t vm, sg_size_t size);
-XBT_PUBLIC sg_size_t sg_vm_get_working_set_memory(sg_vm_t vm);
-XBT_PUBLIC void sg_vm_set_migration_speed(sg_vm_t vm, double speed);
-XBT_PUBLIC double sg_vm_get_migration_speed(sg_vm_t vm);
-XBT_PUBLIC double sg_vm_get_max_downtime(sg_vm_t vm);
-XBT_PUBLIC int sg_vm_is_migrating(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_set_dirty_page_intensity(const_sg_vm_t vm, double intensity);
+XBT_PUBLIC double sg_vm_get_dirty_page_intensity(const_sg_vm_t vm);
+XBT_PUBLIC void sg_vm_set_working_set_memory(const_sg_vm_t vm, sg_size_t size);
+XBT_PUBLIC sg_size_t sg_vm_get_working_set_memory(const_sg_vm_t vm);
+XBT_PUBLIC void sg_vm_set_migration_speed(const_sg_vm_t vm, double speed);
+XBT_PUBLIC double sg_vm_get_migration_speed(const_sg_vm_t vm);
+XBT_PUBLIC double sg_vm_get_max_downtime(const_sg_vm_t vm);
+XBT_PUBLIC int sg_vm_is_migrating(const_sg_vm_t vm);
 XBT_PUBLIC sg_vm_t sg_vm_create_migratable(sg_host_t pm, const char* name, int coreAmount, int ramsize,
                                            int mig_netspeed, int dp_intensity);
 
index 8880e9d..d5d03ec 100644 (file)
 SG_BEGIN_DECL
 
 XBT_PUBLIC void sg_host_load_plugin_init();
-XBT_PUBLIC double sg_host_get_current_load(sg_host_t host);
-XBT_PUBLIC double sg_host_get_avg_load(sg_host_t host);
-XBT_PUBLIC double sg_host_get_idle_time(sg_host_t host);
-XBT_PUBLIC double sg_host_get_total_idle_time(sg_host_t host);
-XBT_PUBLIC double sg_host_get_computed_flops(sg_host_t host);
-XBT_PUBLIC void sg_host_load_reset(sg_host_t host);
+XBT_PUBLIC double sg_host_get_current_load(const_sg_host_t host);
+XBT_PUBLIC double sg_host_get_avg_load(const_sg_host_t host);
+XBT_PUBLIC double sg_host_get_idle_time(const_sg_host_t host);
+XBT_PUBLIC double sg_host_get_total_idle_time(const_sg_host_t host);
+XBT_PUBLIC double sg_host_get_computed_flops(const_sg_host_t host);
+XBT_PUBLIC void sg_host_load_reset(const_sg_host_t host);
 
 #define MSG_host_load_plugin_init() sg_host_load_plugin_init()
 /** @brief Returns the current load of that host, as a ratio = achieved_flops / (core_current_speed * core_amount)
index 83f180a..e7e29bb 100644 (file)
@@ -29,7 +29,7 @@ XBT_PUBLIC int sg_vm_is_created(sg_vm_t vm);
 XBT_PUBLIC int sg_vm_is_running(sg_vm_t vm);
 XBT_PUBLIC int sg_vm_is_suspended(sg_vm_t vm);
 
-XBT_PUBLIC const char* sg_vm_get_name(sg_vm_t vm);
+XBT_PUBLIC const char* sg_vm_get_name(const_sg_vm_t vm);
 XBT_PUBLIC void sg_vm_set_ramsize(sg_vm_t vm, size_t size);
 XBT_PUBLIC size_t sg_vm_get_ramsize(sg_vm_t vm);
 XBT_PUBLIC void sg_vm_set_bound(sg_vm_t vm, double bound);
index 1bfa00e..df8961e 100644 (file)
@@ -114,52 +114,52 @@ void sg_vm_dirty_page_tracking_init()
   }
 }
 
-void sg_vm_start_dirty_page_tracking(sg_vm_t vm)
+void sg_vm_start_dirty_page_tracking(const_sg_vm_t vm)
 {
   vm->get_impl()->extension<simgrid::vm::DirtyPageTrackingExt>()->start_tracking();
 }
 
-void sg_vm_stop_dirty_page_tracking(sg_vm_t vm)
+void sg_vm_stop_dirty_page_tracking(const_sg_vm_t vm)
 {
   vm->get_impl()->extension<simgrid::vm::DirtyPageTrackingExt>()->stop_tracking();
 }
 
-double sg_vm_lookup_computed_flops(sg_vm_t vm)
+double sg_vm_lookup_computed_flops(const_sg_vm_t vm)
 {
   return vm->get_impl()->extension<simgrid::vm::DirtyPageTrackingExt>()->computed_flops_lookup();
 }
 
-void sg_vm_set_dirty_page_intensity(sg_vm_t vm, double intensity)
+void sg_vm_set_dirty_page_intensity(const_sg_vm_t vm, double intensity)
 {
   vm->get_impl()->extension<simgrid::vm::DirtyPageTrackingExt>()->set_intensity(intensity);
 }
 
-double sg_vm_get_dirty_page_intensity(sg_vm_t vm)
+double sg_vm_get_dirty_page_intensity(const_sg_vm_t vm)
 {
   return vm->get_impl()->extension<simgrid::vm::DirtyPageTrackingExt>()->get_intensity();
 }
 
-void sg_vm_set_working_set_memory(sg_vm_t vm, sg_size_t size)
+void sg_vm_set_working_set_memory(const_sg_vm_t vm, sg_size_t size)
 {
   vm->get_impl()->extension<simgrid::vm::DirtyPageTrackingExt>()->set_working_set_memory(size);
 }
 
-sg_size_t sg_vm_get_working_set_memory(sg_vm_t vm)
+sg_size_t sg_vm_get_working_set_memory(const_sg_vm_t vm)
 {
   return vm->get_impl()->extension<simgrid::vm::DirtyPageTrackingExt>()->get_working_set_memory();
 }
 
-void sg_vm_set_migration_speed(sg_vm_t vm, double speed)
+void sg_vm_set_migration_speed(const_sg_vm_t vm, double speed)
 {
   vm->get_impl()->extension<simgrid::vm::DirtyPageTrackingExt>()->set_migration_speed(speed);
 }
 
-double sg_vm_get_migration_speed(sg_vm_t vm)
+double sg_vm_get_migration_speed(const_sg_vm_t vm)
 {
   return vm->get_impl()->extension<simgrid::vm::DirtyPageTrackingExt>()->get_migration_speed();
 }
 
-double sg_vm_get_max_downtime(sg_vm_t vm)
+double sg_vm_get_max_downtime(const_sg_vm_t vm)
 {
   return vm->get_impl()->extension<simgrid::vm::DirtyPageTrackingExt>()->get_max_downtime();
 }
index 1d33e64..ea1aaf9 100644 (file)
@@ -58,7 +58,7 @@ Storage* File::find_local_storage_on(Host* host)
   return st;
 }
 
-Disk* File::find_local_disk_on(Host* host)
+Disk* File::find_local_disk_on(const Host* host)
 {
   Disk* d                      = nullptr;
   size_t longest_prefix_length = 0;
@@ -470,7 +470,7 @@ int File::remote_move(sg_host_t host, const char* fullpath)
   return res;
 }
 
-FileSystemDiskExt::FileSystemDiskExt(simgrid::s4u::Disk* ptr)
+FileSystemDiskExt::FileSystemDiskExt(const Disk* ptr)
 {
   const char* size_str    = ptr->get_property("size");
   if (size_str)
@@ -487,7 +487,7 @@ FileSystemDiskExt::FileSystemDiskExt(simgrid::s4u::Disk* ptr)
     content_.reset(parse_content(content_str));
 }
 
-FileSystemStorageExt::FileSystemStorageExt(simgrid::s4u::Storage* ptr) : size_(ptr->get_impl()->size_)
+FileSystemStorageExt::FileSystemStorageExt(const Storage* ptr) : size_(ptr->get_impl()->size_)
 {
   content_.reset(parse_content(ptr->get_impl()->content_name_));
 }
@@ -658,7 +658,7 @@ sg_size_t sg_file_write(sg_file_t fd, sg_size_t size)
   return fd->write(size);
 }
 
-void sg_file_close(sg_file_t fd)
+void sg_file_close(const_sg_file_t fd)
 {
   delete fd;
 }
@@ -688,7 +688,7 @@ void sg_file_dump(sg_file_t fd)
 /** Retrieves the user data associated with the file
  * @ingroup plugin_filesystem
  */
-void* sg_file_get_data(sg_file_t fd)
+void* sg_file_get_data(const_sg_file_t fd)
 {
   return fd->get_data();
 }
@@ -760,42 +760,42 @@ int sg_file_rmove(sg_file_t file, sg_host_t host, const char* fullpath)
   return file->remote_move(host, fullpath);
 }
 
-sg_size_t sg_disk_get_size_free(sg_disk_t d)
+sg_size_t sg_disk_get_size_free(const_sg_disk_t d)
 {
   return d->extension<FileSystemDiskExt>()->get_size() - d->extension<FileSystemDiskExt>()->get_used_size();
 }
 
-sg_size_t sg_disk_get_size_used(sg_disk_t d)
+sg_size_t sg_disk_get_size_used(const_sg_disk_t d)
 {
   return d->extension<FileSystemDiskExt>()->get_used_size();
 }
 
-sg_size_t sg_disk_get_size(sg_disk_t d)
+sg_size_t sg_disk_get_size(const_sg_disk_t d)
 {
   return d->extension<FileSystemDiskExt>()->get_size();
 }
 
-const char* sg_disk_get_mount_point(sg_disk_t d)
+const char* sg_disk_get_mount_point(const_sg_disk_t d)
 {
   return d->extension<FileSystemDiskExt>()->get_mount_point();
 }
 
-sg_size_t sg_storage_get_size_free(sg_storage_t st)
+sg_size_t sg_storage_get_size_free(const_sg_storage_t st)
 {
   return st->extension<FileSystemStorageExt>()->get_size() - st->extension<FileSystemStorageExt>()->get_used_size();
 }
 
-sg_size_t sg_storage_get_size_used(sg_storage_t st)
+sg_size_t sg_storage_get_size_used(const_sg_storage_t st)
 {
   return st->extension<FileSystemStorageExt>()->get_used_size();
 }
 
-sg_size_t sg_storage_get_size(sg_storage_t st)
+sg_size_t sg_storage_get_size(const_sg_storage_t st)
 {
   return st->extension<FileSystemStorageExt>()->get_size();
 }
 
-xbt_dict_t sg_storage_get_content(sg_storage_t storage)
+xbt_dict_t sg_storage_get_content(const_sg_storage_t storage)
 {
   const std::map<std::string, sg_size_t>* content =
       storage->extension<simgrid::s4u::FileSystemStorageExt>()->get_content();
index f477c5f..bd80735 100644 (file)
@@ -305,7 +305,7 @@ public:
     // FIXME I think that this fires at the same time for all hosts, so when the src sends something,
     // the dst will be notified even though it didn't even arrive at the recv yet
     simgrid::s4u::Link::on_communicate.connect(
-        [this](kernel::resource::NetworkAction const&, s4u::Host* src, s4u::Host* dst) {
+        [this](const kernel::resource::NetworkAction&, const s4u::Host* src, const s4u::Host* dst) {
           if ((get_host() == src || get_host() == dst) && iteration_running) {
             post_task();
           }
index 28c7a8f..6c49c91 100644 (file)
@@ -597,7 +597,7 @@ static void ensure_plugin_inited()
  *  The result is that the actor requesting this value will be interrupted,
  *  the value will be updated in kernel mode before returning the control to the requesting actor.
  */
-double sg_host_get_consumed_energy(sg_host_t host)
+double sg_host_get_consumed_energy(const_sg_host_t host)
 {
   ensure_plugin_inited();
   return host->extension<HostEnergy>()->get_consumed_energy();
@@ -606,7 +606,7 @@ double sg_host_get_consumed_energy(sg_host_t host)
 /** @ingroup plugin_host_energy
  *  @brief Get the amount of watt dissipated when the host is idling
  */
-double sg_host_get_idle_consumption(sg_host_t host)
+double sg_host_get_idle_consumption(const_sg_host_t host)
 {
   ensure_plugin_inited();
   return host->extension<HostEnergy>()->get_watt_idle_at(0);
@@ -615,7 +615,7 @@ double sg_host_get_idle_consumption(sg_host_t host)
 /** @ingroup plugin_host_energy
  *  @brief Get the amount of watt dissipated at the given pstate when the host is idling
  */
-double sg_host_get_idle_consumption_at(sg_host_t host, int pstate)
+double sg_host_get_idle_consumption_at(const_sg_host_t host, int pstate)
 {
   ensure_plugin_inited();
   return host->extension<HostEnergy>()->get_watt_idle_at(pstate);
@@ -624,7 +624,7 @@ double sg_host_get_idle_consumption_at(sg_host_t host, int pstate)
 /** @ingroup plugin_host_energy
  *  @brief Get the amount of watt dissipated at the given pstate when the host is at 0 or epsilon% CPU usage.
  */
-double sg_host_get_wattmin_at(sg_host_t host, int pstate)
+double sg_host_get_wattmin_at(const_sg_host_t host, int pstate)
 {
   ensure_plugin_inited();
   return host->extension<HostEnergy>()->get_watt_min_at(pstate);
@@ -632,7 +632,7 @@ double sg_host_get_wattmin_at(sg_host_t host, int pstate)
 /** @ingroup plugin_host_energy
  *  @brief  Returns the amount of watt dissipated at the given pstate when the host burns CPU at 100%
  */
-double sg_host_get_wattmax_at(sg_host_t host, int pstate)
+double sg_host_get_wattmax_at(const_sg_host_t host, int pstate)
 {
   ensure_plugin_inited();
   return host->extension<HostEnergy>()->get_watt_max_at(pstate);
@@ -640,7 +640,7 @@ double sg_host_get_wattmax_at(sg_host_t host, int pstate)
 /** @ingroup plugin_host_energy
  *  @brief  Returns the power slope at the given pstate
  */
-double sg_host_get_power_range_slope_at(sg_host_t host, int pstate)
+double sg_host_get_power_range_slope_at(const_sg_host_t host, int pstate)
 {
   ensure_plugin_inited();
   return host->extension<HostEnergy>()->get_power_range_slope_at(pstate);
@@ -648,7 +648,7 @@ double sg_host_get_power_range_slope_at(sg_host_t host, int pstate)
 /** @ingroup plugin_host_energy
  *  @brief Returns the current consumption of the host
  */
-double sg_host_get_current_consumption(sg_host_t host)
+double sg_host_get_current_consumption(const_sg_host_t host)
 {
   ensure_plugin_inited();
   return host->extension<HostEnergy>()->get_current_watts_value();
index cf0141a..eae683d 100644 (file)
@@ -269,7 +269,7 @@ void sg_host_load_plugin_init()
 /** @brief Returns the current load of that host, as a ratio = achieved_flops / (core_current_speed * core_amount)
  *  @ingroup plugin_host_load
  */
-double sg_host_get_current_load(sg_host_t host)
+double sg_host_get_current_load(const_sg_host_t host)
 {
   xbt_assert(HostLoad::EXTENSION_ID.valid(), "Please sg_host_load_plugin_init() to initialize this plugin.");
 
@@ -279,7 +279,7 @@ double sg_host_get_current_load(sg_host_t host)
 /** @brief Returns the current load of that host
  *  @ingroup plugin_host_load
  */
-double sg_host_get_avg_load(sg_host_t host)
+double sg_host_get_avg_load(const_sg_host_t host)
 {
   xbt_assert(HostLoad::EXTENSION_ID.valid(), "Please sg_host_load_plugin_init() to initialize this plugin.");
 
@@ -289,7 +289,7 @@ double sg_host_get_avg_load(sg_host_t host)
 /** @brief Returns the time this host was idle since the last reset
  *  @ingroup plugin_host_load
  */
-double sg_host_get_idle_time(sg_host_t host)
+double sg_host_get_idle_time(const_sg_host_t host)
 {
   xbt_assert(HostLoad::EXTENSION_ID.valid(), "Please sg_host_load_plugin_init() to initialize this plugin.");
 
@@ -299,7 +299,7 @@ double sg_host_get_idle_time(sg_host_t host)
 /** @brief Returns the time this host was idle since the beginning of the simulation
  *  @ingroup plugin_host_load
  */
-double sg_host_get_total_idle_time(sg_host_t host)
+double sg_host_get_total_idle_time(const_sg_host_t host)
 {
   xbt_assert(HostLoad::EXTENSION_ID.valid(), "Please sg_host_load_plugin_init() to initialize this plugin.");
 
@@ -309,7 +309,7 @@ double sg_host_get_total_idle_time(sg_host_t host)
 /** @brief Returns the amount of flops computed by that host since the last reset
  *  @ingroup plugin_host_load
  */
-double sg_host_get_computed_flops(sg_host_t host)
+double sg_host_get_computed_flops(const_sg_host_t host)
 {
   xbt_assert(HostLoad::EXTENSION_ID.valid(), "Please sg_host_load_plugin_init() to initialize this plugin.");
 
@@ -319,7 +319,7 @@ double sg_host_get_computed_flops(sg_host_t host)
 /** @brief Resets the idle time and flops amount of that host
  *  @ingroup plugin_host_load
  */
-void sg_host_load_reset(sg_host_t host)
+void sg_host_load_reset(const_sg_host_t host)
 {
   xbt_assert(HostLoad::EXTENSION_ID.valid(), "Please sg_host_load_plugin_init() to initialize this plugin.");
 
index 9653438..bc95abb 100644 (file)
@@ -148,8 +148,8 @@ double LinkEnergy::get_consumed_energy()
 using simgrid::plugin::LinkEnergy;
 
 /* **************************** events  callback *************************** */
-static void on_communicate(simgrid::kernel::resource::NetworkAction const& action, simgrid::s4u::Host*,
-                           simgrid::s4u::Host*)
+static void on_communicate(const simgrid::kernel::resource::NetworkAction& action, const simgrid::s4u::Host*,
+                           const simgrid::s4u::Host*)
 {
   XBT_DEBUG("onCommunicate is called");
   for (simgrid::kernel::resource::LinkImpl* link : action.links()) {
@@ -224,7 +224,7 @@ void sg_link_energy_plugin_init()
  *  The result is that the actor requesting this value will be interrupted,
  *  the value will be updated in kernel mode before returning the control to the requesting actor.
  */
-double sg_link_get_consumed_energy(sg_link_t link)
+double sg_link_get_consumed_energy(const_sg_link_t link)
 {
   if (not LinkEnergy::EXTENSION_ID.valid())
     throw simgrid::xbt::InitializationError("The Energy plugin is not active. Please call sg_link_energy_plugin_init() "
index 80fab87..a79cc6f 100644 (file)
@@ -311,7 +311,7 @@ simgrid::s4u::VirtualMachine* sg_vm_create_migratable(simgrid::s4u::Host* pm, co
   return vm;
 }
 
-int sg_vm_is_migrating(simgrid::s4u::VirtualMachine* vm)
+int sg_vm_is_migrating(const simgrid::s4u::VirtualMachine* vm)
 {
   return vm->get_impl()->is_migrating_;
 }
index b9fa057..84e1527 100644 (file)
@@ -197,7 +197,7 @@ sg_vm_t sg_vm_create_multicore(sg_host_t pm, const char* name, int coreAmount)
   return new simgrid::s4u::VirtualMachine(name, pm, coreAmount);
 }
 
-const char* sg_vm_get_name(sg_vm_t vm)
+const char* sg_vm_get_name(const_sg_vm_t vm)
 {
   return vm->get_cname();
 }