// Run a task
start = MSG_get_clock();
- XBT_INFO("Run a task for 100E6 flops");
task1 = MSG_task_create ("t1", 100E6, 0, NULL);
+ XBT_INFO("Run a task of %.0E flops",MSG_task_get_flops_amount(task1));
MSG_task_execute (task1);
MSG_task_destroy(task1);
XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Current consumption: from %.0fW to %.0fW depending on load; Energy dissipated=%.0f J",
// ========= Change power peak =========
int pstate=2;
MSG_host_set_pstate(host, pstate);
- XBT_INFO("========= Requesting pstate %d (speed should be of %.2f flop/s and is of %.2f flop/s)",
+ XBT_INFO("========= Requesting pstate %d (speed should be of %.0E flop/s and is of %.0E flop/s)",
pstate,
MSG_host_get_power_peak_at(host, pstate),
MSG_host_get_current_power_peak(host));
// Run a second task
start = MSG_get_clock();
- XBT_INFO("Run a task for 100E6 flops");
task1 = MSG_task_create ("t2", 100E6, 0, NULL);
+ XBT_INFO("Run a task of %.0E flops",MSG_task_get_flops_amount(task1));
MSG_task_execute (task1);
MSG_task_destroy(task1);
XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
> [ 0.000000] (1:dvfs_test@MyHost1) Initial peak speed=1E+08 flop/s; Energy dissipated =0E+00 J
> [ 0.000000] (1:dvfs_test@MyHost1) Sleep for 10 seconds
> [ 10.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=1E+08; Energy dissipated=1000.00 J
-> [ 10.000000] (1:dvfs_test@MyHost1) Run a task for 100E6 flops
+> [ 10.000000] (1:dvfs_test@MyHost1) Run a task of 1E+08 flops
> [ 11.000000] (1:dvfs_test@MyHost1) Task done (duration: 1.00 s). Current peak speed=1E+08 flop/s; Current consumption: from 100W to 200W depending on load; Energy dissipated=1200 J
-> [ 11.000000] (1:dvfs_test@MyHost1) ========= Requesting pstate 2 (speed should be of 20000000.00 flop/s and is of 20000000.00 flop/s)
-> [ 11.000000] (1:dvfs_test@MyHost1) Run a task for 100E6 flops
+> [ 11.000000] (1:dvfs_test@MyHost1) ========= Requesting pstate 2 (speed should be of 2E+07 flop/s and is of 2E+07 flop/s)
+> [ 11.000000] (1:dvfs_test@MyHost1) Run a task of 1E+08 flops
+> [ 16.000000] (1:dvfs_test@MyHost1) Task done (duration: 5.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=1950 J
+> [ 16.000000] (1:dvfs_test@MyHost1) Sleep for 4 seconds
+> [ 20.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 4.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=2310 J
+> [ 20.000000] (1:dvfs_test@MyHost1) Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated 2000 J so far.
+> [ 30.000000] (0:@) Total simulation time: 30.00
+> [ 30.000000] (0:@) Total energy of host MyHost1: 3210.000000 Joules
+> [ 30.000000] (0:@) Total energy of host MyHost2: 2100.000000 Joules
+> [ 30.000000] (0:@) Total energy of host MyHost3: 3000.000000 Joules
+> [ 30.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=3210 J
+
+p Test the same with the ptask model
+
+$ $SG_TEST_EXENV energy/consumption/energy_consumption$EXEEXT ${srcdir:=.}/../platforms/energy_platform.xml ${srcdir:=.}/energy/consumption/deployment_consumption.xml --cfg=host/model:ptask_L07 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [ 0.000000] (0:@) Configuration change: Set 'host/model' to 'ptask_L07'
+> [ 0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
+> [ 0.000000] (1:dvfs_test@MyHost1) Energetic profile: 100.0:200.0, 93.0:170.0, 90.0:150.0
+> [ 0.000000] (1:dvfs_test@MyHost1) Initial peak speed=1E+08 flop/s; Energy dissipated =0E+00 J
+> [ 0.000000] (1:dvfs_test@MyHost1) Sleep for 10 seconds
+> [ 10.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=1E+08; Energy dissipated=1000.00 J
+> [ 10.000000] (1:dvfs_test@MyHost1) Run a task of 1E+08 flops
+> [ 11.000000] (1:dvfs_test@MyHost1) Task done (duration: 1.00 s). Current peak speed=1E+08 flop/s; Current consumption: from 100W to 200W depending on load; Energy dissipated=1200 J
+> [ 11.000000] (1:dvfs_test@MyHost1) ========= Requesting pstate 2 (speed should be of 2E+07 flop/s and is of 2E+07 flop/s)
+> [ 11.000000] (1:dvfs_test@MyHost1) Run a task of 1E+08 flops
> [ 16.000000] (1:dvfs_test@MyHost1) Task done (duration: 5.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=1950 J
> [ 16.000000] (1:dvfs_test@MyHost1) Sleep for 4 seconds
> [ 20.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 4.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=2310 J
/* Note (hypervisor): for multicore, the bound value being passed to the
* surf layer should not be zero (i.e., unlimited). It should be the
- * capacity of a CPU core. */
+ * capacity of a CPU core.
+ *
+ * FIXME: this should probably not be part of Simix but of Surf directly.
+ * That bound is part of the performance model, not of the synchronization
+ */
if (bound == 0)
surf_cpu_action_set_bound(synchro->execution.surf_exec, sg_host_get_speed(issuer->host));
else
int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace)
: Cpu(model, host,
- lmm_constraint_new(model->getMaxminSystem(), this, core * speedScale * xbt_dynar_get_as(speedPeak, pstate, double)),
- core, xbt_dynar_get_as(speedPeak, pstate, double), speedScale,
+ lmm_constraint_new(model->getMaxminSystem(), this, core * speedScale * xbt_dynar_get_as(speedPeak, pstate, double)),
+ speedPeak, pstate,
+ core, xbt_dynar_get_as(speedPeak, pstate, double), speedScale,
stateInitial) {
p_speedEvent = NULL;
- // Copy the power peak array:
- p_speedPeakList = xbt_dynar_new(sizeof(double), nullptr);
- unsigned long n = xbt_dynar_length(speedPeak);
- for (unsigned long i = 0; i != n; ++i) {
- double value = xbt_dynar_get_as(speedPeak, i, double);
- xbt_dynar_push(p_speedPeakList, &value);
- }
-
- m_pstate = pstate;
-
XBT_DEBUG("CPU create: peak=%f, pstate=%d", m_speedPeak, m_pstate);
m_core = core;
return p_speedPeakList;
}
-int CpuCas01::getPState()
-{
- return m_pstate;
-}
-
bool CpuCas01::isUsed()
{
return lmm_constraint_used(getModel()->getMaxminSystem(), getConstraint());
return m_speedPeak;
}
-double CpuCas01::getPowerPeakAt(int pstate_index)
-{
- xbt_dynar_t plist = p_speedPeakList;
- xbt_assert((pstate_index <= (int)xbt_dynar_length(plist)), "Invalid parameters (pstate index out of bounds)");
-
- return xbt_dynar_get_as(plist, pstate_index, double);
-}
-
-int CpuCas01::getNbPstates()
-{
- return xbt_dynar_length(p_speedPeakList);
-}
-
-void CpuCas01::setPstate(int pstate_index)
-{
- xbt_dynar_t plist = p_speedPeakList;
- xbt_assert((pstate_index <= (int)xbt_dynar_length(plist)), "Invalid parameters (pstate index out of bounds)");
-
- double new_pstate = xbt_dynar_get_as(plist, pstate_index, double);
- m_pstate = pstate_index;
- m_speedPeak = new_pstate;
-}
-
-int CpuCas01::getPstate()
-{
- return m_pstate;
-}
-
/**********
* Action *
**********/
CpuAction *sleep(double duration);
double getCurrentPowerPeak();
- double getPowerPeakAt(int pstate_index);
- int getNbPstates();
- void setPstate(int pstate_index);
- int getPstate();
- bool isUsed();
+ bool isUsed() override;
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)*/
};
/**********
/* 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 <xbt/dynar.h>
#include "cpu_interface.hpp"
#include "plugins/energy.hpp"
Cpu::Cpu(Model *model, simgrid::Host *host,
- int core, double speedPeak, double speedScale,
+ xbt_dynar_t speedPeakList, int pstate,
+ int core, double speedPeak, double speedScale,
e_surf_resource_state_t stateInitial)
: Resource(model, host->getName().c_str(), stateInitial)
, m_core(core)
, m_host(host)
{
host->extension_set(Cpu::EXTENSION_ID, this);
+
+ // Copy the power peak array:
+ p_speedPeakList = xbt_dynar_new(sizeof(double), nullptr);
+ unsigned long n = xbt_dynar_length(speedPeakList);
+ for (unsigned long i = 0; i != n; ++i) {
+ double value = xbt_dynar_get_as(speedPeakList, i, double);
+ xbt_dynar_push(p_speedPeakList, &value);
+ }
+
+ m_pstate = pstate;
}
-Cpu::Cpu(Model *model, simgrid::Host *host,
- lmm_constraint_t constraint, int core, double speedPeak,
+Cpu::Cpu(Model *model, simgrid::Host *host, lmm_constraint_t constraint,
+ xbt_dynar_t speedPeakList, int pstate,
+ int core, double speedPeak,
double speedScale, e_surf_resource_state_t stateInitial)
: Resource(model, host->getName().c_str(), constraint, stateInitial)
, m_core(core)
, m_host(host)
{
host->extension_set(Cpu::EXTENSION_ID, this);
+
+ // Copy the power peak array:
+ p_speedPeakList = xbt_dynar_new(sizeof(double), nullptr);
+ unsigned long n = xbt_dynar_length(speedPeakList);
+ for (unsigned long i = 0; i != n; ++i) {
+ double value = xbt_dynar_get_as(speedPeakList, i, double);
+ xbt_dynar_push(p_speedPeakList, &value);
+ }
+
+ m_pstate = pstate;
+
/* Currently, we assume that a VM does not have a multicore CPU. */
if (core > 1)
xbt_assert(model == surf_cpu_model_pm);
}
}
-Cpu::Cpu(Model *model, simgrid::Host *host,
- lmm_constraint_t constraint, int core, double speedPeak, double speedScale)
-: Cpu(model, host, constraint, core, speedPeak, speedScale, SURF_RESOURCE_ON)
-{}
+Cpu::Cpu(Model *model, simgrid::Host *host, lmm_constraint_t constraint,
+ xbt_dynar_t speedPeakList, int pstate,
+ int core, double speedPeak, double speedScale)
+: Cpu(model, host, constraint, speedPeakList, pstate, core, speedPeak, speedScale, SURF_RESOURCE_ON)
+{
+ xbt_assert(0,"FIXME: this constructor could be removed");
+}
Cpu::Cpu(Model *model, simgrid::Host *host,
+ xbt_dynar_t speedPeakList, int pstate,
int core, double speedPeak, double speedScale)
-: Cpu(model, host, core, speedPeak, speedScale, SURF_RESOURCE_ON)
+: Cpu(model, host, speedPeakList, pstate, core, speedPeak, speedScale, SURF_RESOURCE_ON)
{}
Cpu::~Cpu()
return m_speedPeak;
}
+int Cpu::getNbPStates()
+{
+ return xbt_dynar_length(p_speedPeakList);
+}
+
+void Cpu::setPState(int pstate_index)
+{
+ xbt_dynar_t plist = p_speedPeakList;
+ xbt_assert(pstate_index <= (int)xbt_dynar_length(plist),
+ "Invalid parameters for CPU %s (pstate %d > length of pstates %d)", getName(), pstate_index, (int)xbt_dynar_length(plist));
+
+ double new_peak_speed = xbt_dynar_get_as(plist, pstate_index, double);
+ m_pstate = pstate_index;
+ m_speedPeak = new_peak_speed;
+}
+
+int Cpu::getPState()
+{
+ return m_pstate;
+}
+
+double Cpu::getPowerPeakAt(int pstate_index)
+{
+ xbt_dynar_t plist = p_speedPeakList;
+ xbt_assert((pstate_index <= (int)xbt_dynar_length(plist)), "Invalid parameters (pstate index out of bounds)");
+
+ return xbt_dynar_get_as(plist, pstate_index, double);
+}
+
double Cpu::getSpeed(double load)
{
return load * m_speedPeak;
* @param speedScale The speed scale of this Cpu in [0;1] (available amount)
* @param stateInitial whether it is created running or crashed
*/
- Cpu(simgrid::surf::Model *model, simgrid::Host *host,
- lmm_constraint_t constraint, int core, double speedPeak, double speedScale,
+ Cpu(simgrid::surf::Model *model, simgrid::Host *host, lmm_constraint_t constraint,
+ xbt_dynar_t speedPeakList, int pstate,
+ int core, double speedPeak, double speedScale,
e_surf_resource_state_t stateInitial);
/**
* @param stateInitial whether it is created running or crashed
*/
Cpu(simgrid::surf::Model *model, simgrid::Host *host,
+ xbt_dynar_t speedPeakList, int pstate,
int core, double speedPeak, double speedScale,
e_surf_resource_state_t stateInitial);
+ Cpu(simgrid::surf::Model *model, simgrid::Host *host, lmm_constraint_t constraint,
+ xbt_dynar_t speedPeakList, int pstate,
+ int core, double speedPeak, double speedScale);
Cpu(simgrid::surf::Model *model, simgrid::Host *host,
- lmm_constraint_t constraint, int core, double speedPeak, double speedScale);
- Cpu(simgrid::surf::Model *model, simgrid::Host *host,
+ xbt_dynar_t speedPeakList, int pstate,
int core, double speedPeak, double speedScale);
~Cpu();
/** @brief Get the current Cpu power peak */
virtual double getCurrentPowerPeak();
- virtual double getPowerPeakAt(int pstate_index)=0;
+ virtual double getPowerPeakAt(int pstate_index);
- virtual int getNbPstates()=0;
- virtual void setPstate(int pstate_index)=0;
- virtual int getPstate()=0;
+ virtual int getNbPStates();
+ virtual void setPState(int pstate_index);
+ virtual int getPState();
void addTraces(void);
simgrid::Host* getHost() { return m_host; }
double m_speedScale; /*< Percentage of CPU available according to the trace, in [O,1] */
simgrid::Host* m_host;
+ xbt_dynar_t p_speedPeakList = NULL; /*< List of supported CPU capacities (pstate related) */
+ int m_pstate = 0; /*< Current pstate (index in the speedPeakList)*/
+
/* Note (hypervisor): */
lmm_constraint_t *p_constraintCore=NULL;
void **p_constraintCoreId=NULL;
CpuTi::CpuTi(CpuTiModel *model, simgrid::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)
- : Cpu(model, host, core, 0, speedScale, stateInitial)
+ : Cpu(model, host, NULL, pstate, core, 0, speedScale, stateInitial)
{
p_speedEvent = NULL;
m_speedScale = speedScale;
HostL07Model::HostL07Model() : HostModel() {
if (!ptask_maxmin_system)
ptask_maxmin_system = lmm_system_new(1);
+ p_maxminSystem = ptask_maxmin_system;
surf_host_model = NULL;
- surf_network_model = new NetworkL07Model(this);
- surf_cpu_model_pm = new CpuL07Model(this);
+ surf_network_model = new NetworkL07Model(this,ptask_maxmin_system);
+ surf_cpu_model_pm = new CpuL07Model(this,ptask_maxmin_system);
routing_model_create(surf_network_model->createLink("__loopback__",
498000000, NULL,
delete surf_network_model;
ptask_host_count = 0;
- if (ptask_maxmin_system) {
- lmm_system_free(ptask_maxmin_system);
- ptask_maxmin_system = NULL;
- }
+ ptask_maxmin_system = NULL; // freed as part of ~Model (it's also stored as p_maxminSystem)
+}
+
+CpuL07Model::CpuL07Model(HostL07Model *hmodel,lmm_system_t sys)
+ : CpuModel()
+ , p_hostModel(hmodel)
+ {
+ p_maxminSystem = sys;
+ }
+CpuL07Model::~CpuL07Model() {
+ surf_cpu_model_pm = NULL;
+ p_maxminSystem = NULL; // Avoid multi-free
+}
+NetworkL07Model::NetworkL07Model(HostL07Model *hmodel, lmm_system_t sys)
+ : NetworkModel()
+ , p_hostModel(hmodel)
+ {
+ p_maxminSystem = sys;
+ }
+NetworkL07Model::~NetworkL07Model()
+{
+ surf_network_model = NULL;
+ p_maxminSystem = NULL; // Avoid multi-free
}
+
double HostL07Model::shareResources(double /*now*/)
{
L07Action *action;
L07Action *action = new L07Action(this, 1, 0);
unsigned int cpt;
int nb_link = 0;
- int nb_host = 0;
+ int nb_used_host = 0; /* Only the hosts with something to compute (>0 flops) are counted) */
double latency = 0.0;
action->p_edgeList->reserve(host_nb);
for (int i = 0; i < host_nb; i++)
if (flops_amount[i] > 0)
- nb_host++;
+ nb_used_host++;
XBT_DEBUG("Creating a parallel task (%p) with %d cpus and %d links.",
action, host_nb, nb_link);
}
}
- if (nb_link + nb_host == 0) {
+ if (nb_link + nb_used_host == 0) {
action->setCost(1.0);
action->setRemains(0.0);
}
return res;
}
-Cpu *CpuL07Model::createCpu(simgrid::Host *host, xbt_dynar_t powerPeak,
+Cpu *CpuL07Model::createCpu(simgrid::Host *host, xbt_dynar_t powerPeakList,
int pstate, double power_scale,
tmgr_trace_t power_trace, int core,
e_surf_resource_state_t state_initial,
tmgr_trace_t state_trace)
{
- double power_initial = xbt_dynar_get_as(powerPeak, pstate, double);
- CpuL07 *cpu = new CpuL07(this, host, power_initial, power_scale, power_trace,
+ CpuL07 *cpu = new CpuL07(this, host, powerPeakList, pstate, power_scale, power_trace,
core, state_initial, state_trace);
return cpu;
}
/************
* Resource *
************/
+
CpuL07::CpuL07(CpuL07Model *model, simgrid::Host *host,
- double speedInitial, double speedScale, tmgr_trace_t speedTrace,
- int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace)
- : Cpu(model, host, lmm_constraint_new(ptask_maxmin_system, this, speedInitial * speedScale),
- core, speedInitial, speedScale, state_initial)
+ xbt_dynar_t speedPeakList, int pstate,
+ double speedScale, tmgr_trace_t speedTrace,
+ int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace)
+ : Cpu(model, host, speedPeakList, pstate,
+ core, xbt_dynar_get_as(speedPeakList,pstate,double), speedScale, state_initial)
{
xbt_assert(m_speedScale > 0, "Power has to be >0");
+ p_constraint = lmm_constraint_new(ptask_maxmin_system, this, xbt_dynar_get_as(speedPeakList,pstate,double) * speedScale);
if (speedTrace)
p_speedEvent = tmgr_history_add_trace(history, speedTrace, 0.0, 0, this);
class CpuL07Model : public CpuModel {
public:
- CpuL07Model(HostL07Model *hmodel) : CpuModel() {p_hostModel = hmodel;};
- ~CpuL07Model() {surf_cpu_model_pm = NULL;};
+ CpuL07Model(HostL07Model *hmodel,lmm_system_t sys);
+ ~CpuL07Model();
- Cpu *createCpu(simgrid::Host *host, xbt_dynar_t speedPeak,
+ Cpu *createCpu(simgrid::Host *host, xbt_dynar_t speedPeakList,
int pstate, double speedScale,
tmgr_trace_t speedTrace, int core,
e_surf_resource_state_t state_initial,
class NetworkL07Model : public NetworkModel {
public:
- NetworkL07Model(HostL07Model *hmodel) : NetworkModel() {p_hostModel = hmodel;};
- ~NetworkL07Model() {surf_network_model = NULL;};
+ NetworkL07Model(HostL07Model *hmodel, lmm_system_t sys);
+ ~NetworkL07Model();
Link* createLink(const char *name,
double bw_initial,
tmgr_trace_t bw_trace,
tmgr_trace_event_t p_stateEvent;
tmgr_trace_event_t p_speedEvent;
public:
- CpuL07(CpuL07Model *model, simgrid::Host *host,
- double power_scale, double power_initial, tmgr_trace_t power_trace,
+ CpuL07(CpuL07Model *model, simgrid::Host *host, xbt_dynar_t speedPeakList, int pstate,
+ double power_scale, tmgr_trace_t power_trace,
int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace);
~CpuL07();
bool isUsed() override;
void updateState(tmgr_trace_event_t event_type, double value, double date) override;
Action *execute(double size) override;
Action *sleep(double duration) override;
-
- double getCurrentPowerPeak() override {THROW_UNIMPLEMENTED;};
- double getPowerPeakAt(int /*pstate_index*/) override {THROW_UNIMPLEMENTED;};
- int getNbPstates() override {THROW_UNIMPLEMENTED;};
- void setPstate(int /*pstate_index*/) override {THROW_UNIMPLEMENTED;};
- int getPstate() override {THROW_UNIMPLEMENTED;};
};
class LinkL07 : public Link {
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <src/surf/plugins/energy.hpp>
-#include <src/surf/cpu_cas01.hpp>
+#include <src/surf/cpu_interface.hpp>
#include <src/surf/virtual_machine.hpp>
/** @addtogroup SURF_plugin_energy
double HostEnergy::getWattMinAt(int pstate) {
xbt_dynar_t power_range_list = power_range_watts_list;
xbt_assert(power_range_watts_list, "No power range properties specified for host %s", host->getName());
- xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<simgrid::surf::CpuCas01*>(host->p_cpu)->getPState(), xbt_dynar_t);
+ xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, host->p_cpu->getPState(), xbt_dynar_t);
double min_power = xbt_dynar_get_as(current_power_values, 0, double);
return min_power;
}
double HostEnergy::getWattMaxAt(int pstate) {
xbt_dynar_t power_range_list = power_range_watts_list;
xbt_assert(power_range_watts_list, "No power range properties specified for host %s", host->getName());
- xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<simgrid::surf::CpuCas01*>(host->p_cpu)->getPState(), xbt_dynar_t);
+ xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, host->p_cpu->getPState(), xbt_dynar_t);
double max_power = xbt_dynar_get_as(current_power_values, 1, double);
return max_power;
}
xbt_dynar_t power_range_list = power_range_watts_list;
xbt_assert(power_range_watts_list, "No power range properties specified for host %s", host->getName());
+ int pstate = host->p_cpu->getPState();
+ xbt_assert(pstate < (int)xbt_dynar_length(power_range_list),
+ "pstate %d >= power range amound %d",pstate,(int)xbt_dynar_length(power_range_list));
/* retrieve the power values associated with the current pstate */
- xbt_dynar_t current_power_values = xbt_dynar_get_as( power_range_list,
- static_cast<simgrid::surf::CpuCas01*>(host->p_cpu)->getPState(),
- xbt_dynar_t);
+ xbt_dynar_t current_power_values = xbt_dynar_get_as( power_range_list, pstate, xbt_dynar_t);
/* min_power corresponds to the idle power (cpu load = 0) */
/* max_power is the power consumed at 100% cpu load */
}
int surf_host_get_nb_pstates(sg_host_t host){
- return sg_host_surfcpu(host)->getNbPstates();
+ return sg_host_surfcpu(host)->getNbPStates();
}
void surf_host_set_pstate(sg_host_t host, int pstate_index){
- sg_host_surfcpu(host)->setPstate(pstate_index);
+ sg_host_surfcpu(host)->setPState(pstate_index);
}
int surf_host_get_pstate(sg_host_t host){
- return sg_host_surfcpu(host)->getPstate();
+ return sg_host_surfcpu(host)->getPState();
}
using simgrid::energy::HostEnergy;
public: /* LMM */
/** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component */
lmm_constraint_t getConstraint();
-private:
+protected:
lmm_constraint_t p_constraint;
};