Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[PLUGINS] Initial commit for the Dvfs plugin (frequency governors)
[simgrid.git] / src / surf / cpu_cas01.hpp
1 /* Copyright (c) 2013-2017. 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 <xbt/base.h>
7
8 #include "cpu_interface.hpp"
9
10 /***********
11  * Classes *
12  ***********/
13
14 namespace simgrid {
15 namespace surf {
16
17 class XBT_PRIVATE CpuCas01Model;
18 class XBT_PRIVATE CpuCas01;
19 class XBT_PRIVATE CpuCas01Action;
20
21 /*********
22  * Model *
23  *********/
24
25 class CpuCas01Model : public simgrid::surf::CpuModel {
26 public:
27   CpuCas01Model();
28   ~CpuCas01Model() override;
29
30   Cpu *createCpu(simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core) override;
31   ActionList p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
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> *speedPerPstate, int core);
41   ~CpuCas01() override;
42   void apply_event(tmgr_trace_event_t event, double value) override;
43   CpuAction *execution_start(double size) override;
44   CpuAction* execution_start(double size, int requestedCore) override;
45   CpuAction *sleep(double duration) override;
46
47   bool isUsed() override;
48
49   std::vector<double> * getSpeedPeakList(); // FIXME: killme to hide our internals
50
51 protected:
52   void onSpeedChange() 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(Model* model, double cost, bool failed, double speed, lmm_constraint_t constraint, int coreAmount);
63   CpuCas01Action(Model* model, double cost, bool failed, double speed, lmm_constraint_t constraint);
64   ~CpuCas01Action() override;
65   int requestedCore();
66
67 private:
68   int requestedCore_ = 1;
69 };
70
71 }
72 }