hsbencher-1.20.0.5: Launch and gather data from Haskell and non-Haskell benchmarks.

Safe HaskellNone
LanguageHaskell2010

HSBencher.Internal.MeasureProcess

Description

This module provides tools to time a sub-process (benchmark), including a facility for self-reporting execution time and reporting garbage collector overhead for GHC-compiled programs.

Synopsis

Documentation

measureProcess Source

Arguments

:: Maybe (Int, CPUAffinity) 
-> LineHarvester

Stack of harvesters

-> CommandDescr 
-> IO SubProcess 

This runs a sub-process and tries to determine how long it took (real time) and how much of that time was spent in the mutator vs. the garbage collector.

It is complicated by:

  1. An additional protocol for the process to report self-measured realtime (a line starting in SELFTIMED, ditto for JITTIME:)
  2. Parsing the output of GHC's "+RTS -s" to retrieve productivity OR using lines of the form "PRODUCTIVITY: XYZ"

Note that "+RTS -s" is specific to Haskell/GHC, but the PRODUCTIVITY tag allows non-haskell processes to report garbage collector overhead.

This procedure is currently not threadsafe, because it changes the current working directory.

measureProcessDBG Source

Arguments

:: Maybe (Int, CPUAffinity) 
-> LineHarvester

Stack of harvesters

-> CommandDescr 
-> IO ([ByteString], RunResult) 

A simpler and SINGLE-THREADED alternative to measureProcess. This is part of the process of trying to debug the HSBencher zombie state (Issue #32).

selftimedHarvester :: LineHarvester Source

Check for a SELFTIMED line of output.

ghcProductivityHarvester :: LineHarvester Source

Retrieve productivity (i.e. percent time NOT garbage collecting) as output from a Haskell program with "+RTS -s". Productivity is a percentage (double between 0.0 and 100.0, inclusive).

taggedLineHarvester :: Read a => ByteString -> (a -> RunResult -> RunResult) -> LineHarvester Source

Check for a line of output of the form "TAG NUM" or "TAG: NUM". Take a function that puts the result into place (the write half of a lens).

setCPUAffinity :: (Int, CPUAffinity) -> IO () Source

Set the affinity of the *current* process.