1 /* Copyright (c) 2013-2021. The SimGrid Team. All rights reserved. */
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. */
6 #ifndef SIMGRID_SURF_CPUCAS01_HPP
7 #define SIMGRID_SURF_CPUCAS01_HPP
9 #include "cpu_interface.hpp"
20 class XBT_PRIVATE CpuCas01Model;
21 class XBT_PRIVATE CpuCas01;
22 class XBT_PRIVATE CpuCas01Action;
28 class CpuCas01Model : public CpuModel {
30 explicit CpuCas01Model(Model::UpdateAlgo algo);
31 CpuCas01Model(const CpuCas01Model&) = delete;
32 CpuCas01Model& operator=(const CpuCas01Model&) = delete;
33 ~CpuCas01Model() override;
35 Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate) override;
42 class CpuCas01 : public Cpu {
44 CpuCas01(s4u::Host* host, const std::vector<double>& speed_per_pstate) : Cpu(host, speed_per_pstate) {}
45 CpuCas01(const CpuCas01&) = delete;
46 CpuCas01& operator=(const CpuCas01&) = delete;
47 void apply_event(profile::Event* event, double value) override;
48 CpuAction* execution_start(double size) override;
49 CpuAction* execution_start(double size, int requested_cores) override;
50 CpuAction* sleep(double duration) override;
52 bool is_used() const override;
55 void on_speed_change() override;
61 class CpuCas01Action : public CpuAction {
62 friend CpuAction* CpuCas01::execution_start(double size);
63 friend CpuAction* CpuCas01::sleep(double duration);
66 CpuCas01Action(Model* model, double cost, bool failed, double speed, lmm::Constraint* constraint,
67 int requested_core = 1);
68 CpuCas01Action(const CpuCas01Action&) = delete;
69 CpuCas01Action& operator=(const CpuCas01Action&) = delete;
70 ~CpuCas01Action() override;
71 int requested_core() const;
74 int requested_core_ = 1;
77 } // namespace resource
79 } // namespace simgrid