Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into CRTP
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 10 Oct 2019 09:15:07 +0000 (11:15 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 10 Oct 2019 09:15:07 +0000 (11:15 +0200)
1  2 
include/simgrid/s4u/Exec.hpp
src/s4u/s4u_Exec.cpp

@@@ -21,12 -21,13 +21,11 @@@ namespace s4u 
   * They are generated from this_actor::exec_init() or Host::execute(), and can be used to model pools of threads or
   * similar mechanisms.
   */
 -class XBT_PUBLIC Exec : public Activity {
 -  std::string name_             = "";
 +class XBT_PUBLIC Exec : public Activity_T<Exec> {
    double priority_              = 1.0;
    double bound_                 = 0.0;
    double timeout_               = 0.0;
 -  std::string tracing_category_ = "";
    std::atomic_int_fast32_t refcount_{0};
-   Host* host_ = nullptr;
  
  protected:
    Exec();
@@@ -60,7 -61,9 +59,7 @@@ 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;
    const std::string& get_name() const { return name_; }
@@@ -85,7 -88,6 +84,6 @@@ public
    Exec* start() override;
  
    ExecPtr set_host(Host* host) override;
-   Host* get_host();
  
    double get_remaining() override;
    double get_remaining_ratio() override;
diff --combined src/s4u/s4u_Exec.cpp
@@@ -98,6 -98,16 +98,16 @@@ 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;
+ }
+ /** @brief Retrieve the host on which this activity takes place.
+  *  If it runs on more than one host, only the first host is returned.
+  */
  Host* Exec::get_host() const
  {
    return static_cast<kernel::activity::ExecImpl*>(pimpl_.get())->get_host();
@@@ -132,6 -142,13 +142,6 @@@ ExecPtr Exec::set_priority(double prior
    return this;
  }
  
 -ExecPtr Exec::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;
 -}
 -
  ///////////// SEQUENTIAL EXECUTIONS ////////
  ExecSeq::ExecSeq(sg_host_t host, double flops_amount) : Exec(), flops_amount_(flops_amount)
  {
@@@ -165,18 -182,10 +175,10 @@@ ExecPtr ExecSeq::set_host(Host* host
               "Cannot change the host of an exec once it's done (state: %d)", (int)state_);
    if (state_ == State::STARTED)
      boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(pimpl_)->migrate(host);
-   host_ = host;
    boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(pimpl_)->set_host(host);
    return this;
  }
  
- /** @brief Retrieve the host on which this activity takes place. */
- Host* ExecSeq::get_host()
- {
-   return host_;
- }
  /** @brief Returns the amount of flops that remain to be done */
  double ExecSeq::get_remaining()
  {