September 2016
Intermediate to advanced
408 pages
9h 18m
English
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 ...
Read now
Unlock full access