Logo AND Algorithmique Numérique Distribuée

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