Diagnosing parallelism – ThreadScope
Next we will look at a program visualization tool, ThreadScope. Install the threadscope
executable with:
stack install threadscope
To extract the eventlog
that ThreadScope uses from a Haskell program, we need to compile with -eventlog
and execute with the -l
Runtime System option. Running the program then generates a program.eventlog
file, which ThreadScope reads. In a convenient single recipe, we lay out these commands:
ghc -O2 -threaded -eventlog -with-rtsopts="-N -l" program.hs ./program threadscope program.eventlog
ThreadScope provides a graphical user interface. The opening view shows processor core utilization. An example view from some eventlog is:
Along with total utilization, we can see the work split ...
Get Haskell High Performance Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.