1 /* Copyright (c) 2004-2021. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "simgrid/kernel/resource/Resource.hpp"
7 #include "src/kernel/lmm/maxmin.hpp" // Constraint
8 #include "src/kernel/resource/profile/FutureEvtSet.hpp"
9 #include "src/kernel/resource/profile/Profile.hpp"
10 #include "src/surf/surf_interface.hpp"
16 Resource* Resource::set_name(const std::string& name)
22 Resource* Resource::set_model(Model* model)
28 Resource* Resource::set_constraint(lmm::Constraint* constraint)
30 constraint_ = constraint;
34 double Resource::get_load() const
36 return constraint_->get_usage();
39 void Resource::set_state_profile(profile::Profile* profile)
41 xbt_assert(state_event_ == nullptr, "Cannot set a second state profile to %s", get_cname());
42 state_event_ = profile->schedule(&profile::future_evt_set, this);
45 } // namespace resource
47 } // namespace simgrid