mathr / blog / #

hp2pretty-0.8 released

hp2pretty is a program to graph heap profiles output by Haskell programs compiled by GHC. It makes images like this by default:

(default)

Today I hacked on it some more and added some new features, like --reverse to switch the order of the bands:

--reverse

and --sort=stddev to sort by band standard deviation:

--sort=stddev

and --sort=name to sort by cost center name:

--sort=name

and --trace=50 to combine the last percentage of trace elements into one band:

--trace=50

and --bands=5 to show only a certain number of bands:

--bands=5

and the icing on the cake, --pattern to use pattern fills for low ink printing:

--pattern

Here's the --help output, using the optparse-applicative package for command line arguments:

hp2pretty - generate pretty graphs from heap profiles

Usage: hp2pretty [--uniform-scale AXES] [--sort FIELD] [--reverse]
                 [--trace PERCENT] [--bands COUNT] [--pattern] FILES...
  Convert heap profile FILES.hp to pretty graphs FILES.svg

Available options:
  --uniform-scale AXES     Whether to use a uniform scale for all outputs. One
                           of: none (default), time, memory, both.
  --sort FIELD             How to sort the bands. One of: size (default),
                           stddev, name.
  --reverse                Reverse the order of bands.
  --trace PERCENT          Percentage of trace elements to
                           combine. (default: 1.0)
  --bands COUNT            Maximum number of bands to draw (0 for
                           unlimited). (default: 15)
  --pattern                Use patterns instead of solid colours to fill bands.
  FILES...                 Heap profiles (FILE.hp will be converted to
                           FILE.svg).
  -h,--help                Show this help text

Version 0.7 was also released this week, featuring a contributed bugfix in parsing. You can get the latest from git here:

git clone https://code.mathr.co.uk/hp2pretty.git

or install from Hackage.