Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
this should allow the tracing of resource usage with this model
[simgrid.git] / src / surf / cpu_cas01.hpp
1 /* Copyright (c) 2013-2018. 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() override;
28
29   Cpu *createCpu(simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core) override;
30   kernel::resource::Action::StateSet cpuRunningActionSetThatDoesNotNeedBeingChecked_;
31 };
32
33 /************
34  * Resource *
35  ************/
36
37 class CpuCas01 : public Cpu {
38 public:
39   CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core);
40   ~CpuCas01() override;
41   void apply_event(tmgr_trace_event_t event, double value) override;
42   CpuAction* execution_start(double size) override;
43   CpuAction* execution_start(double size, int requestedCore) override;
44   CpuAction* sleep(double duration) override;
45
46   bool is_used() override;
47
48   std::vector<double> * getSpeedPeakList(); // FIXME: killme to hide our internals
49
50 protected:
51   void onSpeedChange() override;
52 };
53
54 /**********
55  * Action *
56  **********/
57 class CpuCas01Action: public CpuAction {
58   friend CpuAction *CpuCas01::execution_start(double size);
59   friend CpuAction *CpuCas01::sleep(double duration);
60 public:
61   CpuCas01Action(kernel::resource::Model* model, double cost, bool failed, double speed,
62                  kernel::lmm::Constraint* constraint, int coreAmount);
63   CpuCas01Action(kernel::resource::Model* model, double cost, bool failed, double speed,
64                  kernel::lmm::Constraint* constraint);
65   ~CpuCas01Action() override;
66   int requested_core();
67
68 private:
69   int requested_core_ = 1;
70 };
71
72 }
73 }