From bfa4e95e4538099a54c5afedd403264c8d99adb6 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 21 Jan 2019 13:32:09 +0100 Subject: [PATCH] start to s/trace/profile/ in the public API --- include/simgrid/kernel/resource/Resource.hpp | 10 ++++- include/simgrid/s4u/Link.hpp | 47 +++++++++++++------- src/kernel/resource/Resource.cpp | 6 +-- src/s4u/s4u_Link.cpp | 12 ++--- src/surf/cpu_interface.cpp | 4 +- src/surf/cpu_interface.hpp | 2 +- src/surf/cpu_ti.cpp | 2 +- src/surf/cpu_ti.hpp | 2 +- src/surf/network_interface.cpp | 12 ++--- src/surf/network_interface.hpp | 9 ++-- src/surf/network_ns3.cpp | 8 ++-- src/surf/network_ns3.hpp | 4 +- src/surf/sg_platf.cpp | 14 +++--- src/surf/xml/surfxml_parseplatf.cpp | 20 ++++----- 14 files changed, 89 insertions(+), 63 deletions(-) diff --git a/include/simgrid/kernel/resource/Resource.hpp b/include/simgrid/kernel/resource/Resource.hpp index 6e1119ebcb..ecfd29d182 100644 --- a/include/simgrid/kernel/resource/Resource.hpp +++ b/include/simgrid/kernel/resource/Resource.hpp @@ -64,7 +64,15 @@ public: /** @brief Turn off the current Resource */ virtual void turn_off(); /** @brief setup the trace file with states events (ON or OFF). Trace must contain boolean values. */ - virtual void set_state_trace(profile::Profile* trace); + virtual void set_state_profile(profile::Profile* profile); + +#ifndef DOXYGEN + XBT_ATTRIB_DEPRECATED_v325("Please use Resource::set_state_profile()") virtual void set_state_trace( + profile::Profile* profile) + { + set_state_profile(profile); + } +#endif private: std::string name_; diff --git a/include/simgrid/s4u/Link.hpp b/include/simgrid/s4u/Link.hpp index fbac2c0f9d..8029280cf3 100644 --- a/include/simgrid/s4u/Link.hpp +++ b/include/simgrid/s4u/Link.hpp @@ -65,15 +65,32 @@ public: void* get_data(); /** Should be used only from the C interface. Prefer extensions in C++ */ void set_data(void* d); - void set_state_trace( - kernel::profile::Profile* trace); /*< setup the trace file with states events (ON or OFF). Trace must contain - boolean values. */ - void set_bandwidth_trace( - kernel::profile::Profile* trace); /*< setup the trace file with bandwidth events (peak speed changes due to - external load). Trace must contain percentages (value between 0 and 1). */ - void set_latency_trace( - kernel::profile::Profile* trace); /*< setup the trace file with latency events (peak latency changes due to - external load). Trace must contain absolute values */ +#ifndef DOXYGEN + XBT_ATTRIB_DEPRECATED_v325("Please use Link::set_state_profile()") void set_state_trace( + kernel::profile::Profile* profile) + { + set_state_profile(profile); + } + XBT_ATTRIB_DEPRECATED_v325("Please use Link::set_bandwidth_profile()") void set_bandwidth_trace( + kernel::profile::Profile* profile) + { + set_bandwidth_profile(profile); + } + XBT_ATTRIB_DEPRECATED_v325("Please use Link::set_latency_profile()") void set_latency_trace( + kernel::profile::Profile* profile) + { + set_latency_profile(profile); + } +#endif + + /** Setup the profile file with states events (ON or OFF). The profile must contain boolean values. */ + void set_state_profile(kernel::profile::Profile* profile); + /** Setup the profile file with bandwidth events (peak speed changes due to external load). + * The profile must contain percentages (value between 0 and 1). */ + void set_bandwidth_profile(kernel::profile::Profile* profile); + /** Setup the profile file with latency events (peak latency changes due to external load). + * The profile must contain absolute values */ + void set_latency_profile(kernel::profile::Profile* profile); const char* get_property(std::string key); void set_property(std::string key, std::string value); @@ -133,22 +150,22 @@ public: XBT_ATTRIB_DEPRECATED_v323("Please use Link::set_data()") void setData(void* d) {set_data(d);} /** @deprecated */ - XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_state_trace()") void setStateTrace( + XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_state_profile()") void setStateTrace( simgrid::kernel::profile::Profile* trace) { - set_state_trace(trace); + set_state_profile(trace); } /** @deprecated */ - XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_bandwidth_trace()") void setBandwidthTrace( + XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_bandwidth_profile()") void setBandwidthTrace( simgrid::kernel::profile::Profile* trace) { - set_bandwidth_trace(trace); + set_bandwidth_profile(trace); } /** @deprecated */ - XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_latency_trace()") void setLatencyTrace( + XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_latency_profile()") void setLatencyTrace( simgrid::kernel::profile::Profile* trace) { - set_latency_trace(trace); + set_latency_profile(trace); } #endif }; diff --git a/src/kernel/resource/Resource.cpp b/src/kernel/resource/Resource.cpp index d01924138f..0a448dba9e 100644 --- a/src/kernel/resource/Resource.cpp +++ b/src/kernel/resource/Resource.cpp @@ -63,11 +63,11 @@ bool Resource::operator==(const Resource& other) const return name_ == other.name_; } -void Resource::set_state_trace(profile::Profile* trace) +void Resource::set_state_profile(profile::Profile* profile) { - xbt_assert(state_event_ == nullptr, "Cannot set a second state trace to %s", get_cname()); + xbt_assert(state_event_ == nullptr, "Cannot set a second state profile to %s", get_cname()); - state_event_ = future_evt_set.add_trace(trace, this); + state_event_ = future_evt_set.add_trace(profile, this); } kernel::lmm::Constraint* Resource::get_constraint() const diff --git a/src/s4u/s4u_Link.cpp b/src/s4u/s4u_Link.cpp index 32d98e89db..2019f745b0 100644 --- a/src/s4u/s4u_Link.cpp +++ b/src/s4u/s4u_Link.cpp @@ -87,17 +87,17 @@ void Link::set_data(void* d) simgrid::simix::simcall([this, d]() { this->pimpl_->set_data(d); }); } -void Link::set_state_trace(kernel::profile::Profile* trace) +void Link::set_state_profile(kernel::profile::Profile* profile) { - simgrid::simix::simcall([this, trace]() { this->pimpl_->set_state_trace(trace); }); + simgrid::simix::simcall([this, profile]() { this->pimpl_->set_state_profile(profile); }); } -void Link::set_bandwidth_trace(kernel::profile::Profile* trace) +void Link::set_bandwidth_profile(kernel::profile::Profile* profile) { - simgrid::simix::simcall([this, trace]() { this->pimpl_->set_bandwidth_trace(trace); }); + simgrid::simix::simcall([this, profile]() { this->pimpl_->set_bandwidth_profile(profile); }); } -void Link::set_latency_trace(kernel::profile::Profile* trace) +void Link::set_latency_profile(kernel::profile::Profile* trace) { - simgrid::simix::simcall([this, trace]() { this->pimpl_->set_latency_trace(trace); }); + simgrid::simix::simcall([this, trace]() { this->pimpl_->set_latency_profile(trace); }); } const char* Link::get_property(std::string key) diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 0784446bdb..01e7347657 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -134,11 +134,11 @@ int Cpu::get_core_count() return core_count_; } -void Cpu::set_speed_trace(kernel::profile::Profile* trace) +void Cpu::set_speed_profile(kernel::profile::Profile* profile) { xbt_assert(speed_.event == nullptr, "Cannot set a second speed trace to Host %s", host_->get_cname()); - speed_.event = future_evt_set.add_trace(trace, this); + speed_.event = future_evt_set.add_trace(profile, this); } diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index 1f2be7993e..38ccfc9805 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -148,7 +148,7 @@ public: /*< @brief Setup the trace file with availability events (peak speed changes due to external load). * Trace must contain relative values (ratio between 0 and 1) */ - virtual void set_speed_trace(kernel::profile::Profile* trace); + virtual void set_speed_profile(kernel::profile::Profile* profile); protected: Metric speed_ = {1.0, 0, nullptr}; diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 34eaa72dc4..9a08026109 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -367,7 +367,7 @@ CpuTi::~CpuTi() set_modified(false); delete speed_integrated_trace_; } -void CpuTi::set_speed_trace(kernel::profile::Profile* profile) +void CpuTi::set_speed_profile(kernel::profile::Profile* profile) { delete speed_integrated_trace_; speed_integrated_trace_ = new CpuTiTmgr(profile, speed_.scale); diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 2a4435b800..14455c1555 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -103,7 +103,7 @@ public: CpuTi(CpuTiModel* model, simgrid::s4u::Host* host, std::vector* speed_per_pstate, int core); ~CpuTi() override; - void set_speed_trace(kernel::profile::Profile* profile) override; + void set_speed_profile(kernel::profile::Profile* profile) override; void apply_event(kernel::profile::Event* event, double value) override; void update_actions_finish_time(double now); diff --git a/src/surf/network_interface.cpp b/src/surf/network_interface.cpp index a552f54ea6..999afe5c8b 100644 --- a/src/surf/network_interface.cpp +++ b/src/surf/network_interface.cpp @@ -145,16 +145,16 @@ void LinkImpl::on_bandwidth_change() s4u::Link::on_bandwidth_change(this->piface_); } -void LinkImpl::set_bandwidth_trace(profile::Profile* trace) +void LinkImpl::set_bandwidth_profile(profile::Profile* profile) { - xbt_assert(bandwidth_.event == nullptr, "Cannot set a second bandwidth trace to Link %s", get_cname()); - bandwidth_.event = future_evt_set.add_trace(trace, this); + xbt_assert(bandwidth_.event == nullptr, "Cannot set a second bandwidth profile to Link %s", get_cname()); + bandwidth_.event = future_evt_set.add_trace(profile, this); } -void LinkImpl::set_latency_trace(profile::Profile* trace) +void LinkImpl::set_latency_profile(profile::Profile* profile) { - xbt_assert(latency_.event == nullptr, "Cannot set a second latency trace to Link %s", get_cname()); - latency_.event = future_evt_set.add_trace(trace, this); + xbt_assert(latency_.event == nullptr, "Cannot set a second latency profile to Link %s", get_cname()); + latency_.event = future_evt_set.add_trace(profile, this); } /********** diff --git a/src/surf/network_interface.hpp b/src/surf/network_interface.hpp index 7419f0b1d6..fda1a6176f 100644 --- a/src/surf/network_interface.hpp +++ b/src/surf/network_interface.hpp @@ -147,11 +147,12 @@ public: void on_bandwidth_change(); - virtual void set_bandwidth_trace(kernel::profile::Profile* trace); /*< setup the trace file with bandwidth events - (peak speed changes due to external load). Trace must - contain percentages (value between 0 and 1). */ virtual void - set_latency_trace(kernel::profile::Profile* trace); /*< setup the trace file with latency events (peak + set_bandwidth_profile(kernel::profile::Profile* profile); /*< setup the profile file with bandwidth events + (peak speed changes due to external load). Trace must + contain percentages (value between 0 and 1). */ + virtual void + set_latency_profile(kernel::profile::Profile* profile); /*< setup the trace file with latency events (peak latency changes due to external load). Trace must contain absolute values */ diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index b2a18776d6..d33067fb87 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -281,13 +281,13 @@ void LinkNS3::apply_event(profile::Event* event, double value) { THROW_UNIMPLEMENTED; } -void LinkNS3::set_bandwidth_trace(profile::Profile* profile) +void LinkNS3::set_bandwidth_profile(profile::Profile* profile) { - xbt_die("The NS3 network model doesn't support bandwidth traces"); + xbt_die("The NS3 network model doesn't support bandwidth profiles"); } -void LinkNS3::set_latency_trace(profile::Profile* profile) +void LinkNS3::set_latency_profile(profile::Profile* profile) { - xbt_die("The NS3 network model doesn't support latency traces"); + xbt_die("The NS3 network model doesn't support latency profiles"); } /********** diff --git a/src/surf/network_ns3.hpp b/src/surf/network_ns3.hpp index 26ef8f13d6..632fe81ccc 100644 --- a/src/surf/network_ns3.hpp +++ b/src/surf/network_ns3.hpp @@ -37,8 +37,8 @@ public: void apply_event(simgrid::kernel::profile::Event* event, double value) override; void set_bandwidth(double value) override { THROW_UNIMPLEMENTED; } void set_latency(double value) override { THROW_UNIMPLEMENTED; } - void set_bandwidth_trace(profile::Profile* profile) override; - void set_latency_trace(profile::Profile* profile) override; + void set_bandwidth_profile(profile::Profile* profile) override; + void set_latency_profile(profile::Profile* profile) override; }; /********** diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 570ba54e24..b5d0b2d614 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -81,9 +81,9 @@ void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* args) /* Change from the defaults */ if (args->state_trace) - host->pimpl_cpu->set_state_trace(args->state_trace); + host->pimpl_cpu->set_state_profile(args->state_trace); if (args->speed_trace) - host->pimpl_cpu->set_speed_trace(args->speed_trace); + host->pimpl_cpu->set_speed_profile(args->speed_trace); if (args->pstate != 0) host->pimpl_cpu->set_pstate(args->pstate); if (args->coord && strcmp(args->coord, "")) @@ -131,11 +131,11 @@ void sg_platf_new_link(simgrid::kernel::routing::LinkCreationArgs* link) } if (link->latency_trace) - l->set_latency_trace(link->latency_trace); + l->set_latency_profile(link->latency_trace); if (link->bandwidth_trace) - l->set_bandwidth_trace(link->bandwidth_trace); + l->set_bandwidth_profile(link->bandwidth_trace); if (link->state_trace) - l->set_state_trace(link->state_trace); + l->set_state_profile(link->state_trace); } delete link->properties; } @@ -489,9 +489,9 @@ void sg_platf_new_peer(simgrid::kernel::routing::PeerCreationArgs* peer) /* Change from the defaults */ if (peer->state_trace) - host->pimpl_cpu->set_state_trace(peer->state_trace); + host->pimpl_cpu->set_state_profile(peer->state_trace); if (peer->speed_trace) - host->pimpl_cpu->set_speed_trace(peer->speed_trace); + host->pimpl_cpu->set_speed_profile(peer->speed_trace); } /* Pick the right models for CPU, net and host, and call their model_init_preparse */ diff --git a/src/surf/xml/surfxml_parseplatf.cpp b/src/surf/xml/surfxml_parseplatf.cpp index 49375092fb..ad85acb678 100644 --- a/src/surf/xml/surfxml_parseplatf.cpp +++ b/src/surf/xml/surfxml_parseplatf.cpp @@ -104,49 +104,49 @@ void parse_platform_file(std::string file) /* connect all profiles relative to hosts */ for (auto const& elm : trace_connect_list_host_avail) { xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str()); - simgrid::kernel::profile::Profile* trace = traces_set_list.at(elm.first); + simgrid::kernel::profile::Profile* profile = traces_set_list.at(elm.first); simgrid::s4u::Host* host = sg_host_by_name(elm.second.c_str()); xbt_assert(host, "Host %s undefined", elm.second.c_str()); simgrid::surf::Cpu* cpu = host->pimpl_cpu; - cpu->set_state_trace(trace); + cpu->set_state_profile(profile); } for (auto const& elm : trace_connect_list_host_speed) { xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str()); - simgrid::kernel::profile::Profile* trace = traces_set_list.at(elm.first); + simgrid::kernel::profile::Profile* profile = traces_set_list.at(elm.first); simgrid::s4u::Host* host = sg_host_by_name(elm.second.c_str()); xbt_assert(host, "Host %s undefined", elm.second.c_str()); simgrid::surf::Cpu* cpu = host->pimpl_cpu; - cpu->set_speed_trace(trace); + cpu->set_speed_profile(profile); } for (auto const& elm : trace_connect_list_link_avail) { xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str()); - simgrid::kernel::profile::Profile* trace = traces_set_list.at(elm.first); + simgrid::kernel::profile::Profile* profile = traces_set_list.at(elm.first); sg_link_t link = simgrid::s4u::Link::by_name(elm.second.c_str()); xbt_assert(link, "Link %s undefined", elm.second.c_str()); - link->set_state_trace(trace); + link->set_state_profile(profile); } for (auto const& elm : trace_connect_list_link_bw) { xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str()); - simgrid::kernel::profile::Profile* trace = traces_set_list.at(elm.first); + simgrid::kernel::profile::Profile* profile = traces_set_list.at(elm.first); sg_link_t link = simgrid::s4u::Link::by_name(elm.second.c_str()); xbt_assert(link, "Link %s undefined", elm.second.c_str()); - link->set_bandwidth_trace(trace); + link->set_bandwidth_profile(profile); } for (auto const& elm : trace_connect_list_link_lat) { xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str()); - simgrid::kernel::profile::Profile* trace = traces_set_list.at(elm.first); + simgrid::kernel::profile::Profile* profile = traces_set_list.at(elm.first); sg_link_t link = simgrid::s4u::Link::by_name(elm.second.c_str()); xbt_assert(link, "Link %s undefined", elm.second.c_str()); - link->set_latency_trace(trace); + link->set_latency_profile(profile); } surf_parse_close(); -- 2.20.1