From: Frederic Suter Date: Mon, 7 Oct 2019 08:04:41 +0000 (+0200) Subject: Merge branch 'master' into CRTP X-Git-Tag: v3.25~557 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/cdf6a962eb4e88efbed3df9c41343adabcf09e6c Merge branch 'master' into CRTP --- cdf6a962eb4e88efbed3df9c41343adabcf09e6c diff --cc include/simgrid/s4u/Activity.hpp index 085c853c97,a464c20643..0b5b174ed7 --- a/include/simgrid/s4u/Activity.hpp +++ b/include/simgrid/s4u/Activity.hpp @@@ -85,18 -84,15 +85,8 @@@ public Activity* set_remaining(double remains); /** Put some user data onto the Activity */ - Activity* set_user_data(void* data) - { - user_data_ = data; - return this; - } - /** Retrieve the user data of the Activity */ - void* get_user_data() { return user_data_; } - kernel::activity::ActivityImplPtr get_impl() { return pimpl_; } - - #ifndef DOXYGEN - XBT_ATTRIB_DEPRECATED_v324("Please use Activity::wait_for()") virtual void wait(double timeout) = 0; - XBT_ATTRIB_DEPRECATED_v323("Please use Activity::get_state()") Activity::State getState() { return state_; } - XBT_ATTRIB_DEPRECATED_v323("Please use Activity::get_remaining()") double getRemains() { return get_remaining(); } - XBT_ATTRIB_DEPRECATED_v323("Please use Activity::set_remaining()") Activity* setRemains(double remains) - { - return set_remaining(remains); - } - #endif + kernel::activity::ActivityImpl* get_impl() const { return pimpl_.get(); } private: kernel::activity::ActivityImplPtr pimpl_ = nullptr; diff --cc include/simgrid/s4u/Comm.hpp index 7cb8725a5f,8f767a33e9..612266e7da --- a/include/simgrid/s4u/Comm.hpp +++ b/include/simgrid/s4u/Comm.hpp @@@ -35,9 -36,10 +36,10 @@@ class XBT_PUBLIC Comm : public Activity void (*clean_fun_)(void*) = nullptr; void (*copy_data_function_)(kernel::activity::CommImpl*, void*, size_t) = nullptr; - Comm() : Activity() {} + Comm() = default; public: + #ifndef DOXYGEN friend XBT_PUBLIC void intrusive_ptr_release(Comm* c); friend XBT_PUBLIC void intrusive_ptr_add_ref(Comm* c); friend Mailbox; // Factory of comms diff --cc include/simgrid/s4u/Exec.hpp index e7e96103d9,a3920f7a74..bf9acf321c --- a/include/simgrid/s4u/Exec.hpp +++ b/include/simgrid/s4u/Exec.hpp @@@ -53,16 -62,18 +60,16 @@@ public bool test() override; ExecPtr set_bound(double bound); - ExecPtr set_name(const std::string& name); ExecPtr set_priority(double priority); - ExecPtr set_tracing_category(const std::string& category); ExecPtr set_timeout(double timeout); Exec* cancel() override; - - XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_priority()") ExecPtr setPriority(double priority) - { - return set_priority(priority); - } - XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_bound()") ExecPtr setBound(double bound) { return set_bound(bound); } - XBT_ATTRIB_DEPRECATED_v324("Please use Exec::wait_for()") void wait(double t) override { wait_for(t); } + const std::string& get_name() const { return name_; } + const char* get_cname() const { return name_.c_str(); } + Host* get_host() const; + unsigned int get_host_number() const; + double get_start_time() const; + double get_finish_time() const; + double get_cost() const; }; class XBT_PUBLIC ExecSeq : public Exec { diff --cc include/simgrid/s4u/Io.hpp index 395dfb974b,0ca0145b61..c9d55d65c9 --- a/include/simgrid/s4u/Io.hpp +++ b/include/simgrid/s4u/Io.hpp @@@ -17,17 -17,19 +17,18 @@@ namespace s4u /** I/O Activity, representing the asynchronous disk access. * - * They are generated from Storage::io_init() or Storage::read() and Storage::write(). + * They are generated from Disk::io_init(), Disk::read() Disk::read_async(), Disk::write() and Disk::write_async(). */ -class XBT_PUBLIC Io : public Activity { +class XBT_PUBLIC Io : public Activity_T { public: enum class OpType { READ, WRITE }; private: Storage* storage_ = nullptr; + Disk* disk_ = nullptr; sg_size_t size_ = 0; OpType type_ = OpType::READ; - std::string name_ = ""; std::atomic_int_fast32_t refcount_{0}; explicit Io(sg_storage_t storage, sg_size_t size, OpType type); diff --cc src/s4u/s4u_Comm.cpp index 188fda5788,730a6b4f29..c50b10a632 --- a/src/s4u/s4u_Comm.cpp +++ b/src/s4u/s4u_Comm.cpp @@@ -106,9 -106,16 +106,16 @@@ CommPtr Comm::set_dst_data(void** buff return this; } + CommPtr Comm::set_tracing_category(const std::string& category) + { + xbt_assert(state_ == State::INITED, "Cannot change the tracing category of an exec after its start"); + tracing_category_ = category; + return this; + } + Comm* Comm::start() { - xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", + xbt_assert(get_state() == State::INITED, "You cannot use %s() once your communication started (not implemented)", __FUNCTION__); if (src_buff_ != nullptr) { // Sender side diff --cc src/s4u/s4u_Exec.cpp index e65f99605f,698c1b1261..76dbb61622 --- a/src/s4u/s4u_Exec.cpp +++ b/src/s4u/s4u_Exec.cpp @@@ -90,6 -98,34 +98,27 @@@ ExecPtr Exec::set_timeout(double timeou return this; } -ExecPtr Exec::set_name(const std::string& name) -{ - xbt_assert(state_ == State::INITED, "Cannot change the name of an exec after its start"); - name_ = name; - return this; -} - + Host* Exec::get_host() const + { + return static_cast(pimpl_.get())->get_host(); + } + unsigned int Exec::get_host_number() const + { + return static_cast(pimpl_.get())->get_host_number(); + } + double Exec::get_start_time() const + { + return (pimpl_->surf_action_ == nullptr) ? -1 : pimpl_->surf_action_->get_start_time(); + } + double Exec::get_finish_time() const + { + return (pimpl_->surf_action_ == nullptr) ? -1 : pimpl_->surf_action_->get_finish_time(); + } + double Exec::get_cost() const + { + return (pimpl_->surf_action_ == nullptr) ? -1 : pimpl_->surf_action_->get_cost(); + } + /** @brief Change the execution priority, don't you think? * * An execution with twice the priority will get twice the amount of flops when the resource is shared.