From: Martin Quinson Date: Tue, 7 Mar 2017 10:53:52 +0000 (+0100) Subject: add an easy way to retrieve the name of the current actor X-Git-Tag: v3_15~208^2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a91ed4612675df3eb54e154f6525c3cc96a50b7f?ds=sidebyside add an easy way to retrieve the name of the current actor --- diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index d014ceff7d..0a14c7d089 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -289,11 +289,14 @@ namespace this_actor { */ XBT_PUBLIC(void) send(MailboxPtr chan, void*payload, size_t simulatedSize); - /** @brief Return the PID of the current actor. */ + /** @brief Returns the PID of the current actor. */ XBT_PUBLIC(int) pid(); - /** @brief Return the PPID of the current actor. */ + /** @brief Returns the PPID of the current actor. */ int ppid(); + + /** @brief Returns the name of the current actor. */ + std::string name(); }; /** @} */ diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index 28833f1faf..257717fec6 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -163,6 +163,10 @@ int ppid() return SIMIX_process_self()->ppid; } +std::string name() +{ + return SIMIX_process_self()->name; +} } } }