From: Martin Quinson Date: Sun, 7 Feb 2016 23:22:28 +0000 (+0100) Subject: sanitize surf API: s/updateState/apply_event/ X-Git-Tag: v3_13~932 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3f2999fc86c758179dfc3e6e0d1ca4860cf65ae4 sanitize surf API: s/updateState/apply_event/ --- diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index a174238b21..e05b75e3e4 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -182,7 +182,7 @@ void CpuCas01::onSpeedChange() { Cpu::onSpeedChange(); } -void CpuCas01::updateState(tmgr_trace_iterator_t event_type, double value) +void CpuCas01::apply_event(tmgr_trace_iterator_t event_type, double value) { lmm_variable_t var = NULL; lmm_element_t elem = NULL; diff --git a/src/surf/cpu_cas01.hpp b/src/surf/cpu_cas01.hpp index 99cea9d15b..447553a8ac 100644 --- a/src/surf/cpu_cas01.hpp +++ b/src/surf/cpu_cas01.hpp @@ -47,7 +47,7 @@ public: int pstate, double speedScale, tmgr_trace_t speedTrace, int core, int initiallyOn, tmgr_trace_t stateTrace) ; ~CpuCas01(); - void updateState(tmgr_trace_iterator_t event_type, double value) override; + void apply_event(tmgr_trace_iterator_t event_type, double value) override; CpuAction *execution_start(double size) override; CpuAction *sleep(double duration) override; diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 4a573ef1cc..5169617bb0 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -561,7 +561,7 @@ void CpuTi::set_speed_trace(tmgr_trace_t trace) } } -void CpuTi::updateState(tmgr_trace_iterator_t event_type, double value) +void CpuTi::apply_event(tmgr_trace_iterator_t event_type, double value) { CpuTiAction *action; diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 20d9cbc3fc..57b46382bc 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -120,7 +120,7 @@ public: void set_speed_trace(tmgr_trace_t trace); - void updateState(tmgr_trace_iterator_t event_type, double value) override; + void apply_event(tmgr_trace_iterator_t event_type, double value) override; void updateActionsFinishTime(double now); void updateRemainingAmount(double now); diff --git a/src/surf/host_interface.hpp b/src/surf/host_interface.hpp index dfef15a477..1ce8ee3392 100644 --- a/src/surf/host_interface.hpp +++ b/src/surf/host_interface.hpp @@ -229,7 +229,7 @@ public: virtual int fileMove(surf_file_t fd, const char* fullpath); bool isUsed() override {DIE_IMPOSSIBLE;} // FIXME: Host should not be a Resource - void updateState(tmgr_trace_iterator_t event_type, double value) override + void apply_event(tmgr_trace_iterator_t event_type, double value) override {THROW_IMPOSSIBLE;} // FIXME: Host should not be a Resource public: diff --git a/src/surf/host_ptask_L07.cpp b/src/surf/host_ptask_L07.cpp index a3224f7dc1..a02f7b529b 100644 --- a/src/surf/host_ptask_L07.cpp +++ b/src/surf/host_ptask_L07.cpp @@ -480,7 +480,7 @@ bool LinkL07::isUsed(){ return lmm_constraint_used(getModel()->getMaxminSystem(), getConstraint()); } -void CpuL07::updateState(tmgr_trace_iterator_t triggered, double value){ +void CpuL07::apply_event(tmgr_trace_iterator_t triggered, double value){ XBT_DEBUG("Updating cpu %s (%p) with value %g", getName(), this, value); if (triggered == p_speedEvent) { m_speedScale = value; @@ -497,7 +497,7 @@ void CpuL07::updateState(tmgr_trace_iterator_t triggered, double value){ } } -void LinkL07::updateState(tmgr_trace_iterator_t triggered, double value) { +void LinkL07::apply_event(tmgr_trace_iterator_t triggered, double value) { XBT_DEBUG("Updating link %s (%p) with value=%f", getName(), this, value); if (triggered == m_bandwidth.event) { updateBandwidth(value); diff --git a/src/surf/host_ptask_L07.hpp b/src/surf/host_ptask_L07.hpp index 0b0349e4ff..d2a60294ee 100644 --- a/src/surf/host_ptask_L07.hpp +++ b/src/surf/host_ptask_L07.hpp @@ -99,7 +99,7 @@ public: int core, int initiallyOn, tmgr_trace_t state_trace); ~CpuL07(); bool isUsed() override; - void updateState(tmgr_trace_iterator_t event_type, double value) override; + void apply_event(tmgr_trace_iterator_t event_type, double value) override; Action *execution_start(double size) override; Action *sleep(double duration) override; protected: @@ -118,7 +118,7 @@ public: e_surf_link_sharing_policy_t policy); ~LinkL07(){ }; bool isUsed() override; - void updateState(tmgr_trace_iterator_t event_type, double value) override; + void apply_event(tmgr_trace_iterator_t event_type, double value) override; void updateBandwidth(double value) override; void updateLatency(double value) override; }; diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index c3be602d82..c19dbfdb01 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -542,7 +542,7 @@ NetworkCm02Link::NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_ -void NetworkCm02Link::updateState(tmgr_trace_iterator_t triggered, double value) +void NetworkCm02Link::apply_event(tmgr_trace_iterator_t triggered, double value) { /* Find out which of my iterators was triggered, and react accordingly */ diff --git a/src/surf/network_cm02.hpp b/src/surf/network_cm02.hpp index 61e8b1ca1b..c2accc52b7 100644 --- a/src/surf/network_cm02.hpp +++ b/src/surf/network_cm02.hpp @@ -82,7 +82,7 @@ public: double lat_initial, tmgr_trace_t lat_trace, e_surf_link_sharing_policy_t policy); - void updateState(tmgr_trace_iterator_t event_type, double value) override; + void apply_event(tmgr_trace_iterator_t event_type, double value) override; void updateBandwidth(double value) override; void updateLatency(double value) override; virtual void gapAppend(double /*size*/, const Link* /*link*/, NetworkAction * /*action*/) {}; diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 0ffb5dff2a..224b4b9760 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -401,7 +401,7 @@ NetworkNS3Link::~NetworkNS3Link() { } -void NetworkNS3Link::updateState(tmgr_trace_iterator_t event_type, double value) +void NetworkNS3Link::apply_event(tmgr_trace_iterator_t event_type, double value) { THROW_UNIMPLEMENTED; } diff --git a/src/surf/network_ns3.hpp b/src/surf/network_ns3.hpp index 0fbed87b02..91945321cc 100644 --- a/src/surf/network_ns3.hpp +++ b/src/surf/network_ns3.hpp @@ -55,9 +55,9 @@ public: xbt_dynar_t getRoute(NetCard *src, NetCard *dst); Action *communicate(NetCard *src, NetCard *dst, double size, double rate); double next_occuring_event(double now) override; + bool next_occuring_event_isIdempotent() {return false;} void updateActionsState(double now, double delta) override; void addTraces() override {DIE_IMPOSSIBLE;} - bool next_occuring_event_isIdempotent() {return false;} }; /************ @@ -69,7 +69,7 @@ public: double bw_initial, double lat_initial); ~NetworkNS3Link(); - void updateState(tmgr_trace_iterator_t event_type, double value) override; + void apply_event(tmgr_trace_iterator_t event_type, double value) override; void updateBandwidth(double value) override {THROW_UNIMPLEMENTED;} void updateLatency(double value) override {THROW_UNIMPLEMENTED;} diff --git a/src/surf/storage_interface.cpp b/src/surf/storage_interface.cpp index 866fd71046..7960dfc1c8 100644 --- a/src/surf/storage_interface.cpp +++ b/src/surf/storage_interface.cpp @@ -140,7 +140,7 @@ bool Storage::isUsed() return false; } -void Storage::updateState(tmgr_trace_iterator_t /*event_type*/, double /*value*/) +void Storage::apply_event(tmgr_trace_iterator_t /*event_type*/, double /*value*/) { THROW_UNIMPLEMENTED; } diff --git a/src/surf/storage_interface.hpp b/src/surf/storage_interface.hpp index a7438dae3e..7f48207572 100644 --- a/src/surf/storage_interface.hpp +++ b/src/surf/storage_interface.hpp @@ -147,7 +147,7 @@ public: * @param value [description] * @param date [description] */ - void updateState(tmgr_trace_iterator_t event_type, double value) override; + void apply_event(tmgr_trace_iterator_t event_type, double value) override; void turnOn() override; void turnOff() override; diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index 08e1e516ff..b8c4e970c4 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -44,7 +44,7 @@ void surf_presolve(void) while ((event = future_evt_set->pop_leq(next_event_date, &value, &resource))) { if (value >= 0){ - resource->updateState(event, value); + resource->apply_event(event, value); } } } @@ -132,7 +132,7 @@ double surf_solve(double max_date) /* update state of the corresponding resource to the new value. Does not touch lmm. It will be modified if needed when updating actions */ XBT_DEBUG("Calling update_resource_state for resource %s", resource->getName()); - resource->updateState(event, value); + resource->apply_event(event, value); NOW = round_start; } } diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index d660a8139e..a0ff19d00d 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -417,7 +417,7 @@ public: * @param event_type [TODO] * @param value [TODO] */ - virtual void updateState(tmgr_trace_iterator_t event_type, double value)=0; + virtual void apply_event(tmgr_trace_iterator_t event_type, double value)=0; /** @brief Check if the current Resource is used (if it currently serves an action) */ virtual bool isUsed()=0; diff --git a/teshsuite/surf/trace_usage/trace_usage.cpp b/teshsuite/surf/trace_usage/trace_usage.cpp index d7e3efe7aa..d6f648c64c 100644 --- a/teshsuite/surf/trace_usage/trace_usage.cpp +++ b/teshsuite/surf/trace_usage/trace_usage.cpp @@ -24,7 +24,7 @@ class DummyTestResource public: DummyTestResource(const char *name) : Resource(nullptr,name) {} bool isUsed() override {return false;} - void updateState(tmgr_trace_iterator_t it, double value) override {} + void apply_event(tmgr_trace_iterator_t it, double value) override {} }; static void test(void)