2 #include "trace_mgr_private.h"
3 #include "surf/surf_routing.h"
6 #define EPSILON 0.000000001
12 typedef CpuTiModel *CpuTiModelPtr;
15 typedef CpuTi *CpuTiPtr;
18 typedef CpuTiAction *CpuTiActionPtr;
23 typedef struct surf_cpu_ti_trace {
27 } s_surf_cpu_ti_trace_t, *surf_cpu_ti_trace_t;
30 TRACE_FIXED, /*< Trace fixed, no availability file */
31 TRACE_DYNAMIC /*< Dynamic, availability file disponible */
33 typedef struct surf_cpu_ti_tgmr {
36 double value; /*< Percentage of cpu power disponible. Value fixed between 0 and 1 */
39 double last_time; /*< Integral interval last point (discret time) */
40 double total; /*< Integral total between 0 and last_pointn */
42 surf_cpu_ti_trace_t trace;
43 tmgr_trace_t power_trace;
45 } s_surf_cpu_ti_tgmr_t, *surf_cpu_ti_tgmr_t;
51 class CpuTiModel : public CpuModel {
56 CpuTiPtr createResource(string name, double power_peak, double power_scale,
57 tmgr_trace_t power_trace, int core,
58 e_surf_resource_state_t state_initial,
59 tmgr_trace_t state_trace,
60 xbt_dict_t cpu_properties);
61 CpuTiActionPtr createAction(double cost, bool failed);
64 void NotifyResourceTurnedOn(ResourcePtr r){};
65 void NotifyResourceTurnedOff(ResourcePtr r){};
67 void NotifyActionCancel(ActionPtr a){};
68 void NotifyActionResume(ActionPtr a){};
69 void NotifyActionSuspend(ActionPtr a){};
75 class CpuTi : public Cpu {
77 CpuTi(CpuTiModelPtr model, string name, double powerPeak,
78 double powerScale, tmgr_trace_t powerTrace, int core,
79 e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
80 xbt_dict_t properties) ;
82 virtual double getSpeed (double load);
83 virtual double getAvailableSpeed ();
84 void printCpuTiModel();
85 CpuTiModelPtr getModel();
87 double m_powerPeak; /*< CPU power peak */
88 double m_powerScale; /*< Percentage of CPU disponible */
89 surf_cpu_ti_tgmr_t m_availTrace; /*< Structure with data needed to integrate trace file */
90 e_surf_resource_state_t m_stateCurrent; /*< CPU current state (ON or OFF) */
91 tmgr_trace_event_t m_stateEvent; /*< trace file with states events (ON or OFF) */
92 tmgr_trace_event_t m_powerEvent; /*< trace file with availabitly events */
93 std::vector<CpuTiActionPtr> m_actionSet; /*< set with all actions running on cpu */
94 s_xbt_swag_hookup_t m_modifiedCpuHookup; /*< hookup to swag that indicacates whether share resources must be recalculated or not */
95 double m_sumPriority; /*< the sum of actions' priority that are running on cpu */
96 double m_lastUpdate; /*< last update of actions' remaining amount done */
103 class CpuTiAction: public CpuAction {
105 CpuTiAction(CpuTiModelPtr model, double cost, bool failed): CpuAction(model, cost, failed) {};
107 virtual double getRemains();
108 virtual double getStartTime();
109 virtual double getFinishTime();