Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
small cleanups in routing
[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 next_occuring_event_full(double now) override;
36   ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
37 };
38
39 /************
40  * Resource *
41  ************/
42
43 class CpuCas01 : public Cpu {
44 public:
45   CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
46         int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
47         int initiallyOn, tmgr_trace_t stateTrace) ;
48   ~CpuCas01();
49   void apply_event(tmgr_trace_iterator_t event, double value) override;
50   CpuAction *execution_start(double size) override;
51   CpuAction *sleep(double duration) override;
52
53   bool isUsed() override;
54
55   xbt_dynar_t getSpeedPeakList(); // FIXME: killme to hide our internals
56
57 protected:
58   void onSpeedChange() override;
59 };
60
61 /**********
62  * Action *
63  **********/
64 class CpuCas01Action: public CpuAction {
65   friend CpuAction *CpuCas01::execution_start(double size);
66   friend CpuAction *CpuCas01::sleep(double duration);
67 public:
68   CpuCas01Action(Model *model, double cost, bool failed, double speed,
69                  lmm_constraint_t constraint);
70
71   ~CpuCas01Action() {};
72 };
73
74 }
75 }