From HaskellWiki
Jump to: navigation, search

Weaving Source Code into ThreadScope

Peter Wortmann

The task of program optimisation is frustratingly hard, with many possible problem sources to consider. Consequently, good profiling tools are essential for observing program behaviour and helping the programmer to spot the patterns and underlying reasons.

The ThreadScope profiling utility has already proved invaluable in this task. However, so far it has mainly tracked performance characteristics, with little help for relating them back to the program in question. Our aim is to improve this situation by allowing the user to relate the observed behaviour to locations in the application's source code.

We have extended the GHC tool chain accordingly and are now able to give quick and accurate program profiles, complete with source code references. Our talk will give an overview of the new functionality and its implementation. We will talk about:

  • The profiling back-end, which allows sampling code pointers according to different performance characteristics,
  • How we manage to retain code associations throughout the various code generation stages of GHC,
  • And the user interface we have designed to make the generated profiling data accessible to the user.