On this page:
Futures Visualizer

Futures Visualizer🔗

Parallelism with Futures in The Racket Guide introduces

 (require future-visualizer) package: future-visualizer

The futures visualizer is a graphical profiling tool for parallel programs written using future. The tool shows a timeline of a program’s execution including all future-related events, as well as the overall amount of processor utilization at any point during the program’s lifetime.


(visualize-futures e ...)


(visualize-futures-thunk thunk)  any

  thunk : (-> any)
The visualize-futures macro enables the collection of data required by the visualizer and displays a profiler window showing the corresponding trace. The visualize-futures-thunk provides similar functionality where program code is contained within thunk.

A typical program using profiling might look like the following:

(require racket/future
 (let ([f (future (lambda () ...))])
   (touch f)))

The preceding program is equivalent to:

(require racket/future
(let ([f (future (lambda () ...))])
  (touch f))


(show-visualizer #:timeline timeline)  void?

  timeline : (listof indexed-future-event?)
Displays the visualizer window. If the function is called with no arguments, it must be preceded by the following sequence: a call to start-future-tracing!, program code that is being traced, and a call to stop-future-tracing! – in which case the visualizer will show data for all events logged in between those calls (via timeline-events). Note that visualize-futures and visualize-futures-thunk are simpler alternatives to using these primitives directly. The timeline argument can be used to show the visualizer for a previously-generated trace.