X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b23e1eb029a107cdc16abd13f0f4d3f0650f642a..5f9b13c6302e914a514168da8ff54818c0ee6787:/src/surf/cpu_cas01.hpp diff --git a/src/surf/cpu_cas01.hpp b/src/surf/cpu_cas01.hpp index fb1d02b6b2..d2022aae48 100644 --- a/src/surf/cpu_cas01.hpp +++ b/src/surf/cpu_cas01.hpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2013-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2013-2016. 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. */ @@ -11,6 +10,10 @@ /*********** * Classes * ***********/ + +namespace simgrid { +namespace surf { + class XBT_PRIVATE CpuCas01Model; class XBT_PRIVATE CpuCas01; class XBT_PRIVATE CpuCas01Action; @@ -18,22 +21,18 @@ class XBT_PRIVATE CpuCas01Action; /********* * Model * *********/ -class CpuCas01Model : public CpuModel { + +class CpuCas01Model : public simgrid::surf::CpuModel { public: CpuCas01Model(); ~CpuCas01Model(); - double (CpuCas01Model::*shareResources)(double now); - void (CpuCas01Model::*updateActionsState)(double now, double delta); - - Cpu *createCpu(const char *name, xbt_dynar_t speedPeak, int pstate, + Cpu *createCpu(simgrid::s4u::Host *host, 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(); + int initiallyOn, + tmgr_trace_t state_trace) override; + double next_occuring_event_full(double now) override; ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked; }; @@ -43,39 +42,27 @@ public: class CpuCas01 : public Cpu { public: - CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t speedPeak, + CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, 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) ; + int initiallyOn, tmgr_trace_t stateTrace) ; ~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(); - - int getPState(); - -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)*/ + void apply_event(tmgr_trace_iterator_t event, double value) override; + CpuAction *execution_start(double size) override; + CpuAction *sleep(double duration) override; + + bool isUsed() override; + + xbt_dynar_t getSpeedPeakList(); // FIXME: killme to hide our internals + +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, @@ -83,3 +70,6 @@ public: ~CpuCas01Action() {}; }; + +} +}