Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Comply with clang-format rules
[simgrid.git] / src / kernel / resource / Resource.cpp
1 /* Copyright (c) 2004-2019. The SimGrid Team. All rights reserved.          */
2
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. */
5
6 #include "simgrid/kernel/resource/Resource.hpp"
7 #include "src/kernel/lmm/maxmin.hpp" // Constraint
8 #include "src/kernel/resource/profile/trace_mgr.hpp"
9 #include "src/surf/surf_interface.hpp"
10
11 namespace simgrid {
12 namespace kernel {
13 namespace resource {
14
15 Resource::~Resource() = default;
16
17 double Resource::get_load() const
18 {
19   return constraint_->get_usage();
20 }
21
22 void Resource::set_state_profile(profile::Profile* profile)
23 {
24   xbt_assert(state_event_ == nullptr, "Cannot set a second state profile to %s", get_cname());
25   state_event_ = profile->schedule(&future_evt_set, this);
26 }
27
28 } // namespace resource
29 } // namespace kernel
30 } // namespace simgrid