X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e709643ef0c5b61c6c878016c418bffa2b1b20cd..6c56800bdad43cabb6c870c9163bbeea694d6692:/src/surf/cpu_cas01.hpp diff --git a/src/surf/cpu_cas01.hpp b/src/surf/cpu_cas01.hpp index 1621b1b3fc..b5279e4532 100644 --- a/src/surf/cpu_cas01.hpp +++ b/src/surf/cpu_cas01.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2020. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2013-2021. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -6,17 +6,17 @@ #ifndef SIMGRID_SURF_CPUCAS01_HPP #define SIMGRID_SURF_CPUCAS01_HPP -#include "cpu_interface.hpp" +#include "src/kernel/resource/CpuImpl.hpp" #include "xbt/base.h" -/*********** - * Classes * - ***********/ - namespace simgrid { namespace kernel { namespace resource { +/*********** + * Classes * + ***********/ + class XBT_PRIVATE CpuCas01Model; class XBT_PRIVATE CpuCas01; class XBT_PRIVATE CpuCas01Action; @@ -27,30 +27,29 @@ class XBT_PRIVATE CpuCas01Action; class CpuCas01Model : public CpuModel { public: - explicit CpuCas01Model(Model::UpdateAlgo algo); + explicit CpuCas01Model(const std::string& name); CpuCas01Model(const CpuCas01Model&) = delete; CpuCas01Model& operator=(const CpuCas01Model&) = delete; - ~CpuCas01Model() override; - Cpu* create_cpu(s4u::Host* host, const std::vector& speed_per_pstate, int core) override; + CpuImpl* create_cpu(s4u::Host* host, const std::vector& speed_per_pstate) override; }; /************ * Resource * ************/ -class CpuCas01 : public Cpu { +class CpuCas01 : public CpuImpl { + std::function factor_cb_ = {}; + public: - CpuCas01(CpuCas01Model* model, s4u::Host* host, const std::vector& speed_per_pstate, int core); + using CpuImpl::CpuImpl; CpuCas01(const CpuCas01&) = delete; CpuCas01& operator=(const CpuCas01&) = delete; - ~CpuCas01() override; void apply_event(profile::Event* event, double value) override; - CpuAction* execution_start(double size) override; - CpuAction* execution_start(double size, int requested_cores) override; + CpuAction* execution_start(double size, double user_bound) override; + CpuAction* execution_start(double size, int requested_cores, double user_bound) override; CpuAction* sleep(double duration) override; - - bool is_used() override; + void set_factor_cb(const std::function& cb) override; protected: void on_speed_change() override; @@ -60,19 +59,13 @@ protected: * Action * **********/ class CpuCas01Action : public CpuAction { - friend CpuAction* CpuCas01::execution_start(double size); - friend CpuAction* CpuCas01::sleep(double duration); + int requested_core_ = 1; public: - CpuCas01Action(Model* model, double cost, bool failed, double speed, lmm::Constraint* constraint, int core_count); - CpuCas01Action(Model* model, double cost, bool failed, double speed, lmm::Constraint* constraint); + CpuCas01Action(Model* model, double cost, bool failed, double speed, lmm::Constraint* constraint, int requested_core); CpuCas01Action(const CpuCas01Action&) = delete; CpuCas01Action& operator=(const CpuCas01Action&) = delete; - ~CpuCas01Action() override; - int requested_core() const; - -private: - int requested_core_ = 1; + int requested_core() const { return requested_core_; } }; } // namespace resource