From b23e1eb029a107cdc16abd13f0f4d3f0650f642a Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 4 Dec 2015 13:56:50 +0100 Subject: [PATCH] Rename power->speed in the inner layer of the parsing --- examples/msg/bittorrent/bittorrent_platfgen.c | 8 +-- .../masterslave_failure_platfgen.c | 10 ++-- .../msg/masterslave/masterslave_platfgen.c | 8 +-- examples/msg/token_ring/token_bypass.c | 12 ++--- include/simgrid/platf.h | 12 ++--- include/surf/surfxml_parse.h | 2 +- src/bindings/lua/lua_platf.c | 12 ++--- src/include/surf/surf.h | 2 +- src/instr/instr_config.c | 2 +- src/instr/instr_private.h | 2 +- src/surf/cpu_cas01.cpp | 38 +++++++------- src/surf/cpu_cas01.hpp | 8 +-- src/surf/cpu_interface.cpp | 6 +-- src/surf/cpu_ti.hpp | 8 +-- src/surf/instr_routing.cpp | 18 +++---- src/surf/instr_surf.c | 4 +- src/surf/sg_platf.cpp | 6 +-- src/surf/surf_private.h | 2 +- src/surf/surf_routing.cpp | 32 ++++++------ src/surf/surfxml_parse.c | 51 +++++++++---------- src/surf/vm_hl13.cpp | 2 +- 21 files changed, 122 insertions(+), 123 deletions(-) diff --git a/examples/msg/bittorrent/bittorrent_platfgen.c b/examples/msg/bittorrent/bittorrent_platfgen.c index f5f34d2d44..b15116bf1e 100644 --- a/examples/msg/bittorrent/bittorrent_platfgen.c +++ b/examples/msg/bittorrent/bittorrent_platfgen.c @@ -32,12 +32,12 @@ void promoter(context_node_t node) host_parameters.id = NULL; //Power from 3,000,000 to 10,000,000 - host_parameters.power_peak = xbt_dynar_new(sizeof(double), NULL); - xbt_dynar_push_as(host_parameters.power_peak, double, + host_parameters.speed_peak = xbt_dynar_new(sizeof(double), NULL); + xbt_dynar_push_as(host_parameters.speed_peak, double, 7000000 * RngStream_RandU01(rng_stream) + 3000000.0); host_parameters.core_amount = 1; - host_parameters.power_scale = 1; - host_parameters.power_trace = NULL; + host_parameters.speed_scale = 1; + host_parameters.speed_trace = NULL; host_parameters.initial_state = SURF_RESOURCE_ON; host_parameters.state_trace = NULL; host_parameters.coord = NULL; diff --git a/examples/msg/masterslave/masterslave_failure_platfgen.c b/examples/msg/masterslave/masterslave_failure_platfgen.c index cec29c9258..28e8fdf0c7 100644 --- a/examples/msg/masterslave/masterslave_failure_platfgen.c +++ b/examples/msg/masterslave/masterslave_failure_platfgen.c @@ -41,11 +41,11 @@ void promoter_1(context_node_t node) { static int master_choosen = FALSE; host_parameters.id = NULL; - host_parameters.power_peak = xbt_dynar_new(sizeof(double), NULL); - xbt_dynar_push_as(host_parameters.power_peak, double, 25000000.0); + host_parameters.speed_peak = xbt_dynar_new(sizeof(double), NULL); + xbt_dynar_push_as(host_parameters.speed_peak, double, 25000000.0); host_parameters.core_amount = 1; - host_parameters.power_scale = 1; - host_parameters.power_trace = NULL; + host_parameters.speed_scale = 1; + host_parameters.speed_trace = NULL; host_parameters.initial_state = SURF_RESOURCE_ON; host_parameters.state_trace = NULL; host_parameters.coord = NULL; @@ -62,7 +62,7 @@ void promoter_1(context_node_t node) { tmgr_event_generator_new_uniform(pw_date_generator_id, 5, 10); probabilist_event_generator_t pw_value_generator = tmgr_event_generator_new_uniform(pw_value_generator_id, 0.6, 1.0); - host_parameters.power_trace = + host_parameters.speed_trace = tmgr_trace_generator_value(bprintf("pw_host_%ld", node->id), pw_date_generator, pw_value_generator); diff --git a/examples/msg/masterslave/masterslave_platfgen.c b/examples/msg/masterslave/masterslave_platfgen.c index 733420747f..06db03e3e9 100644 --- a/examples/msg/masterslave/masterslave_platfgen.c +++ b/examples/msg/masterslave/masterslave_platfgen.c @@ -28,11 +28,11 @@ void promoter_1(context_node_t node) { s_sg_platf_host_cbarg_t host_parameters; host_parameters.id = NULL; - host_parameters.power_peak = xbt_dynar_new(sizeof(double), NULL); - xbt_dynar_push_as(host_parameters.power_peak, double, 1000000.0); + host_parameters.speed_peak = xbt_dynar_new(sizeof(double), NULL); + xbt_dynar_push_as(host_parameters.speed_peak, double, 1000000.0); host_parameters.core_amount = 1; - host_parameters.power_scale = 1; - host_parameters.power_trace = NULL; + host_parameters.speed_scale = 1; + host_parameters.speed_trace = NULL; host_parameters.initial_state = SURF_RESOURCE_ON; host_parameters.state_trace = NULL; host_parameters.coord = NULL; diff --git a/examples/msg/token_ring/token_bypass.c b/examples/msg/token_ring/token_bypass.c index eb1f655455..64e840d6c5 100644 --- a/examples/msg/token_ring/token_bypass.c +++ b/examples/msg/token_ring/token_bypass.c @@ -67,17 +67,17 @@ static int surf_parse_bypass_platform(void) s_sg_platf_host_cbarg_t bob = SG_PLATF_HOST_INITIALIZER; bob.id = "bob"; - bob.power_peak = xbt_dynar_new(sizeof(double), NULL); - xbt_dynar_push_as(bob.power_peak, double, 98095000.0); + bob.speed_peak = xbt_dynar_new(sizeof(double), NULL); + xbt_dynar_push_as(bob.speed_peak, double, 98095000.0); sg_platf_new_host(&bob); - xbt_dynar_free(&bob.power_peak); + xbt_dynar_free(&bob.speed_peak); s_sg_platf_host_cbarg_t alice = SG_PLATF_HOST_INITIALIZER; alice.id = "alice"; - alice.power_peak = xbt_dynar_new(sizeof(double), NULL); - xbt_dynar_push_as(alice.power_peak, double, 98095000.0); + alice.speed_peak = xbt_dynar_new(sizeof(double), NULL); + xbt_dynar_push_as(alice.speed_peak, double, 98095000.0); sg_platf_new_host(&alice); - xbt_dynar_free(&alice.power_peak); + xbt_dynar_free(&alice.speed_peak); s_sg_platf_link_cbarg_t link = SG_PLATF_LINK_INITIALIZER; link.id = "link1"; diff --git a/include/simgrid/platf.h b/include/simgrid/platf.h index ede827ad5a..0a0df2582b 100644 --- a/include/simgrid/platf.h +++ b/include/simgrid/platf.h @@ -108,11 +108,11 @@ typedef long long sg_offset_t; typedef struct { const char* id; - xbt_dynar_t power_peak; + xbt_dynar_t speed_peak; int pstate; int core_amount; - double power_scale; - tmgr_trace_t power_trace; + double speed_scale; + tmgr_trace_t speed_trace; e_surf_resource_state_t initial_state; tmgr_trace_t state_trace; const char* coord; @@ -159,7 +159,7 @@ typedef struct { typedef struct s_sg_platf_peer_cbarg *sg_platf_peer_cbarg_t; typedef struct s_sg_platf_peer_cbarg { const char* id; - double power; + double speed; double bw_in; double bw_out; double lat; @@ -188,7 +188,7 @@ typedef struct s_sg_platf_cluster_cbarg { const char* prefix; const char* suffix; const char* radical; - double power; + double speed; int core_amount; double bw; double lat; @@ -219,7 +219,7 @@ typedef struct s_sg_platf_cabinet_cbarg { const char* prefix; const char* suffix; const char* radical; - double power; + double speed; double bw; double lat; } s_sg_platf_cabinet_cbarg_t; diff --git a/include/surf/surfxml_parse.h b/include/surf/surfxml_parse.h index 97dd7694d1..4479db1b35 100644 --- a/include/surf/surfxml_parse.h +++ b/include/surf/surfxml_parse.h @@ -33,7 +33,7 @@ XBT_PUBLIC(int) surf_parse_get_int(const char *string); XBT_PUBLIC(double) surf_parse_get_time(const char *string); XBT_PUBLIC(double) surf_parse_get_size(const char *string); XBT_PUBLIC(double) surf_parse_get_bandwidth(const char *string); -XBT_PUBLIC(double) surf_parse_get_power(const char *string); +XBT_PUBLIC(double) surf_parse_get_speed(const char *string); /* Prototypes of the functions offered by flex */ XBT_PUBLIC(int) surf_parse_lex(void); diff --git a/src/bindings/lua/lua_platf.c b/src/bindings/lua/lua_platf.c index 2228697a28..d939468f6a 100644 --- a/src/bindings/lua/lua_platf.c +++ b/src/bindings/lua/lua_platf.c @@ -182,8 +182,8 @@ int console_add_host(lua_State *L) { if (type != LUA_TSTRING && type != LUA_TNUMBER) { XBT_ERROR("Attribute 'power' must be specified for host and must either be a string (in the correct format; check documentation) or a number."); } - host.power_peak = xbt_dynar_new(sizeof(double), NULL); - xbt_dynar_push_as(host.power_peak, double, get_cpu_power(lua_tostring(L, -1))); + host.speed_peak = xbt_dynar_new(sizeof(double), NULL); + xbt_dynar_push_as(host.speed_peak, double, get_cpu_speed(lua_tostring(L, -1))); lua_pop(L, 1); // get core @@ -200,14 +200,14 @@ int console_add_host(lua_State *L) { //get power_scale lua_pushstring(L, "availability"); lua_gettable(L, -2); - if(!lua_isnumber(L,-1)) host.power_scale = 1;// Default value - else host.power_scale = lua_tonumber(L, -1); + if(!lua_isnumber(L,-1)) host.speed_scale = 1;// Default value + else host.speed_scale = lua_tonumber(L, -1); lua_pop(L, 1); //get power_trace lua_pushstring(L, "availability_file"); lua_gettable(L, -2); - host.power_trace = tmgr_trace_new_from_file(lua_tostring(L, -1)); + host.speed_trace = tmgr_trace_new_from_file(lua_tostring(L, -1)); lua_pop(L, 1); //get state initial @@ -229,7 +229,7 @@ int console_add_host(lua_State *L) { lua_pop(L, 1); sg_platf_new_host(&host); - xbt_dynar_free(&host.power_peak); + xbt_dynar_free(&host.speed_peak); return 0; } diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index a6bb939848..a3f0074705 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -1133,7 +1133,7 @@ XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_bandwidth; XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_latency; -XBT_PUBLIC(double) get_cpu_power(const char *power); +XBT_PUBLIC(double) get_cpu_speed(const char *power); XBT_PUBLIC(xbt_dict_t) get_as_router_properties(const char* name); diff --git a/src/instr/instr_config.c b/src/instr/instr_config.c index 978762ed2e..82033ace64 100644 --- a/src/instr/instr_config.c +++ b/src/instr/instr_config.c @@ -298,7 +298,7 @@ int TRACE_disable_link(void) return trace_disable_link && TRACE_is_enabled(); } -int TRACE_disable_power(void) +int TRACE_disable_speed(void) { return trace_disable_power && TRACE_is_enabled(); } diff --git a/src/instr/instr_private.h b/src/instr/instr_private.h index 1a5f3676fd..f64dbc7536 100644 --- a/src/instr/instr_private.h +++ b/src/instr/instr_private.h @@ -276,7 +276,7 @@ XBT_PRIVATE int TRACE_msg_process_is_enabled(void); XBT_PRIVATE int TRACE_msg_vm_is_enabled(void); XBT_PRIVATE int TRACE_buffer (void); XBT_PRIVATE int TRACE_disable_link(void); -XBT_PRIVATE int TRACE_disable_power(void); +XBT_PRIVATE int TRACE_disable_speed(void); XBT_PRIVATE int TRACE_onelink_only (void); XBT_PRIVATE int TRACE_disable_destroy (void); XBT_PRIVATE int TRACE_basic (void); diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index a260cd0653..f24f51f281 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -96,20 +96,20 @@ CpuCas01Model::~CpuCas01Model() delete p_cpuRunningActionSetThatDoesNotNeedBeingChecked; } -Cpu *CpuCas01Model::createCpu(const char *name, xbt_dynar_t power_peak, - int pstate, double power_scale, - tmgr_trace_t power_trace, int core, +Cpu *CpuCas01Model::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) { Cpu *cpu = NULL; sg_host_t host = sg_host_by_name(name); - xbt_assert(xbt_dynar_getfirst_as(power_peak, double) > 0.0, - "Power has to be >0.0. Did you forget to specify the mandatory power attribute?"); + xbt_assert(xbt_dynar_getfirst_as(speedPeak, double) > 0.0, + "Speed has to be >0.0. Did you forget to specify the mandatory power attribute?"); xbt_assert(core > 0, "Invalid number of cores %d. Must be larger than 0", core); - cpu = new CpuCas01(this, name, power_peak, pstate, power_scale, power_trace, core, state_initial, state_trace, cpu_properties); + cpu = new CpuCas01(this, name, speedPeak, pstate, speedScale, speedTrace, core, state_initial, state_trace, cpu_properties); sg_host_surfcpu_register(host, cpu); return cpu; } @@ -154,21 +154,21 @@ void CpuCas01Model::addTraces() /************ * Resource * ************/ -CpuCas01::CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t powerPeak, - int pstate, double powerScale, tmgr_trace_t powerTrace, int core, +CpuCas01::CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t speedPeak, + int pstate, double speedScale, tmgr_trace_t speedTrace, int core, e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace, xbt_dict_t properties) : Cpu(model, name, properties, - lmm_constraint_new(model->getMaxminSystem(), this, core * powerScale * xbt_dynar_get_as(powerPeak, pstate, double)), - core, xbt_dynar_get_as(powerPeak, pstate, double), powerScale, + lmm_constraint_new(model->getMaxminSystem(), this, core * speedScale * xbt_dynar_get_as(speedPeak, pstate, double)), + 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(powerPeak); + unsigned long n = xbt_dynar_length(speedPeak); for (unsigned long i = 0; i != n; ++i) { - double value = xbt_dynar_get_as(powerPeak, i, double); + double value = xbt_dynar_get_as(speedPeak, i, double); xbt_dynar_push(p_speedPeakList, &value); } @@ -177,8 +177,8 @@ CpuCas01::CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t powerPeak XBT_DEBUG("CPU create: peak=%f, pstate=%d", m_speedPeak, m_pstate); m_core = core; - if (powerTrace) - p_speedEvent = tmgr_history_add_trace(history, powerTrace, 0.0, 0, this); + if (speedTrace) + p_speedEvent = tmgr_history_add_trace(history, speedTrace, 0.0, 0, this); if (stateTrace) p_stateEvent = tmgr_history_add_trace(history, stateTrace, 0.0, 0, this); @@ -199,7 +199,7 @@ void CpuCas01::setPowerEvent(tmgr_trace_event_t powerEvent) p_speedEvent = powerEvent; } -xbt_dynar_t CpuCas01::getPowerPeakList(){ +xbt_dynar_t CpuCas01::getSpeedPeakList(){ return p_speedPeakList; } @@ -220,13 +220,13 @@ void CpuCas01::updateState(tmgr_trace_event_t event_type, double value, double d if (event_type == p_speedEvent) { /* TODO (Hypervisor): do the same thing for constraint_core[i] */ - xbt_assert(m_core == 1, "FIXME: add power scaling code also for constraint_core[i]"); + xbt_assert(m_core == 1, "FIXME: add speed scaling code also for constraint_core[i]"); m_speedScale = value; lmm_update_constraint_bound(getModel()->getMaxminSystem(), getConstraint(), m_core * m_speedScale * m_speedPeak); - TRACE_surf_host_set_power(date, getName(), + TRACE_surf_host_set_speed(date, getName(), m_core * m_speedScale * m_speedPeak); while ((var = lmm_get_var_from_cnst @@ -356,10 +356,10 @@ int CpuCas01::getPstate() * Action * **********/ -CpuCas01Action::CpuCas01Action(Model *model, double cost, bool failed, double power, lmm_constraint_t constraint) +CpuCas01Action::CpuCas01Action(Model *model, double cost, bool failed, double speed, lmm_constraint_t constraint) : CpuAction(model, cost, failed, lmm_variable_new(model->getMaxminSystem(), this, - 1.0, power, 1)) + 1.0, speed, 1)) { m_suspended = 0; if (model->getUpdateMechanism() == UM_LAZY) { diff --git a/src/surf/cpu_cas01.hpp b/src/surf/cpu_cas01.hpp index e3f03b5c11..fb1d02b6b2 100644 --- a/src/surf/cpu_cas01.hpp +++ b/src/surf/cpu_cas01.hpp @@ -43,8 +43,8 @@ public: class CpuCas01 : public Cpu { public: - CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t power_peak, - int pstate, double powerScale, tmgr_trace_t powerTrace, int core, + CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t speedPeak, + int pstate, double speedScale, tmgr_trace_t speedTrace, int core, e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace, xbt_dict_t properties) ; ~CpuCas01(); @@ -60,7 +60,7 @@ public: bool isUsed(); void setStateEvent(tmgr_trace_event_t stateEvent); void setPowerEvent(tmgr_trace_event_t stateEvent); - xbt_dynar_t getPowerPeakList(); + xbt_dynar_t getSpeedPeakList(); int getPState(); @@ -78,7 +78,7 @@ class CpuCas01Action: public CpuAction { friend CpuAction *CpuCas01::execute(double size); friend CpuAction *CpuCas01::sleep(double duration); public: - CpuCas01Action(Model *model, double cost, bool failed, double power, + CpuCas01Action(Model *model, double cost, bool failed, double speed, lmm_constraint_t constraint); ~CpuCas01Action() {}; diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 39f1cb9cd9..bc366f94be 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -134,12 +134,12 @@ Cpu::Cpu(){ Cpu::Cpu(Model *model, const char *name, xbt_dict_t props, - int core, double powerPeak, double powerScale, + int core, double speedPeak, double speedScale, e_surf_resource_state_t stateInitial) : Resource(model, name, props, stateInitial) , m_core(core) - , m_speedPeak(powerPeak) - , m_speedScale(powerScale) + , m_speedPeak(speedPeak) + , m_speedScale(speedScale) , p_constraintCore(NULL) , p_constraintCoreId(NULL) { diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 3c860f132c..a23b38c4f5 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -29,7 +29,7 @@ struct tiTag; *********/ class CpuTiTrace { public: - CpuTiTrace(tmgr_trace_t powerTrace); + CpuTiTrace(tmgr_trace_t speedTrace); ~CpuTiTrace(); double integrateSimple(double a, double b); @@ -47,13 +47,13 @@ private: enum trace_type { TRACE_FIXED, /*< Trace fixed, no availability file */ - TRACE_DYNAMIC /*< Dynamic, availability file disponible */ + TRACE_DYNAMIC /*< Dynamic, have an availability file */ }; class CpuTiTgmr { public: CpuTiTgmr(trace_type type, double value): m_type(type), m_value(value){}; - CpuTiTgmr(tmgr_trace_t power_trace, double value); + CpuTiTgmr(tmgr_trace_t speedTrace, double value); ~CpuTiTgmr(); double integrate(double a, double b); @@ -62,7 +62,7 @@ public: double getPowerScale(double a); trace_type m_type; - double m_value; /*< Percentage of cpu power disponible. Value fixed between 0 and 1 */ + double m_value; /*< Percentage of cpu speed available. Value fixed between 0 and 1 */ /* Dynamic */ double m_lastTime; /*< Integral interval last point (discret time) */ diff --git a/src/surf/instr_routing.cpp b/src/surf/instr_routing.cpp index e46a41a46d..5504f3d2ef 100644 --- a/src/surf/instr_routing.cpp +++ b/src/surf/instr_routing.cpp @@ -260,19 +260,19 @@ void sg_instr_new_host(sg_platf_host_cbarg_t host) container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1); container_t container = PJ_container_new (host->id, INSTR_HOST, father); - if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (! TRACE_disable_power())) { - type_t power = PJ_type_get_or_null ("power", container->type); - if (power == NULL){ - power = PJ_type_variable_new ("power", NULL, container->type); + if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (! TRACE_disable_speed())) { + type_t speed = PJ_type_get_or_null ("power", container->type); + if (speed == NULL){ + speed = PJ_type_variable_new ("power", NULL, container->type); } - double current_power_state; - xbt_dynar_get_cpy(host->power_peak, host->pstate, ¤t_power_state); - new_pajeSetVariable (0, container, power, current_power_state); + double current_speed_state; + xbt_dynar_get_cpy(host->speed_peak, host->pstate, ¤t_speed_state); + new_pajeSetVariable (0, container, speed, current_speed_state); } if (TRACE_uncategorized()){ - type_t power_used = PJ_type_get_or_null ("power_used", container->type); - if (power_used == NULL){ + type_t speed_used = PJ_type_get_or_null ("power_used", container->type); + if (speed_used == NULL){ PJ_type_variable_new ("power_used", "0.5 0.5 0.5", container->type); } } diff --git a/src/surf/instr_surf.c b/src/surf/instr_surf.c index 1cf1af98f3..b0003d6cc5 100644 --- a/src/surf/instr_surf.c +++ b/src/surf/instr_surf.c @@ -19,12 +19,12 @@ void TRACE_surf_release(void) TRACE_surf_resource_utilization_release(); } -void TRACE_surf_host_set_power(double date, const char *resource, double power) +void TRACE_surf_host_set_speed(double date, const char *resource, double speed) { if (TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) { container_t container = PJ_container_get(resource); type_t type = PJ_type_get ("power", container->type); - new_pajeSetVariable(date, container, type, power); + new_pajeSetVariable(date, container, type, speed); } } diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 40ae60ea81..e96281d6bf 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -62,10 +62,10 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host) Cpu *cpu = surf_cpu_model_pm->createCpu( host->id, - host->power_peak, + host->speed_peak, host->pstate, - host->power_scale, - host->power_trace, + host->speed_scale, + host->speed_trace, host->core_amount, host->initial_state, host->state_trace, diff --git a/src/surf/surf_private.h b/src/surf/surf_private.h index f0f70840df..95b3557c23 100644 --- a/src/surf/surf_private.h +++ b/src/surf/surf_private.h @@ -91,7 +91,7 @@ XBT_PUBLIC_DATA(int) surfxml_bufferstack_size; /********** Tracing **********/ /* from surf_instr.c */ -void TRACE_surf_host_set_power(double date, const char *resource, double power); +void TRACE_surf_host_set_speed(double date, const char *resource, double power); void TRACE_surf_link_set_bandwidth(double date, const char *resource, double bandwidth); /********** Instr. **********/ diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index e50939ced3..025e77824a 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -694,7 +694,7 @@ void sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet) memset(&host, 0, sizeof(host)); host.initial_state = SURF_RESOURCE_ON; host.pstate = 0; - host.power_scale = 1.0; + host.speed_scale = 1.0; host.core_amount = 1; s_sg_platf_link_cbarg_t link = SG_PLATF_LINK_INITIALIZER; @@ -712,10 +712,10 @@ void sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet) link_id = bprintf("link_%s%d%s",cabinet->prefix,i,cabinet->suffix); host.id = host_id; link.id = link_id; - host.power_peak = xbt_dynar_new(sizeof(double), NULL); - xbt_dynar_push(host.power_peak,&cabinet->power); + host.speed_peak = xbt_dynar_new(sizeof(double), NULL); + xbt_dynar_push(host.speed_peak,&cabinet->speed); sg_platf_new_host(&host); - xbt_dynar_free(&host.power_peak); + xbt_dynar_free(&host.speed_peak); sg_platf_new_link(&link); char* link_up = bprintf("%s_UP",link_id); @@ -822,7 +822,7 @@ void routing_new_cluster(sg_platf_cluster_cbarg_t cluster) bprintf("%s%d%s", cluster->prefix, i, cluster->suffix); link_id = bprintf("%s_link_%d", cluster->id, i); - XBT_DEBUG("", host_id, cluster->power); + XBT_DEBUG("", host_id, cluster->speed); memset(&host, 0, sizeof(host)); host.id = host_id; @@ -839,7 +839,7 @@ void routing_new_cluster(sg_platf_cluster_cbarg_t cluster) xbt_dict_set(patterns, "radical", bprintf("%d", i), NULL); char *avail_file = xbt_str_varsubst(cluster->availability_trace, patterns); XBT_DEBUG("\tavailability_file=\"%s\"", avail_file); - host.power_trace = tmgr_trace_new_from_file(avail_file); + host.speed_trace = tmgr_trace_new_from_file(avail_file); xbt_free(avail_file); } else { XBT_DEBUG("\tavailability_file=\"\""); @@ -854,17 +854,17 @@ void routing_new_cluster(sg_platf_cluster_cbarg_t cluster) XBT_DEBUG("\tstate_file=\"\""); } - host.power_peak = xbt_dynar_new(sizeof(double), NULL); - xbt_dynar_push(host.power_peak,&cluster->power); + host.speed_peak = xbt_dynar_new(sizeof(double), NULL); + xbt_dynar_push(host.speed_peak,&cluster->speed); host.pstate = 0; //host.power_peak = cluster->power; - host.power_scale = 1.0; + host.speed_scale = 1.0; host.core_amount = cluster->core_amount; host.initial_state = SURF_RESOURCE_ON; host.coord = ""; sg_platf_new_host(&host); - xbt_dynar_free(&host.power_peak); + xbt_dynar_free(&host.speed_peak); XBT_DEBUG(""); XBT_DEBUG("", link_id, @@ -1012,22 +1012,22 @@ void sg_platf_new_peer(sg_platf_peer_cbarg_t peer) current_routing->p_linkUpDownList = xbt_dynar_new(sizeof(s_surf_parsing_link_up_down_t),NULL); - XBT_DEBUG("", host_id, peer->power); + XBT_DEBUG("", host_id, peer->speed); s_sg_platf_host_cbarg_t host = SG_PLATF_HOST_INITIALIZER; memset(&host, 0, sizeof(host)); host.initial_state = SURF_RESOURCE_ON; host.id = host_id; - host.power_peak = xbt_dynar_new(sizeof(double), NULL); - xbt_dynar_push(host.power_peak,&peer->power); + host.speed_peak = xbt_dynar_new(sizeof(double), NULL); + xbt_dynar_push(host.speed_peak,&peer->speed); host.pstate = 0; //host.power_peak = peer->power; - host.power_scale = 1.0; - host.power_trace = peer->availability_trace; + host.speed_scale = 1.0; + host.speed_trace = peer->availability_trace; host.state_trace = peer->state_trace; host.core_amount = 1; sg_platf_new_host(&host); - xbt_dynar_free(&host.power_peak); + xbt_dynar_free(&host.speed_peak); s_sg_platf_link_cbarg_t link = SG_PLATF_LINK_INITIALIZER; memset(&link, 0, sizeof(link)); diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 05820ac38d..a26f8a1275 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -168,7 +168,7 @@ double surf_parse_get_bandwidth(const char *string) return surf_parse_get_value_with_unit(string, units); } -double surf_parse_get_power(const char *string) +double surf_parse_get_speed(const char *string) { const struct unit_scale units[] = { { "yottaflops", 1e24 }, @@ -441,32 +441,31 @@ void ETag_surfxml_host(void) { buf = A_surfxml_host_power; XBT_DEBUG("Buffer: %s", buf); - host.power_peak = xbt_dynar_new(sizeof(double), NULL); + host.speed_peak = xbt_dynar_new(sizeof(double), NULL); if (strchr(buf, ',') == NULL){ - double power_value = get_cpu_power(A_surfxml_host_power); - xbt_dynar_push_as(host.power_peak,double, power_value); + double speed = get_cpu_speed(A_surfxml_host_power); + xbt_dynar_push_as(host.speed_peak,double, speed); } else { xbt_dynar_t pstate_list = xbt_str_split(buf, ","); int i; for (i = 0; i < xbt_dynar_length(pstate_list); i++) { - double power_value; - char* power_value_str; - - xbt_dynar_get_cpy(pstate_list, i, &power_value_str); - xbt_str_trim(power_value_str, NULL); - power_value = get_cpu_power(power_value_str); - xbt_dynar_push_as(host.power_peak, double, power_value); - XBT_DEBUG("Power value: %f", power_value); + double speed; + char* speed_str; + + xbt_dynar_get_cpy(pstate_list, i, &speed_str); + xbt_str_trim(speed_str, NULL); + speed = get_cpu_speed(speed_str); + xbt_dynar_push_as(host.speed_peak, double, speed); + XBT_DEBUG("Speed value: %f", speed); } xbt_dynar_free(&pstate_list); } XBT_DEBUG("pstate: %s", A_surfxml_host_pstate); - //host.power_peak = get_cpu_power(A_surfxml_host_power); - host.power_scale = surf_parse_get_double( A_surfxml_host_availability); + host.speed_scale = surf_parse_get_double( A_surfxml_host_availability); host.core_amount = surf_parse_get_int(A_surfxml_host_core); - host.power_trace = tmgr_trace_new_from_file(A_surfxml_host_availability___file); + host.speed_trace = tmgr_trace_new_from_file(A_surfxml_host_availability___file); host.state_trace = tmgr_trace_new_from_file(A_surfxml_host_state___file); host.pstate = surf_parse_get_int(A_surfxml_host_pstate); @@ -479,7 +478,7 @@ void ETag_surfxml_host(void) { host.coord = A_surfxml_host_coordinates; sg_platf_new_host(&host); - xbt_dynar_free(&host.power_peak); + xbt_dynar_free(&host.speed_peak); current_property_set = NULL; } @@ -513,7 +512,7 @@ void ETag_surfxml_cluster(void){ cluster.prefix = A_surfxml_cluster_prefix; cluster.suffix = A_surfxml_cluster_suffix; cluster.radical = A_surfxml_cluster_radical; - cluster.power = surf_parse_get_power(A_surfxml_cluster_power); + cluster.speed = surf_parse_get_speed(A_surfxml_cluster_power); cluster.core_amount = surf_parse_get_int(A_surfxml_cluster_core); cluster.bw = surf_parse_get_bandwidth(A_surfxml_cluster_bw); cluster.lat = surf_parse_get_time(A_surfxml_cluster_lat); @@ -593,7 +592,7 @@ void STag_surfxml_cabinet(void){ cabinet.id = A_surfxml_cabinet_id; cabinet.prefix = A_surfxml_cabinet_prefix; cabinet.suffix = A_surfxml_cabinet_suffix; - cabinet.power = surf_parse_get_power(A_surfxml_cabinet_power); + cabinet.speed = surf_parse_get_speed(A_surfxml_cabinet_power); cabinet.bw = surf_parse_get_bandwidth(A_surfxml_cabinet_bw); cabinet.lat = surf_parse_get_time(A_surfxml_cabinet_lat); cabinet.radical = A_surfxml_cabinet_radical; @@ -606,7 +605,7 @@ void STag_surfxml_peer(void){ s_sg_platf_peer_cbarg_t peer = SG_PLATF_PEER_INITIALIZER; memset(&peer,0,sizeof(peer)); peer.id = A_surfxml_peer_id; - peer.power = surf_parse_get_power(A_surfxml_peer_power); + peer.speed = surf_parse_get_speed(A_surfxml_peer_power); peer.bw_in = surf_parse_get_bandwidth(A_surfxml_peer_bw___in); peer.bw_out = surf_parse_get_bandwidth(A_surfxml_peer_bw___out); peer.lat = surf_parse_get_time(A_surfxml_peer_lat); @@ -1062,27 +1061,27 @@ int_f_void_t surf_parse = _surf_parse; * With XML parser */ -double get_cpu_power(const char *power) +double get_cpu_speed(const char *str_speed) { - double power_scale = 0.0; + double speed = 0.0; const char *p, *q; char *generator; random_data_t random = NULL; /* randomness is inserted like this: power="$rand(my_random)" */ - if (((p = strstr(power, "$rand(")) != NULL) - && ((q = strstr(power, ")")) != NULL)) { + if (((p = strstr(str_speed, "$rand(")) != NULL) + && ((q = strstr(str_speed, ")")) != NULL)) { if (p < q) { generator = xbt_malloc(q - (p + 6) + 1); memcpy(generator, p + 6, q - (p + 6)); generator[q - (p + 6)] = '\0'; random = xbt_dict_get_or_null(random_data_list, generator); xbt_assert(random, "Random generator %s undefined", generator); - power_scale = random_generate(random); + speed = random_generate(random); } } else { - power_scale = surf_parse_get_power(power); + speed = surf_parse_get_speed(str_speed); } - return power_scale; + return speed; } double random_min, random_max, random_mean, random_std_deviation; diff --git a/src/surf/vm_hl13.cpp b/src/surf/vm_hl13.cpp index fc317ee75d..7d7373ea16 100644 --- a/src/surf/vm_hl13.cpp +++ b/src/surf/vm_hl13.cpp @@ -185,7 +185,7 @@ VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props, CpuCas01 *sub_cpu = static_cast(sg_host_surfcpu(host_PM)); p_cpu = surf_cpu_model_vm->createCpu(name, // name - sub_cpu->getPowerPeakList(), // host->power_peak, + sub_cpu->getSpeedPeakList(), // host->power_peak, sub_cpu->getPState(), 1, // host->power_scale, NULL, // host->power_trace, -- 2.20.1