hp2pretty: generate pretty graphs from heap profiles

[ bsd3, development, program ] [ Propose Tags ] [ Report a vulnerability ]

hp2pretty is a rewrite of hp2ps, implemented in Haskell, with the aims of being maintainable, with more flexible output, and more beautiful output. Currently hp2pretty outputs Scalable Vector Graphics (SVG) only, though PostScript (PS) is planned. Not all of hp2ps' options are implemented yet in hp2pretty.

In hp2pretty-0.10 parsing of very large files is made possible by reading the file(s) twice as Text.Lazy.

In hp2pretty-0.9 a mode for detached key is added:

hp2pretty --key=inline *.hp
hp2pretty --key=key.txt *.hp
hp2pretty --key=- *.hp

The output file is an simple text file, that mentions additional SVG files for the legend - how you format it is up to you.

A mode for detached titles is also added:

hp2pretty --title=inline *.hp
hp2pretty --title=title.txt *.hp
hp2pretty --title=- *.hp

The output file is an simple text file, that mentions the image SVG files. You could use this for figure captions, etc.

See the examples/ directory in the source distribution for hints.

In hp2pretty-0.8 output filtering and sorting flags are added, as well as low-ink pattern fills for printing:

hp2pretty --trace=1     *.hp
hp2pretty --bands=15    *.hp
hp2pretty --sort=size   *.hp
hp2pretty --sort=stddev *.hp
hp2pretty --sort=name   *.hp
hp2pretty --reverse     *.hp
hp2pretty --pattern     *.hp

In hp2pretty-0.7 a parsing bug is fixed.

In hp2pretty-0.6 ByteString is replaced by Text, fixing bugs with Unicode.

In hp2pretty-0.5 using attoparsec and floatshow internally should give a healthy speedup.

In hp2pretty-0.4 usage changed since the previous release:

hp2pretty *.hp
hp2pretty --uniform-scale=time   *.hp
hp2pretty --uniform-scale=memory *.hp
hp2pretty --uniform-scale=both   *.hp

Colours also changed: now they are based on a hash of the cost label, which should make colours have stable semantics across program runs.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.8.0.1, 0.8.0.2, 0.9, 0.10, 0.10.1
Change log NEWS
Dependencies array, attoparsec, base (>=4 && <5), containers (>=0.5), filepath, floatshow, mtl, optparse-applicative, semigroups, text [details]
License BSD-3-Clause
Copyright (C) 2010,2011,2015,2017,2018,2021 Claude Heiland-Allen
Author Claude Heiland-Allen
Maintainer claude@mathr.co.uk
Category Development
Home page https://mathr.co.uk/blog/hp2pretty.html
Source repo head: git clone https://code.mathr.co.uk/hp2pretty.git
this: git clone https://code.mathr.co.uk/hp2pretty.git(tag v0.10.1)
Uploaded by ClaudeHeilandAllen at 2024-10-25T10:15:28Z
Distributions LTSHaskell:0.10.1, NixOS:0.10, Stackage:0.10.1
Reverse Dependencies 1 direct, 0 indirect [details]
Executables hp2pretty
Downloads 10957 total (56 in the last 30 days)
Rating 2.25 (votes: 2) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2024-10-25 [all 1 reports]

Readme for hp2pretty-0.10.1

[back to package description]
hp2pretty
=========

hp2ps is a tool to generate PostScript graphs of Heap Profiles.
hp2pretty is a rewrite of hp2ps, implemented in Haskell, with
the aims of being maintainable, with more flexible output, and
more beautiful output.  Currently hp2pretty outputs Scalable
Vector Graphics (SVG) only, though PostScript (PS) is planned.
Not all of hp2ps' options are implemented yet in hp2pretty.


Usage
=====

    hp2pretty - generate pretty graphs from heap profiles
    
    Usage: hp2pretty [--uniform-scale AXES] [--sort FIELD] [--key KEY]
                     [--title TITLE] [--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.
      --key KEY                Whether to embed the key in the image output. One of:
                               inline (default), FILE.txt. Use - for standard output
                               and ./inline for a file named literally "inline".
      --title TITLE            Whether to embed the title in the image output. One
                               of: inline (default), FILE.txt. Use - for standard
                               output and ./inline for a file named literally
                               "inline".
      --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


Benchmarks
==========

hp2pretty-0.1
-------------

$ wc in.hp
 1484749  2969502 37406420 in.hp

$ time hp2pretty <in.hp >out.svg
real 0m38.786s 0m39.423s 0m38.674s
user 0m38.120s 0m38.800s 0m38.110s
sys  0m00.360s 0m00.250s 0m00.400s

$ time hp2ps <in.hp >out.ps
real 0m38.474s 0m38.765s 0m38.017s
user 0m38.350s 0m38.200s 0m37.860s
sys  0m00.090s 0m00.140s 0m00.150s

(hp2pretty compiled with "ghc -O2 --make")

Essentially identical runtime!

Memory usage from 'top':
hp2pretty ~275M
hp2ps      ~50M

Tests were run on 64bit GNU/Linux with ghc-6.12.3.


hp2pretty-0.2
-------------

"in.hp"     time (seconds)       memory (bytes)
(bytes)   hp2pretty    hp2ps   hp2pretty   hp2ps
    37M      33.345   36.430         64M     25M
   1.3M       1.015    0.074        2.2M    1.0M
    47k       0.058    0.005        210k     60k

Time is real time averaged over 3 runs as measured by 'bash'.
Memory is peak usage as measured by 'valgrind --tool=massif'.

hp2pretty compiled via cabal-install with 'ghc -O --make'.

Tests were run on 64bit GNU/Linux with ghc-6.12.3.