Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
actually rename s4u::Process into s4u::Actor
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 12 Aug 2015 19:44:15 +0000 (21:44 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 12 Aug 2015 20:12:25 +0000 (22:12 +0200)
examples/s4u/dumb/s4u_test.cpp
include/simgrid/s4u.h
include/simgrid/s4u/actor.hpp [moved from include/simgrid/s4u/process.hpp with 50% similarity]
include/simgrid/s4u/engine.hpp
include/simgrid/s4u/host.hpp
include/simgrid/s4u/mailbox.hpp
src/s4u/s4u_actor.cpp [moved from src/s4u/s4u_process.cpp with 53% similarity]
tools/cmake/DefinePackages.cmake

index 51001e3..6087684 100644 (file)
@@ -10,10 +10,10 @@ using namespace s4u;
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "a sample log category");
 
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "a sample log category");
 
-class Worker : Process {
+class Worker : Actor {
 public:
        Worker(const char*procname, Host *host,int argc, char **argv)
 public:
        Worker(const char*procname, Host *host,int argc, char **argv)
-                       : s4u::Process(procname,host,argc,argv){}
+                       : s4u::Actor(procname,host,argc,argv){}
 
        int main(int argc, char **argv) {
                XBT_INFO("Hello s4u, I'm ready to serve");
 
        int main(int argc, char **argv) {
                XBT_INFO("Hello s4u, I'm ready to serve");
@@ -25,10 +25,10 @@ public:
        }
 };
 
        }
 };
 
-class Master : Process {
+class Master : Actor {
 public:
        Master(const char*procname, Host *host,int argc, char **argv)
 public:
        Master(const char*procname, Host *host,int argc, char **argv)
-                       : Process(procname,host,argc,argv){}
+                       : Actor(procname,host,argc,argv){}
 
        int main(int argc, char **argv) {
                XBT_INFO("Hello s4u, I have something to send");
 
        int main(int argc, char **argv) {
                XBT_INFO("Hello s4u, I have something to send");
index 6742142..5844847 100644 (file)
@@ -6,9 +6,9 @@
 #ifndef SIMGRID_S4U_S4U_H
 #define SIMGRID_S4U_S4U_H
 
 #ifndef SIMGRID_S4U_S4U_H
 #define SIMGRID_S4U_S4U_H
 
+#include "s4u/actor.hpp"
 #include "s4u/mailbox.hpp"
 #include "simgrid/s4u/engine.hpp"
 #include "simgrid/s4u/host.hpp"
 #include "s4u/mailbox.hpp"
 #include "simgrid/s4u/engine.hpp"
 #include "simgrid/s4u/host.hpp"
-#include "simgrid/s4u/process.hpp"
 
 #endif /* SIMGRID_S4U_S4U_H */
 
 #endif /* SIMGRID_S4U_S4U_H */
similarity index 50%
rename from include/simgrid/s4u/process.hpp
rename to include/simgrid/s4u/actor.hpp
index b8a9fb1..ec7e421 100644 (file)
@@ -3,8 +3,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#ifndef SIMGRID_S4U_PROCESS_HPP
-#define SIMGRID_S4U_PROCESS_HPP
+#ifndef SIMGRID_S4U_ACTOR_HPP
+#define SIMGRID_S4U_ACTOR_HPP
 
 #include "simgrid/simix.h"
 
 
 #include "simgrid/simix.h"
 
@@ -16,20 +16,20 @@ class Mailbox;
 
 /** @brief Simulation Agent
  *
 
 /** @brief Simulation Agent
  *
- * A process may be defined as a code executing in a location (host).
+ * An actor may be defined as a code executing in a location (host).
  *
  *
- * All processes should be started from the XML deployment file (using the @link{s4u::Engine::loadDeployment()}),
- * even if you can also start new processes directly.
+ * All actors should be started from the XML deployment file (using the @link{s4u::Engine::loadDeployment()}),
+ * even if you can also start new actors directly.
  * Separating the deployment in the XML from the logic in the code is a good habit as it makes your simulation easier
  * to adapt to new settings.
  *
  * Separating the deployment in the XML from the logic in the code is a good habit as it makes your simulation easier
  * to adapt to new settings.
  *
- * The code that you define for a given process should be placed in the main method that is virtual.
- * For example, a Worker process should be declared as follows:
+ * The code that you define for a given actor should be placed in the main method that is virtual.
+ * For example, a Worker actor should be declared as follows:
  *
  * \verbatim
  *
  * \verbatim
- * #include "s4u/process.hpp"
+ * #include "s4u/actor.hpp"
  *
  *
- * class Worker : simgrid::s4u::Process {
+ * class Worker : simgrid::s4u::Actor {
  *
  *       int main(int argc, char **argv) {
  *             printf("Hello s4u");
  *
  *       int main(int argc, char **argv) {
  *             printf("Hello s4u");
@@ -38,56 +38,56 @@ class Mailbox;
  * \endverbatim
  *
  */
  * \endverbatim
  *
  */
-class Process {
+class Actor {
 public:
 public:
-       Process(const char*procname, s4u::Host *host, int argc, char **argv);
-       Process(const char*procname, s4u::Host *host, int argc, char **argv, double killTime);
-       virtual ~Process() {}
+       Actor(const char*name, s4u::Host *host, int argc, char **argv);
+       Actor(const char*name, s4u::Host *host, int argc, char **argv, double killTime);
+       virtual ~Actor() {}
 
        /** The main method of your agent */
        virtual int main(int argc, char **argv)=0;
 
 
        /** The main method of your agent */
        virtual int main(int argc, char **argv)=0;
 
-       /** The process that is currently running */
-       static Process *current();
-       /** Retrieves the process that have the given PID (or NULL if not existing) */
-       static Process *byPid(int pid);
+       /** The Actor that is currently running */
+       static Actor *current();
+       /** Retrieves the actor that have the given PID (or NULL if not existing) */
+       static Actor *byPid(int pid);
 
 
-       /** Retrieves the name of that process */
+       /** Retrieves the name of that actor */
        const char*getName();
        const char*getName();
-       /** Retrieves the host on which that process is running */
+       /** Retrieves the host on which that actor is running */
        s4u::Host *getHost();
        s4u::Host *getHost();
-       /** Retrieves the PID of that process */
+       /** Retrieves the PID of that actor */
        int getPid();
 
        int getPid();
 
-       /** If set to true, the process will automatically restart when its host reboots */
+       /** If set to true, the actor will automatically restart when its host reboots */
        void setAutoRestart(bool autorestart);
        void setAutoRestart(bool autorestart);
-       /** Sets the time at which that process should be killed */
+       /** Sets the time at which that actor should be killed */
        void setKillTime(double time);
        void setKillTime(double time);
-       /** Retrieves the time at which that process will be killed (or -1 if not set) */
+       /** Retrieves the time at which that actor will be killed (or -1 if not set) */
        double getKillTime();
 
        double getKillTime();
 
-       /** Ask kindly to all processes to die. Only the issuer will survive. */
+       /** Ask kindly to all actors to die. Only the issuer will survive. */
        static void killAll();
        static void killAll();
-       /** Ask the process to die.
+       /** Ask the actor to die.
         *
         * It will only notice your request when doing a simcall next time (a communication or similar).
         *
         * It will only notice your request when doing a simcall next time (a communication or similar).
-        * SimGrid sometimes have issues when you kill processes that are currently communicating and such. We are working on it to fix the issues.
+        * SimGrid sometimes have issues when you kill actors that are currently communicating and such. We are working on it to fix the issues.
         */
        void kill();
 
         */
        void kill();
 
-       /** Block the process sleeping for that amount of seconds (may throws hostFailure) */
+       /** Block the actor sleeping for that amount of seconds (may throws hostFailure) */
        void sleep(double duration);
 
        void sleep(double duration);
 
-       /** Block the process, computing the given amount of flops */
+       /** Block the actor, computing the given amount of flops */
        void execute(double flop);
 
        void execute(double flop);
 
-       /** Block the process until it gets a message from the given mailbox */
+       /** Block the actor until it gets a message from the given mailbox */
        //void* recv(const char *mailbox);
 
        //void* recv(const char *mailbox);
 
-       /** Block the process until it gets a string message (to be freed after use) from the given mailbox */
+       /** Block the actor until it gets a string message (to be freed after use) from the given mailbox */
        char *recvstr(Mailbox &chan);
 
        char *recvstr(Mailbox &chan);
 
-       /** Block the process until it delivers a string message (that will be copied) to the given mailbox */
+       /** Block the actor until it delivers a string message (that will be copied) to the given mailbox */
        void sendstr(Mailbox &chan, const char*msg);
 
 protected:
        void sendstr(Mailbox &chan, const char*msg);
 
 protected:
@@ -97,11 +97,11 @@ private:
 };
 }} // namespace simgrid::s4u
 
 };
 }} // namespace simgrid::s4u
 
-#endif /* SIMGRID_S4U_PROCESS_HPP */
+#endif /* SIMGRID_S4U_ACTOR_HPP */
 
 #if 0
 
 
 #if 0
 
-public abstract class Process implements Runnable {
+public abstract class Actor implements Runnable {
        /** Suspends the process. See {@link #resume()} to resume it afterward */
        public native void suspend();
        /** Resume a process that was suspended by {@link #suspend()}. */
        /** Suspends the process. See {@link #resume()} to resume it afterward */
        public native void suspend();
        /** Resume a process that was suspended by {@link #suspend()}. */
index 7c2f9af..96ef4dc 100644 (file)
@@ -24,17 +24,17 @@ public:
         */
        void loadPlatform(const char *platf);
 
         */
        void loadPlatform(const char *platf);
 
-       /** Registers the main function of a process that will be launched from the deployment file */
+       /** Registers the main function of an actor that will be launched from the deployment file */
        void register_function(const char*name, int (*code)(int,char**));
 
        void register_function(const char*name, int (*code)(int,char**));
 
-       /** Registers a function as the default main function of processes
+       /** Registers a function as the default main function of actors
         *
         * It will be used as fallback when the function requested from the deployment file was not registered.
         * It is used for trace-based simulations (see examples/msg/actions).
         */
        void register_default(int (*code)(int,char**));
 
         *
         * It will be used as fallback when the function requested from the deployment file was not registered.
         * It is used for trace-based simulations (see examples/msg/actions).
         */
        void register_default(int (*code)(int,char**));
 
-       /** @brief Load a deployment file and launch the processes that it contains */
+       /** @brief Load a deployment file and launch the actors that it contains */
        void loadDeployment(const char *deploy);
 
        /** @brief Run the simulation */
        void loadDeployment(const char *deploy);
 
        /** @brief Run the simulation */
index 54399ec..6998b87 100644 (file)
@@ -13,9 +13,9 @@
 namespace simgrid {
 namespace s4u {
 
 namespace simgrid {
 namespace s4u {
 
-class Process;
+class Actor;
 
 
-/** @brief Simulated machine that can host some processes
+/** @brief Simulated machine that can host some actors
  *
  * It represents some physical resource with computing and networking capabilities.
  *
  *
  * It represents some physical resource with computing and networking capabilities.
  *
@@ -24,7 +24,7 @@ class Process;
  * You cannot create a host yourself.
  *
  * You can retrieve a particular host using @link{simgrid::s4u::Host.byName()},
  * You cannot create a host yourself.
  *
  * You can retrieve a particular host using @link{simgrid::s4u::Host.byName()},
- * and processes can retrieve the host on which they run using @link{simgrid::s4u::Host.current()}.
+ * and actors can retrieve the host on which they run using @link{simgrid::s4u::Host.current()}.
  */
 class Host {
 private:
  */
 class Host {
 private:
@@ -32,18 +32,18 @@ private:
 public:
        /** Retrieves an host from its name. */
        static s4u::Host *byName(std::string name);
 public:
        /** Retrieves an host from its name. */
        static s4u::Host *byName(std::string name);
-       /** Retrieves the host on which the current process is running */
+       /** Retrieves the host on which the current actor is running */
        static s4u::Host *current();
 
        const char* getName();
 
        static s4u::Host *current();
 
        const char* getName();
 
-       /** Turn sthat host on if it was previously off
+       /** Turnthat host on if it was previously off
         *
         *
-        * All processes on that host which were marked autorestart will be restarted automatically.
+        * All actors on that host which were marked autorestart will be restarted automatically.
         * This call does nothing if the host is already on.
         */
        void turnOn();
         * This call does nothing if the host is already on.
         */
        void turnOn();
-       /** Turns that host off. All processes are forcefully stopped. */
+       /** Turns that host off. All actors are forcefully stopped. */
        void turnOff();
        /** Returns if that host is currently up and running */
        bool isOn();
        void turnOff();
        /** Returns if that host is currently up and running */
        bool isOn();
@@ -55,7 +55,7 @@ public:
        void* getData() {return p_userdata;}
 
 protected:
        void* getData() {return p_userdata;}
 
 protected:
-       friend Process;
+       friend Actor;
        sg_host_t getInferior() {return p_sghost;}
 private:
        void*p_userdata=NULL;
        sg_host_t getInferior() {return p_sghost;}
 private:
        void*p_userdata=NULL;
index c76a4d9..cb3369f 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <boost/unordered_map.hpp>
 
 
 #include <boost/unordered_map.hpp>
 
-#include "simgrid/s4u/process.hpp"
+#include "actor.hpp"
 
 namespace simgrid {
 namespace s4u {
 
 namespace simgrid {
 namespace s4u {
@@ -21,7 +21,7 @@ namespace s4u {
  * sender and receiver.
  */
 class Mailbox {
  * sender and receiver.
  */
 class Mailbox {
-       friend Process;
+       friend Actor;
 
 private:
        Mailbox(const char*name, smx_rdv_t inferior);
 
 private:
        Mailbox(const char*name, smx_rdv_t inferior);
similarity index 53%
rename from src/s4u/s4u_process.cpp
rename to src/s4u/s4u_actor.cpp
index b75cd58..8d4f299 100644 (file)
@@ -4,22 +4,22 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include "../../include/simgrid/s4u/actor.hpp"
 #include "../../include/simgrid/s4u/mailbox.hpp"
 #include "xbt/log.h"
 #include "msg/msg_private.h"
 #include "msg/msg_mailbox.h"
 
 #include "simgrid/s4u/host.hpp"
 #include "../../include/simgrid/s4u/mailbox.hpp"
 #include "xbt/log.h"
 #include "msg/msg_private.h"
 #include "msg/msg_mailbox.h"
 
 #include "simgrid/s4u/host.hpp"
-#include "simgrid/s4u/process.hpp"
 
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_process,"S4U processes");
+XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor,"S4U actors");
 
 
-/* C main function of a process, running this->main */
-static int s4u_process_runner(int argc, char **argv) {
+/* C main function of a actor, running this->main */
+static int s4u_actor_runner(int argc, char **argv) {
 
        smx_process_t smx_proc = SIMIX_process_self();
 
        smx_process_t smx_proc = SIMIX_process_self();
-       simgrid::s4u::Process *proc = (simgrid::s4u::Process*) SIMIX_process_self_get_data(smx_proc);
-       int res= proc->main(argc,argv);
+       simgrid::s4u::Actor *actor = (simgrid::s4u::Actor*) SIMIX_process_self_get_data(smx_proc);
+       int res = actor->main(argc,argv);
        return res;
 }
 
        return res;
 }
 
@@ -27,61 +27,61 @@ static int s4u_process_runner(int argc, char **argv) {
 
 using namespace simgrid;
 
 
 using namespace simgrid;
 
-s4u::Process::Process(const char *procname, s4u::Host *host, int argc, char **argv)
-    : s4u::Process::Process(procname,host, argc,argv, -1) {
+s4u::Actor::Actor(const char *name, s4u::Host *host, int argc, char **argv)
+    : s4u::Actor::Actor(name,host, argc,argv, -1) {
 }
 }
-s4u::Process::Process(const char *procname, s4u::Host *host, int argc, char **argv, double killTime) {
-       p_smx_process = simcall_process_create(procname, s4u_process_runner, this, host->getName(), killTime, argc, argv, NULL/*properties*/,0);
+s4u::Actor::Actor(const char *name, s4u::Host *host, int argc, char **argv, double killTime) {
+       p_smx_process = simcall_process_create(name, s4u_actor_runner, this, host->getName(), killTime, argc, argv, NULL/*properties*/,0);
 
 
-       xbt_assert(p_smx_process,"Cannot create the process");
+       xbt_assert(p_smx_process,"Cannot create the actor");
 //     TRACE_msg_process_create(procname, simcall_process_get_PID(p_smx_process), host->getInferior());
 //     simcall_process_on_exit(p_smx_process,(int_f_pvoid_pvoid_t)TRACE_msg_process_kill,p_smx_process);
 }
 
 //     TRACE_msg_process_create(procname, simcall_process_get_PID(p_smx_process), host->getInferior());
 //     simcall_process_on_exit(p_smx_process,(int_f_pvoid_pvoid_t)TRACE_msg_process_kill,p_smx_process);
 }
 
-s4u::Process *s4u::Process::current() {
+s4u::Actor *s4u::Actor::current() {
        smx_process_t smx_proc = SIMIX_process_self();
        smx_process_t smx_proc = SIMIX_process_self();
-       return (simgrid::s4u::Process*) SIMIX_process_self_get_data(smx_proc);
+       return (simgrid::s4u::Actor*) SIMIX_process_self_get_data(smx_proc);
 }
 }
-s4u::Process *s4u::Process::byPid(int pid) {
-       return (simgrid::s4u::Process*) SIMIX_process_self_get_data(SIMIX_process_from_PID(pid));
+s4u::Actor *s4u::Actor::byPid(int pid) {
+       return (simgrid::s4u::Actor*) SIMIX_process_self_get_data(SIMIX_process_from_PID(pid));
 }
 
 }
 
-void s4u::Process::setAutoRestart(bool autorestart) {
+void s4u::Actor::setAutoRestart(bool autorestart) {
        simcall_process_auto_restart_set(p_smx_process,autorestart);
 }
 
        simcall_process_auto_restart_set(p_smx_process,autorestart);
 }
 
-s4u::Host *s4u::Process::getHost() {
+s4u::Host *s4u::Actor::getHost() {
        return s4u::Host::byName(sg_host_name(simcall_process_get_host(p_smx_process)));
 }
        return s4u::Host::byName(sg_host_name(simcall_process_get_host(p_smx_process)));
 }
-const char* s4u::Process::getName() {
+const char* s4u::Actor::getName() {
        return simcall_process_get_name(p_smx_process);
 }
        return simcall_process_get_name(p_smx_process);
 }
-int s4u::Process::getPid(){
+int s4u::Actor::getPid(){
        return simcall_process_get_PID(p_smx_process);
 }
 
        return simcall_process_get_PID(p_smx_process);
 }
 
-void s4u::Process::setKillTime(double time) {
+void s4u::Actor::setKillTime(double time) {
        simcall_process_set_kill_time(p_smx_process,time);
 }
        simcall_process_set_kill_time(p_smx_process,time);
 }
-double s4u::Process::getKillTime() {
+double s4u::Actor::getKillTime() {
        return simcall_process_get_kill_time(p_smx_process);
 }
        return simcall_process_get_kill_time(p_smx_process);
 }
-void s4u::Process::killAll() {
+void s4u::Actor::killAll() {
        simcall_process_killall(1);
 }
        simcall_process_killall(1);
 }
-void s4u::Process::kill() {
+void s4u::Actor::kill() {
        simcall_process_kill(p_smx_process);
 }
 
        simcall_process_kill(p_smx_process);
 }
 
-void s4u::Process::sleep(double duration) {
+void s4u::Actor::sleep(double duration) {
        simcall_process_sleep(duration);
 }
 
        simcall_process_sleep(duration);
 }
 
-void s4u::Process::execute(double flops) {
+void s4u::Actor::execute(double flops) {
        simcall_process_execute(NULL,flops,1.0/*priority*/,0./*bound*/, 0L/*affinity*/);
 }
 
        simcall_process_execute(NULL,flops,1.0/*priority*/,0./*bound*/, 0L/*affinity*/);
 }
 
-char *s4u::Process::recvstr(Mailbox &chan) {
+char *s4u::Actor::recvstr(Mailbox &chan) {
        char *res=NULL;
        size_t res_size=sizeof(res);
 
        char *res=NULL;
        size_t res_size=sizeof(res);
 
@@ -89,7 +89,7 @@ char *s4u::Process::recvstr(Mailbox &chan) {
 
     return res;
 }
 
     return res;
 }
-void s4u::Process::sendstr(Mailbox &chan, const char*msg) {
+void s4u::Actor::sendstr(Mailbox &chan, const char*msg) {
        char *msg_cpy=xbt_strdup(msg);
        smx_synchro_t comm = simcall_comm_isend(p_smx_process, chan.getInferior(), strlen(msg),
                        -1/*rate*/, msg_cpy, sizeof(void *),
        char *msg_cpy=xbt_strdup(msg);
        smx_synchro_t comm = simcall_comm_isend(p_smx_process, chan.getInferior(), strlen(msg),
                        -1/*rate*/, msg_cpy, sizeof(void *),
index f563ee1..459c7dc 100644 (file)
@@ -379,10 +379,10 @@ else()
 endif()
 
 set(S4U_SRC
 endif()
 
 set(S4U_SRC
+  src/s4u/s4u_actor.cpp
   src/s4u/s4u_engine.cpp  
   src/s4u/s4u_host.cpp  
   src/s4u/s4u_mailbox.cpp
   src/s4u/s4u_engine.cpp  
   src/s4u/s4u_host.cpp  
   src/s4u/s4u_mailbox.cpp
-  src/s4u/s4u_process.cpp
 )
 
 set(SIMGRID_SRC
 )
 
 set(SIMGRID_SRC
@@ -690,10 +690,10 @@ set(headers_to_install
   include/simgrid/simix.h
   include/simgrid/host.h
   include/simgrid/link.h
   include/simgrid/simix.h
   include/simgrid/host.h
   include/simgrid/link.h
+  include/simgrid/s4u/actor.hpp
   include/simgrid/s4u/engine.hpp  
   include/simgrid/s4u/host.hpp  
   include/simgrid/s4u/mailbox.hpp  
   include/simgrid/s4u/engine.hpp  
   include/simgrid/s4u/host.hpp  
   include/simgrid/s4u/mailbox.hpp  
-  include/simgrid/s4u/process.hpp
   include/simgrid/s4u.h
   include/smpi/mpi.h
   include/smpi/smpi.h
   include/simgrid/s4u.h
   include/smpi/mpi.h
   include/smpi/smpi.h