Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add parallel_execute with timeout in s4u.
[simgrid.git] / src / s4u / s4u_actor.cpp
index c5fa2f2..02b8a9a 100644 (file)
@@ -85,14 +85,14 @@ void Actor::daemonize()
   simgrid::simix::kernelImmediate([this]() { pimpl_->daemonize(); });
 }
 
-const char* Actor::getCname()
+const simgrid::xbt::string& Actor::getName() const
 {
-  return this->pimpl_->name.c_str();
+  return this->pimpl_->getName();
 }
 
-simgrid::xbt::string Actor::getName()
+const char* Actor::getCname() const
 {
-  return this->pimpl_->name;
+  return this->pimpl_->getCname();
 }
 
 aid_t Actor::getPid()
@@ -214,6 +214,11 @@ void sleep_for(double duration)
     simcall_process_sleep(duration);
 }
 
+void yield()
+{
+  simgrid::simix::kernelImmediate([] { /* do nothing*/ });
+}
+
 XBT_PUBLIC(void) sleep_until(double timeout)
 {
   double now = SIMIX_get_clock();
@@ -227,6 +232,25 @@ void execute(double flops)
   simcall_execution_wait(s);
 }
 
+void execute(double flops, double priority)
+{
+  smx_activity_t s = simcall_execution_start(nullptr,flops,1 / priority/*priority*/,0./*bound*/);
+  simcall_execution_wait(s);
+}
+
+void parallel_execute(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double timeout)
+{
+  smx_activity_t s =
+      simcall_execution_parallel_start(nullptr, host_nb, host_list, flops_amount, bytes_amount, -1, timeout);
+  simcall_execution_wait(s);
+}
+
+void parallel_execute(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount)
+{
+  smx_activity_t s = simcall_execution_parallel_start(nullptr, host_nb, host_list, flops_amount, bytes_amount, -1, -1);
+  simcall_execution_wait(s);
+}
+
 void* recv(MailboxPtr chan) // deprecated
 {
   return chan->get();
@@ -269,7 +293,12 @@ aid_t getPpid()
 
 std::string getName()
 {
-  return SIMIX_process_self()->name;
+  return SIMIX_process_self()->getName();
+}
+
+const char* getCname()
+{
+  return SIMIX_process_self()->getCname();
 }
 
 Host* getHost()