Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ee4ed16e34ff4b55b5534ea70744d50511296341
[simgrid.git] / src / surf / cpu_cas01.hpp
1 /* Copyright (c) 2013-2021. 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 #ifndef SIMGRID_SURF_CPUCAS01_HPP
7 #define SIMGRID_SURF_CPUCAS01_HPP
8
9 #include "cpu_interface.hpp"
10 #include "xbt/base.h"
11
12 /***********
13  * Classes *
14  ***********/
15
16 namespace simgrid {
17 namespace kernel {
18 namespace resource {
19
20 class XBT_PRIVATE CpuCas01Model;
21 class XBT_PRIVATE CpuCas01;
22 class XBT_PRIVATE CpuCas01Action;
23
24 /*********
25  * Model *
26  *********/
27
28 class CpuCas01Model : public CpuModel {
29 public:
30   CpuCas01Model();
31   CpuCas01Model(const CpuCas01Model&) = delete;
32   CpuCas01Model& operator=(const CpuCas01Model&) = delete;
33
34   Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate) override;
35 };
36
37 /************
38  * Resource *
39  ************/
40
41 class CpuCas01 : public Cpu {
42 public:
43   using Cpu::Cpu;
44   CpuCas01(const CpuCas01&) = delete;
45   CpuCas01& operator=(const CpuCas01&) = delete;
46   void apply_event(profile::Event* event, double value) override;
47   CpuAction* execution_start(double size) override;
48   CpuAction* execution_start(double size, int requested_cores) override;
49   CpuAction* sleep(double duration) override;
50
51   bool is_used() const override;
52
53 protected:
54   void on_speed_change() 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
64 public:
65   CpuCas01Action(Model* model, double cost, bool failed, double speed, lmm::Constraint* constraint,
66                  int requested_core = 1);
67   CpuCas01Action(const CpuCas01Action&) = delete;
68   CpuCas01Action& operator=(const CpuCas01Action&) = delete;
69   int requested_core() const;
70
71 private:
72   int requested_core_ = 1;
73 };
74
75 } // namespace resource
76 } // namespace kernel
77 } // namespace simgrid
78
79 #endif