Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add dag scheduling lab
[simgrid.git] / src / plugins / link_load.cpp
index 0ecac0cac99f86a160b621a0abc8a1d8bfe6d890..1afdd6ea2b5bce8164fc005a4c5b25575b66009d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017-2022. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2017-2023. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -8,6 +8,7 @@
 
 #include "src/kernel/activity/CommImpl.hpp"
 #include "src/kernel/resource/NetworkModel.hpp"
+#include "src/simgrid/module.hpp" // SIMGRID_REGISTER_PLUGIN
 
 #include <limits>
 
@@ -66,7 +67,7 @@ public:
 
 xbt::Extension<s4u::Link, LinkLoad> LinkLoad::EXTENSION_ID;
 
-LinkLoad::LinkLoad(s4u::Link* ptr) : link_(ptr), is_tracked_(false)
+LinkLoad::LinkLoad(s4u::Link* ptr) : link_(ptr)
 {
   XBT_DEBUG("Instantiating a LinkLoad for link '%s'", link_->get_cname());
 }
@@ -181,7 +182,8 @@ static void on_communication(const simgrid::kernel::activity::CommImpl& comm)
  */
 void sg_link_load_plugin_init()
 {
-  xbt_assert(simgrid::s4u::Engine::get_instance()->get_host_count() == 0,
+  xbt_assert(simgrid::s4u::Engine::get_instance()->get_host_count() == 0 &&
+                 simgrid::s4u::Engine::get_instance()->get_link_count() == 0,
              "Please call sg_link_load_plugin_init() BEFORE initializing the platform.");
   xbt_assert(not LinkLoad::EXTENSION_ID.valid(), "Double call to sg_link_load_plugin_init. Aborting.");
   LinkLoad::EXTENSION_ID = simgrid::s4u::Link::extension_create<LinkLoad>();