X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6cc4e43479c46e58586d91af850f5420f4d77312..6a6c1a432ee6568c58d74d31746544e6afabdf6f:/src/surf/cpu_ti.hpp diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 10ec1b030f..cf4016b6e4 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -4,6 +4,8 @@ /* 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 "trace_mgr_private.h" #include "surf/surf_routing.h" @@ -14,18 +16,13 @@ /*********** * Classes * ***********/ -class CpuTiTrace; -class CpuTiTgmr; -class CpuTiModel; -class CpuTi; -class CpuTiAction; - -typedef boost::intrusive::list CpuTiList; -typedef boost::intrusive::list_base_hook<> cpuTiHook; +class XBT_PRIVATE CpuTiTrace; +class XBT_PRIVATE CpuTiTgmr; +class XBT_PRIVATE CpuTiModel; +class XBT_PRIVATE CpuTi; +class XBT_PRIVATE CpuTiAction; struct tiTag; -typedef boost::intrusive::list > > > ActionTiList; -typedef boost::intrusive::list_base_hook > actionTiHook; /********* * Trace * @@ -75,40 +72,48 @@ public: tmgr_trace_t p_powerTrace; }; -/********* - * Model * - *********/ -class CpuTiModel : public CpuModel { -public: - CpuTiModel(); - ~CpuTiModel(); - Cpu *createCpu(const char *name, xbt_dynar_t powerPeak, - 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 shareResources(double now); - void updateActionsState(double now, double delta); - void addTraces(); +/********** + * Action * + **********/ - ActionList *p_runningActionSetThatDoesNotNeedBeingChecked; - CpuTiList *p_modifiedCpu; - xbt_heap_t p_tiActionHeap; +class CpuTiAction: public CpuAction { + friend class CpuTi; + // friend CpuAction *CpuTi::execute(double size); + // friend CpuAction *CpuTi::sleep(double duration); + // friend void CpuTi::updateActionsFinishTime(double now);//FIXME + // friend void CpuTi::updateRemainingAmount(double now);//FIXME +public: + CpuTiAction(CpuTiModel *model, double cost, bool failed, + CpuTi *cpu); -protected: - void NotifyResourceTurnedOn(Resource*){}; - void NotifyResourceTurnedOff(Resource*){}; + void setState(e_surf_action_state_t state); + int unref(); + void cancel(); + void updateIndexHeap(int i); + void suspend(); + void resume(); + bool isSuspended(); + void setMaxDuration(double duration); + void setPriority(double priority); + double getRemains(); + void setAffinity(Cpu * /*cpu*/, unsigned long /*mask*/) {}; - void NotifyActionCancel(Action*){}; - void NotifyActionResume(Action*){}; - void NotifyActionSuspend(Action*){}; + CpuTi *p_cpu; + int m_indexHeap; + int m_suspended; +public: + boost::intrusive::list_member_hook<> action_ti_hook; }; +typedef boost::intrusive::member_hook< + CpuTiAction, boost::intrusive::list_member_hook<>, &CpuTiAction::action_ti_hook> ActionTiListOptions; +typedef boost::intrusive::list< + CpuTiAction, ActionTiListOptions > ActionTiList; + /************ * Resource * ************/ -class CpuTi : public cpuTiHook, public Cpu { +class CpuTi : public Cpu { public: CpuTi() {}; CpuTi(CpuTiModel *model, const char *name, xbt_dynar_t powerPeak, @@ -142,36 +147,40 @@ public: double current_frequency; void updateRemainingAmount(double now); +public: + boost::intrusive::list_member_hook<> cpu_ti_hook; }; -/********** - * Action * - **********/ - -class CpuTiAction: public actionTiHook, public CpuAction { - friend CpuAction *CpuTi::execute(double size); - friend CpuAction *CpuTi::sleep(double duration); - friend void CpuTi::updateActionsFinishTime(double now);//FIXME - friend void CpuTi::updateRemainingAmount(double now);//FIXME +typedef boost::intrusive::member_hook< + CpuTi, boost::intrusive::list_member_hook<>, &CpuTi::cpu_ti_hook> CpuTiListOptions; +typedef boost::intrusive::list CpuTiList; +/********* + * Model * + *********/ +class CpuTiModel : public CpuModel { public: - CpuTiAction(CpuTiModel *model, double cost, bool failed, - CpuTi *cpu); + CpuTiModel(); + ~CpuTiModel(); + Cpu *createCpu(const char *name, xbt_dynar_t powerPeak, + 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 shareResources(double now); + void updateActionsState(double now, double delta); + void addTraces(); - void setState(e_surf_action_state_t state); - int unref(); - void cancel(); - void updateIndexHeap(int i); - void suspend(); - void resume(); - bool isSuspended(); - void setMaxDuration(double duration); - void setPriority(double priority); - double getRemains(); - void setAffinity(Cpu * /*cpu*/, unsigned long /*mask*/) {}; + ActionList *p_runningActionSetThatDoesNotNeedBeingChecked; + CpuTiList *p_modifiedCpu; + xbt_heap_t p_tiActionHeap; - CpuTi *p_cpu; - int m_indexHeap; - int m_suspended; -private: +protected: + void NotifyResourceTurnedOn(Resource*){}; + void NotifyResourceTurnedOff(Resource*){}; + + void NotifyActionCancel(Action*){}; + void NotifyActionResume(Action*){}; + void NotifyActionSuspend(Action*){}; };