Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
allow to set a tracing category for an Exec
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Sat, 21 Jul 2018 13:25:17 +0000 (15:25 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Sat, 21 Jul 2018 13:25:17 +0000 (15:25 +0200)
include/simgrid/s4u/Exec.hpp
src/kernel/activity/ExecImpl.cpp
src/kernel/activity/ExecImpl.hpp
src/s4u/s4u_Exec.cpp

index 6d647ff..d4411ef 100644 (file)
@@ -32,6 +32,7 @@ public:
   ExecPtr set_bound(double bound);
   ExecPtr set_host(Host* host);
   ExecPtr set_name(std::string name);
   ExecPtr set_bound(double bound);
   ExecPtr set_host(Host* host);
   ExecPtr set_name(std::string name);
+  ExecPtr set_tracing_category(std::string category);
   Host* get_host();
 
   double get_remaining() override;
   Host* get_host();
 
   double get_remaining() override;
index dc7dad5..ea4995d 100644 (file)
@@ -86,6 +86,12 @@ void simgrid::kernel::activity::ExecImpl::set_priority(double priority)
     surf_action_->set_priority(priority);
 }
 
     surf_action_->set_priority(priority);
 }
 
+void simgrid::kernel::activity::ExecImpl::set_category(std::string category)
+{
+  if (surf_action_)
+    surf_action_->set_category(category);
+}
+
 void simgrid::kernel::activity::ExecImpl::post()
 {
   if (host_ && host_->is_off()) { /* FIXME: handle resource failure for parallel tasks too */
 void simgrid::kernel::activity::ExecImpl::post()
 {
   if (host_ && host_->is_off()) { /* FIXME: handle resource failure for parallel tasks too */
index 453d4f1..fb5248e 100644 (file)
@@ -27,6 +27,7 @@ public:
   double get_remaining_ratio();
   void set_bound(double bound);
   void set_priority(double priority);
   double get_remaining_ratio();
   void set_bound(double bound);
   void set_priority(double priority);
+  void set_category(std::string category);
   virtual ActivityImpl* migrate(s4u::Host* to);
 
   /* The host where the execution takes place. nullptr means this is a parallel exec (and only surf knows the hosts) */
   virtual ActivityImpl* migrate(s4u::Host* to);
 
   /* The host where the execution takes place. nullptr means this is a parallel exec (and only surf knows the hosts) */
index d956b76..a61217d 100644 (file)
@@ -96,6 +96,18 @@ ExecPtr Exec::set_name(std::string name)
   return this;
 }
 
   return this;
 }
 
+ExecPtr Exec::set_tracing_category(std::string category)
+{
+  xbt_assert(state_ == State::INITED, "Cannot change the name of an exec after its start");
+  if (category.empty())
+    return this;
+
+  simgrid::simix::simcall([this, category] {
+    boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(pimpl_)->set_category(category);
+  });
+  return this;
+}
+
 /** @brief Retrieve the host on which this activity takes place. */
 Host* Exec::get_host()
 {
 /** @brief Retrieve the host on which this activity takes place. */
 Host* Exec::get_host()
 {