X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b872718938013e4f8ed157c19cda97679ca0df8d..cf6a1d5f1eddea2b377415ab57c5185058488269:/src/surf/cpu_cas01.hpp diff --git a/src/surf/cpu_cas01.hpp b/src/surf/cpu_cas01.hpp index 3a5a2b9dbf..967b186f8e 100644 --- a/src/surf/cpu_cas01.hpp +++ b/src/surf/cpu_cas01.hpp @@ -1,18 +1,21 @@ -/* Copyright (c) 2013-2016. 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. */ -#include +#ifndef SIMGRID_SURF_CPUCAS01_HPP +#define SIMGRID_SURF_CPUCAS01_HPP #include "cpu_interface.hpp" +#include "xbt/base.h" /*********** * Classes * ***********/ namespace simgrid { -namespace surf { +namespace kernel { +namespace resource { class XBT_PRIVATE CpuCas01Model; class XBT_PRIVATE CpuCas01; @@ -22,50 +25,55 @@ class XBT_PRIVATE CpuCas01Action; * Model * *********/ -class CpuCas01Model : public simgrid::surf::CpuModel { +class CpuCas01Model : public CpuModel { public: - CpuCas01Model(); - ~CpuCas01Model(); + explicit CpuCas01Model(const std::string& name); + CpuCas01Model(const CpuCas01Model&) = delete; + CpuCas01Model& operator=(const CpuCas01Model&) = delete; - Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak, - tmgr_trace_t speedTrace, int core, tmgr_trace_t state_trace) override; - double next_occuring_event_full(double now) override; - ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked; + CpuImpl* create_cpu(s4u::Host* host, const std::vector& speed_per_pstate) override; }; /************ * Resource * ************/ -class CpuCas01 : public Cpu { +class CpuCas01 : public CpuImpl { public: - CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, - tmgr_trace_t speedTrace, int core, tmgr_trace_t stateTrace) ; - ~CpuCas01(); - void apply_event(tmgr_trace_iterator_t event, double value) override; - CpuAction *execution_start(double size) override; - CpuAction *sleep(double duration) override; + using CpuImpl::CpuImpl; + CpuCas01(const CpuCas01&) = delete; + CpuCas01& operator=(const CpuCas01&) = delete; + 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* sleep(double duration) override; - bool isUsed() override; - - xbt_dynar_t getSpeedPeakList(); // FIXME: killme to hide our internals + bool is_used() const override; protected: - void onSpeedChange() override; + void on_speed_change() override; }; /********** * Action * **********/ -class CpuCas01Action: public CpuAction { - friend CpuAction *CpuCas01::execution_start(double size); - friend CpuAction *CpuCas01::sleep(double duration); -public: - CpuCas01Action(Model *model, double cost, bool failed, double speed, - lmm_constraint_t constraint); +class CpuCas01Action : public CpuAction { + friend CpuAction* CpuCas01::execution_start(double size); + friend CpuAction* CpuCas01::sleep(double duration); - ~CpuCas01Action() {}; +public: + CpuCas01Action(Model* model, double cost, bool failed, double speed, lmm::Constraint* constraint, + int requested_core = 1); + CpuCas01Action(const CpuCas01Action&) = delete; + CpuCas01Action& operator=(const CpuCas01Action&) = delete; + int requested_core() const; + +private: + int requested_core_ = 1; }; -} -} +} // namespace resource +} // namespace kernel +} // namespace simgrid + +#endif