hpc-strobe-0.1: Hpc-generated strobes for a running Haskell program

PortabilityRequires GHC with Hpc support.
Stabilityunstable
MaintainerThorkil Naur

Trace.Hpc.Strobe

Contents

Description

A rudimentary library that demonstrates the possibility of using Hpc (Haskell Program Coverage) to inspect the state of a running Haskell program. Use of the library involves a simple change of the main function and also requires the program to be enabled for hpc. At the time of writing, this means using a fairly recent version of GHC and compiling the Haskell code with the -fhpc option.

Synopsis

Write strobes (tix files) regularly while program is running

withStrobesWrittenRegularlySource

Arguments

:: FilePath

Name of directory where .tix files are deposited. If this directory does not exist, no tix files are written.

-> String

Prefix of file name for .tix files.

-> Int

Microseconds between writing a .tix file.

-> IO ()

The main function to be strobe'd.

-> IO ()

The modified main function.

Replace

 main = <your main function>

by

 myMain = <your main function>
 main = withStrobesWrittenRegularly
          "<tixfile directory>"
          "myMain"
          1000000
          myMain

and strobes (separate Hpc tix files) will be written regularly, with 1 second (1000000 microseconds) between each writing of a strobe. The tix files will be deposited in the indicated tixfile directory and be named "myMain_<index>.tix" where the index is taken from [0..].