ActorSimulation.Observer (ActorSimulation v1.0.1)

Copy Markdown View Source

Collects message statistics for actors that are real servers rather than simulated ones.

A simulated actor counts its own messages in its state. A real server in the loop (see ActorSimulation.add_process/3) has no such state to extend, so ActorSimulation instruments it with this observer and reads the counters back with VirtualTimeGenServer.snapshot/1.

Counters live in the observed process, which is where the messages happen: on_receive/2 runs in the server, on_send/2 in the process that sends.