X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/283236f8e2414d7c30d46e6d1aea0e8882699dd1..e8b0c2495697cb3be4ea22a4b356e92d118e5a82:/src/surf/cpu_cas01.hpp?ds=sidebyside diff --git a/src/surf/cpu_cas01.hpp b/src/surf/cpu_cas01.hpp index 17895d577b..e3f03b5c11 100644 --- a/src/surf/cpu_cas01.hpp +++ b/src/surf/cpu_cas01.hpp @@ -1,16 +1,19 @@ -#include "cpu.hpp" +/* Copyright (c) 2013-2015. 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 CpuCas01Lmm; -typedef CpuCas01Lmm *CpuCas01LmmPtr; - -class CpuCas01ActionLmm; -typedef CpuCas01ActionLmm *CpuCas01ActionLmmPtr; +class XBT_PRIVATE CpuCas01Model; +class XBT_PRIVATE CpuCas01; +class XBT_PRIVATE CpuCas01Action; /********* * Model * @@ -23,39 +26,60 @@ public: double (CpuCas01Model::*shareResources)(double now); void (CpuCas01Model::*updateActionsState)(double now, double delta); - void parseInit(sg_platf_host_cbarg_t host); - CpuCas01LmmPtr createResource(const char *name, double power_peak, double power_scale, - tmgr_trace_t power_trace, int core, + 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); + double shareResourcesFull(double now); void addTraces(); + ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked; }; /************ * Resource * ************/ -class CpuCas01Lmm : public CpuLmm { + +class CpuCas01 : public Cpu { public: - CpuCas01Lmm(CpuCas01ModelPtr model, const char *name, double powerPeak, - double powerScale, tmgr_trace_t powerTrace, int core, + CpuCas01(CpuCas01Model *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(); void updateState(tmgr_trace_event_t event_type, double value, double date); - CpuActionPtr execute(double size); - CpuActionPtr sleep(double duration); + 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 getPowerPeakList(); - tmgr_trace_event_t p_powerEvent; + 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)*/ }; /********** * Action * **********/ -class CpuCas01ActionLmm: public CpuActionLmm { +class CpuCas01Action: public CpuAction { + friend CpuAction *CpuCas01::execute(double size); + friend CpuAction *CpuCas01::sleep(double duration); public: - CpuCas01ActionLmm() {}; - CpuCas01ActionLmm(ModelPtr model, double cost, bool failed): Action(model, cost, failed), CpuActionLmm(model, cost, failed) {}; + CpuCas01Action(Model *model, double cost, bool failed, double power, + lmm_constraint_t constraint); + + ~CpuCas01Action() {}; };