Logo AND Algorithmique Numérique Distribuée

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