From a91ed4612675df3eb54e154f6525c3cc96a50b7f Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 7 Mar 2017 11:53:52 +0100 Subject: [PATCH] add an easy way to retrieve the name of the current actor --- include/simgrid/s4u/Actor.hpp | 7 +++++-- src/s4u/s4u_actor.cpp | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) 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; +} } } } -- 2.20.1