X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5b3677b425b9cc6949c1573d59ac772540cbf4b2..5f9b13c6302e914a514168da8ff54818c0ee6787:/src/surf/cpu_cas01.hpp diff --git a/src/surf/cpu_cas01.hpp b/src/surf/cpu_cas01.hpp index 3f8ccb1483..d2022aae48 100644 --- a/src/surf/cpu_cas01.hpp +++ b/src/surf/cpu_cas01.hpp @@ -1,92 +1,75 @@ -/* Copyright (c) 2013-2014. 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. */ +#include + #include "cpu_interface.hpp" /*********** * Classes * ***********/ -class CpuCas01Model; -typedef CpuCas01Model *CpuCas01ModelPtr; -class CpuCas01; -typedef CpuCas01 *CpuCas01Ptr; +namespace simgrid { +namespace surf { -class CpuCas01Action; -typedef CpuCas01Action *CpuCas01ActionPtr; +class XBT_PRIVATE CpuCas01Model; +class XBT_PRIVATE CpuCas01; +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); - - void parseInit(sg_platf_host_cbarg_t host); - CpuPtr createResource(const char *name, xbt_dynar_t power_peak, int pstate, - double power_scale, - tmgr_trace_t power_trace, 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(); - ActionListPtr p_cpuRunningActionSetThatDoesNotNeedBeingChecked; + Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak, int pstate, + double speedScale, + tmgr_trace_t speedTrace, int core, + int initiallyOn, + tmgr_trace_t state_trace) override; + double next_occuring_event_full(double now) override; + ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked; }; /************ * Resource * ************/ -/* - * Energy-related properties for the cpu_cas01 model - */ -typedef struct energy_cpu_cas01 { - xbt_dynar_t power_range_watts_list; /*< List of (min_power,max_power) pairs corresponding to each cpu pstate */ - double total_energy; /*< Total energy consumed by the host */ - double last_updated; /*< Timestamp of the last energy update event*/ -} s_energy_cpu_cas01_t, *energy_cpu_cas01_t; class CpuCas01 : public Cpu { -public://FIXME: - tmgr_trace_event_t p_stateEvent; public: - CpuCas01(CpuCas01ModelPtr model, const char *name, xbt_dynar_t power_peak, - int pstate, double powerScale, tmgr_trace_t powerTrace, int core, - e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace, - xbt_dict_t properties) ; + CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, + int pstate, double speedScale, tmgr_trace_t speedTrace, int core, + int initiallyOn, tmgr_trace_t stateTrace) ; ~CpuCas01(); - void updateState(tmgr_trace_event_t event_type, double value, double date); - CpuActionPtr execute(double size); - CpuActionPtr sleep(double duration); + void apply_event(tmgr_trace_iterator_t event, double value) override; + CpuAction *execution_start(double size) override; + CpuAction *sleep(double duration) override; - double getCurrentPowerPeak(); - double getPowerPeakAt(int pstate_index); - int getNbPstates(); - void setPowerPeakAt(int pstate_index); + bool isUsed() override; - bool isUsed(); + xbt_dynar_t getSpeedPeakList(); // FIXME: killme to hide our internals - tmgr_trace_event_t p_powerEvent; - xbt_dynar_t p_powerPeakList; /*< List of supported CPU capacities */ - int m_pstate; /*< Current pstate (index in the power_peak_list)*/ +protected: + void onSpeedChange() override; }; /********** * Action * **********/ class CpuCas01Action: public CpuAction { - friend CpuActionPtr CpuCas01::execute(double size); - friend CpuActionPtr CpuCas01::sleep(double duration); + friend CpuAction *CpuCas01::execution_start(double size); + friend CpuAction *CpuCas01::sleep(double duration); public: - CpuCas01Action() {}; - CpuCas01Action(ModelPtr model, double cost, bool failed, double power, lmm_constraint_t constraint); + CpuCas01Action(Model *model, double cost, bool failed, double speed, + lmm_constraint_t constraint); ~CpuCas01Action() {}; }; + +} +}