πŸ“Š GenServerVirtualTime

Example Reports & Diagrams

Interactive visualizations of actor simulations with virtual time

🎯 Overview

These reports demonstrate the visualization capabilities of GenServerVirtualTime, a library for testing time-based GenServers and simulating actor systems with virtual time. All simulations run in milliseconds but simulate seconds or minutes of virtual time.

25+
Example Reports
2
Diagram Types
100x
Speed Improvement

πŸ“ˆ Mermaid Flowchart Reports

NEW! These reports visualize actor system topology using Mermaid flowcharts with embedded statistics. They show message flow, activity levels, and performance metrics.

Flowchart

Pipeline Processing

Multi-stage data processing pipeline with message forwarding and statistics.

View Report β†’
Flowchart

Pub-Sub System

Publisher broadcasting events to multiple subscribers with message rates.

View Report β†’
Flowchart

Load-Balanced Workers

Load balancer distributing work to multiple workers with result collection.

View Report β†’
Flowchart

⚑ Custom Termination Condition

Simulation that stops when goal is achieved, showing exact termination point.

View Report β†’
Flowchart

Layout: Left-Right

Horizontal flowchart layout demonstration.

View Report β†’
Flowchart

Layout: Top-Bottom

Vertical flowchart layout demonstration.

View Report β†’
Flowchart

🎲 Random Hi Messages

7 actors randomly sending :hi messages with fixed seed for reproducible results.

View Report β†’
Flowchart

πŸ”„ Ring Topology

Token passing ring with 7 actors, complete circular message flow.

View Report β†’
Flowchart

πŸ—οΈ Real Actors (GenServer)

7 VirtualTimeGenServer actors with random delays 200-300ms, real module implementation.

View Report β†’
Flowchart

🌐 Random Messaging Network

7 actors in full mesh topology sending random :hi messages with reproducible seed.

View Report β†’
Flowchart

⏸️ Quiescence Batching

Demonstrates quiescence termination - sender emits 10 messages, receiver batches and replies once.

View Report β†’

🎬 Mermaid Sequence Diagrams

These diagrams show message-by-message interaction between actors over time. Perfect for understanding communication patterns and debugging.

Sequence

Simple Request-Response

Basic client-server interaction with request and response messages.

View Diagram β†’
Sequence

Authentication Pipeline

Multi-stage authentication flow: API β†’ Auth β†’ Database β†’ Response.

View Diagram β†’
Sequence

Sync vs Async

Demonstrates synchronous calls and asynchronous casts with different arrow styles.

View Diagram β†’
Sequence

Timeline with Timestamps

Shows virtual time progression with timestamp annotations.

View Diagram β†’

🍴 Dining Philosophers Examples

Classic concurrency problem demonstrating deadlock-free message passing with various table sizes and termination conditions.

Sequence

2 Philosophers

Minimal case - simplest to understand interactions.

View Diagram β†’
Sequence

3 Philosophers

Small table - clear message patterns.

View Diagram β†’
Sequence

5 Philosophers

Classic problem size with full complexity.

View Diagram β†’
Sequence

βœ… Both Fed Successfully

Shows 2 philosophers both eating - watch for "I'm full!" from each!

View Diagram β†’
Flowchart

🍴 All 5 Philosophers Fed Successfully

Classic 5-philosopher problem solved - flowchart showing all philosophers successfully eating at least once.

View Report β†’
Flowchart

πŸš€ 5 Philosophers - 10ms Thinking (Speedup)

Demonstrates dramatic virtual time speedup with 10ms thinking delays - watch the performance metrics!

View Report β†’

✨ Features Demonstrated

🎯 Mermaid Flowcharts

Visual actor topology with different shapes for sources, sinks, and processors

πŸ“Š Embedded Statistics

Message counts and rates displayed directly on diagram nodes

🎨 Activity-Based Styling

Color-coded nodes based on message activity levels

πŸ“ Multiple Layouts

Support for TB, LR, RL, and BT flowchart directions

⚑ Custom Termination Condition

Visual indicators when simulations stop upon achieving goals

⏱️ Virtual Time

Simulate hours of behavior in milliseconds with precise control

πŸ“ˆ Performance Metrics

Virtual time speedup calculations and real-time comparisons

πŸ” Message Tracing

Sequence diagrams showing every message exchange

πŸš€ Getting Started

Install GenServerVirtualTime from Hex:

def deps do
  [
    {:gen_server_virtual_time, "~> 0.4.0"}
  ]
end

Generate your own flowchart report:

simulation = ActorSimulation.new()
|> ActorSimulation.add_actor(:producer,
    send_pattern: {:rate, 100, :data},
    targets: [:consumer])
|> ActorSimulation.add_actor(:consumer)
|> ActorSimulation.run(duration: 5000)

html = ActorSimulation.generate_flowchart_report(simulation,
  title: "My System",
  layout: "TB")

File.write!("report.html", html)