Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
First round of refactoring in the event trace stuff
[simgrid.git] / src / surf / cpu_cas01.hpp
1 /* Copyright (c) 2013-2016. 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();
29
30   Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak, int pstate,
31                    double speedScale,
32                           tmgr_trace_t speedTrace, int core,
33                           int initiallyOn,
34                           tmgr_trace_t state_trace) override;
35   double shareResourcesFull(double now) override;
36   void addTraces() override;
37   ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
38 };
39
40 /************
41  * Resource *
42  ************/
43
44 class CpuCas01 : public Cpu {
45 public:
46   CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
47         int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
48         int initiallyOn, tmgr_trace_t stateTrace) ;
49   ~CpuCas01();
50   void updateState(tmgr_trace_iterator_t event_type, double value, double date) override;
51   CpuAction *execute(double size) override;
52   CpuAction *sleep(double duration) override;
53
54   bool isUsed() override;
55   void setStateEvent(tmgr_trace_iterator_t stateEvent);
56   void setPowerEvent(tmgr_trace_iterator_t stateEvent);
57
58   xbt_dynar_t getSpeedPeakList(); // FIXME: killme to hide our internals
59
60 protected:
61   void onSpeedChange() override;
62
63 private:
64
65   tmgr_trace_iterator_t p_stateEvent;
66   tmgr_trace_iterator_t p_speedEvent;
67 };
68
69 /**********
70  * Action *
71  **********/
72 class CpuCas01Action: public CpuAction {
73   friend CpuAction *CpuCas01::execute(double size);
74   friend CpuAction *CpuCas01::sleep(double duration);
75 public:
76   CpuCas01Action(Model *model, double cost, bool failed, double speed,
77                  lmm_constraint_t constraint);
78
79   ~CpuCas01Action() {};
80 };
81
82 }
83 }