Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into CRTP
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Mon, 7 Oct 2019 08:04:41 +0000 (10:04 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Mon, 7 Oct 2019 08:04:41 +0000 (10:04 +0200)
1  2 
include/simgrid/s4u/Activity.hpp
include/simgrid/s4u/Comm.hpp
include/simgrid/s4u/Exec.hpp
include/simgrid/s4u/Io.hpp
src/s4u/s4u_Comm.cpp
src/s4u/s4u_Exec.cpp

@@@ -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;
@@@ -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
@@@ -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 {
@@@ -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<Io> {
  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);
@@@ -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
@@@ -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<kernel::activity::ExecImpl*>(pimpl_.get())->get_host();
+ }
+ unsigned int Exec::get_host_number() const
+ {
+   return static_cast<kernel::activity::ExecImpl*>(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.