Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill trailing whitespaces in source code files.
[simgrid.git] / src / surf / cpu_cas01.hpp
1 /* Copyright (c) 2013-2021. 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 #ifndef SIMGRID_SURF_CPUCAS01_HPP
7 #define SIMGRID_SURF_CPUCAS01_HPP
8
9 #include "cpu_interface.hpp"
10 #include "xbt/base.h"
11
12 /***********
13  * Classes *
14  ***********/
15
16 namespace simgrid {
17 namespace kernel {
18 namespace resource {
19
20 class XBT_PRIVATE CpuCas01Model;
21 class XBT_PRIVATE CpuCas01;
22 class XBT_PRIVATE CpuCas01Action;
23
24 /*********
25  * Model *
26  *********/
27
28 class CpuCas01Model : public CpuModel {
29 public:
30   explicit CpuCas01Model(const std::string& name);
31   CpuCas01Model(const CpuCas01Model&) = delete;
32   CpuCas01Model& operator=(const CpuCas01Model&) = delete;
33
34   CpuImpl* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate) override;
35 };
36
37 /************
38  * Resource *
39  ************/
40
41 class CpuCas01 : public CpuImpl {
42   std::function<s4u::Host::CpuFactorCb> factor_cb_ = {};
43
44 public:
45   using CpuImpl::CpuImpl;
46   CpuCas01(const CpuCas01&) = delete;
47   CpuCas01& operator=(const CpuCas01&) = delete;
48   void apply_event(profile::Event* event, double value) override;
49   CpuAction* execution_start(double size, double user_bound) override;
50   CpuAction* execution_start(double size, int requested_cores, double user_bound) override;
51   CpuAction* sleep(double duration) override;
52   void set_factor_cb(const std::function<s4u::Host::CpuFactorCb>& cb) override;
53
54   bool is_used() const override;
55
56 protected:
57   void on_speed_change() override;
58 };
59
60 /**********
61  * Action *
62  **********/
63 class CpuCas01Action : public CpuAction {
64   int requested_core_ = 1;
65
66 public:
67   CpuCas01Action(Model* model, double cost, bool failed, double speed, lmm::Constraint* constraint, int requested_core);
68   CpuCas01Action(const CpuCas01Action&) = delete;
69   CpuCas01Action& operator=(const CpuCas01Action&) = delete;
70   int requested_core() const { return requested_core_; }
71 };
72
73 } // namespace resource
74 } // namespace kernel
75 } // namespace simgrid
76
77 #endif