CAF  0.17.3
Public Member Functions | List of all members
caf::actor_profiler Class Referenceabstract

A profiler which provides a set of callbacks for several actor operations in order to collect fine-grained profiling state about the system. More...

#include <actor_profiler.hpp>

Public Member Functions

virtual void add_actor (const local_actor &self, const local_actor *parent)=0
 Called whenever the actor system spawns a new actor. More...
 
virtual void remove_actor (const local_actor &self)=0
 Called before the actor system calls the destructor for self. More...
 
virtual void before_processing (const local_actor &self, const mailbox_element &element)=0
 Called whenever an actor is about to process an element from its mailbox. More...
 
virtual void after_processing (const local_actor &self, invoke_message_result result)=0
 Called after an actor processed an element from its mailbox. More...
 
virtual void before_sending (const local_actor &self, mailbox_element &element)=0
 Called whenever an actor is about to send a message. More...
 
virtual void before_sending_scheduled (const local_actor &self, caf::actor_clock::time_point timeout, mailbox_element &element)=0
 Analogous to before_sending, but called whenever an actor is about to call actor_clock::schedule_message. More...
 

Detailed Description

A profiler which provides a set of callbacks for several actor operations in order to collect fine-grained profiling state about the system.

Attention
This feature is experimental.

Member Function Documentation

◆ add_actor()

virtual void caf::actor_profiler::add_actor ( const local_actor &  self,
const local_actor *  parent 
)
pure virtual

Called whenever the actor system spawns a new actor.

The system calls this member function after the constructor of self has completed but before constructing the behavior.

Parameters
selfThe new actor.
parentPoints to the parent actor unless self is a top-level actor (in this case, parent has the value nullptr). @thread-safe

◆ after_processing()

virtual void caf::actor_profiler::after_processing ( const local_actor &  self,
invoke_message_result  result 
)
pure virtual

Called after an actor processed an element from its mailbox.

Parameters
selfThe current actor.
resultStores whether the actor consumed, skipped or dropped the message. @thread-safe

◆ before_processing()

virtual void caf::actor_profiler::before_processing ( const local_actor &  self,
const mailbox_element &  element 
)
pure virtual

Called whenever an actor is about to process an element from its mailbox.

Parameters
selfThe current actor.
elementThe current element from the mailbox. @thread-safe

◆ before_sending()

virtual void caf::actor_profiler::before_sending ( const local_actor &  self,
mailbox_element &  element 
)
pure virtual

Called whenever an actor is about to send a message.

Allows the profiler to inject arbitrary meta data before putting the mailbox element into the mailbox of the receiver.

Parameters
selfThe current actor.
elementThe outgoing mailbox element.
Note
The profiler gets a mutable reference to element, but it is only supposed to inject meta data. Not to alter the message itself. Doing so is an easy way to introduce bugs that are very hard to track down. @thread-safe

◆ before_sending_scheduled()

virtual void caf::actor_profiler::before_sending_scheduled ( const local_actor &  self,
caf::actor_clock::time_point  timeout,
mailbox_element &  element 
)
pure virtual

Analogous to before_sending, but called whenever an actor is about to call actor_clock::schedule_message.

Parameters
selfThe current actor.
timeoutTime point for the message delivery.
elementThe outgoing mailbox element. @thread-safe

◆ remove_actor()

virtual void caf::actor_profiler::remove_actor ( const local_actor &  self)
pure virtual

Called before the actor system calls the destructor for self.

Parameters
ptrPoints to an actor that is about to get destroyed. @thread-safe

The documentation for this class was generated from the following file: