X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/638b21d2071c77f39da2f322156f05f75bf91517..f3da0e53f20a27db79c661314020550b7b9d0bcd:/src/surf/cpu_cas01.hpp diff --git a/src/surf/cpu_cas01.hpp b/src/surf/cpu_cas01.hpp index b98fd237e6..da01315ea7 100644 --- a/src/surf/cpu_cas01.hpp +++ b/src/surf/cpu_cas01.hpp @@ -1,12 +1,10 @@ -/* Copyright (c) 2013-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2013-2018. 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 - #include "cpu_interface.hpp" +#include "xbt/base.h" /*********** * Classes * @@ -25,21 +23,10 @@ class XBT_PRIVATE CpuCas01Action; class CpuCas01Model : public simgrid::surf::CpuModel { public: - CpuCas01Model(); - ~CpuCas01Model(); - - double (CpuCas01Model::*shareResources)(double now); - void (CpuCas01Model::*updateActionsState)(double now, double delta); + explicit CpuCas01Model(kernel::resource::Model::UpdateAlgo algo); + ~CpuCas01Model() override; - Cpu *createCpu(const char *name, xbt_dynar_t speedPeak, int pstate, - double speedScale, - tmgr_trace_t speedTrace, int core, - e_surf_resource_state_t state_initial, - tmgr_trace_t state_trace, - xbt_dict_t cpu_properties); - double shareResourcesFull(double now); - void addTraces(); - ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked; + Cpu *createCpu(simgrid::s4u::Host *host, std::vector *speedPerPstate, int core) override; }; /************ @@ -48,45 +35,35 @@ public: class CpuCas01 : public Cpu { public: - CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t speedPeak, - int pstate, double speedScale, tmgr_trace_t speedTrace, int core, - e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace, - xbt_dict_t properties) ; - ~CpuCas01(); - void updateState(tmgr_trace_event_t event_type, double value, double date); - CpuAction *execute(double size); - CpuAction *sleep(double duration); - - double getCurrentPowerPeak(); - double getPowerPeakAt(int pstate_index); - int getNbPstates(); - void setPstate(int pstate_index); - int getPstate(); - bool isUsed(); - void setStateEvent(tmgr_trace_event_t stateEvent); - void setPowerEvent(tmgr_trace_event_t stateEvent); - xbt_dynar_t getSpeedPeakList(); + CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, std::vector *speedPerPstate, int core); + ~CpuCas01() override; + void apply_event(tmgr_trace_event_t event, double value) override; + CpuAction* execution_start(double size) override; + CpuAction* execution_start(double size, int requestedCore) override; + CpuAction* sleep(double duration) override; - int getPState(); + bool is_used() override; -private: - tmgr_trace_event_t p_stateEvent; - tmgr_trace_event_t p_speedEvent; - xbt_dynar_t p_speedPeakList; /*< List of supported CPU capacities (pstate related) */ - int m_pstate; /*< Current pstate (index in the speedPeakList)*/ +protected: + void onSpeedChange() override; }; /********** * Action * **********/ class CpuCas01Action: public CpuAction { - friend CpuAction *CpuCas01::execute(double size); + 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); + CpuCas01Action(kernel::resource::Model* model, double cost, bool failed, double speed, + kernel::lmm::Constraint* constraint, int coreAmount); + CpuCas01Action(kernel::resource::Model* model, double cost, bool failed, double speed, + kernel::lmm::Constraint* constraint); + ~CpuCas01Action() override; + int requested_core(); - ~CpuCas01Action() {}; +private: + int requested_core_ = 1; }; }