bench-show-0.3.2: Show, plot and compare benchmark results
Copyright(c) 2018 Composewell Technologies
LicenseBSD3
Maintainerharendra.kumar@gmail.com
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

BenchShow.Internal.Common

Description

 
Synopsis

Documentation

data Presentation Source #

How to present the reports or graphs. Each report presents a number of benchmarks as rows, it may have, (1) a single column presenting the values for a single field, (2) multiple columns presenting values for different fields, or (3) multiple columns presenting values of the same field for different groups.

Since: 0.2.0

Constructors

Solo

Reports are generated for each group and for each field selected by the configuration. Each report presents benchmarks in a single group with a single column presenting a single field. If there are m fields and n groups selected by the configuration then a total of m x n reports are generated. Output files are named using -estimator-groupname-fieldname as suffix.

Groups GroupStyle

One report is generated for each field selected by the configuration. Each report presents a field with all the groups selected by the configuration as columns or clusters. Output files are named using -estimator-fieldname as suffix.

Fields

One report is generated for each group selected by the configuration. Each report presents a group with all the fields selected by the configuration as columns or clusters. Output files are named using -estimator-groupname as suffix.

data GroupStyle Source #

How to show the results for multiple benchmark groups presented in columns or bar chart clusters. In relative comparisons, the first group is considered as the baseline and the subsequent groups are compared against the baseline.

Definition changed in 0.3.0 @since 0.2.0

Constructors

Absolute

Show absolute values of the field for all groups

Diff

Show baseline group as absolute values and values for the subsequent groups as difference from the baseline

PercentDiff

If the value of the group being compared is higher than the baseline then display the difference as percentage of baseline otherwise display the difference as a percentage of the group being compared.

Multiples

If the value of the group being compared is higher than the baseline then display +(value / baseline value) otherwise display -(baseline value / value). This provides a normalized comparison independent of the absolute value of a benchmark. Note that Multiples can be directly computed using PercentDiff and vice-versa.

data FieldTick Source #

FieldTick is used only in visual charts to generate the major ticks on the y-axis. You can specify either the size of a tick (TickSize) or the total number of ticks (TickCount).

Since: 0.2.0

Constructors

TickSize Int

Size of a tick, the unit is microseconds for time fields, and bytes for space fields.

TickCount Int

Total number of ticks in the range spread.

data SortColumn Source #

When sorting and filtering the benchmarks using selectBenchmarks we can choose a column as a sort criterion. selectBenchmarks is provided with the data for the corresponding column which can be used for sorting the benchmarks. The column could be a group or a field depending on the Presentation.

Since: 0.2.0

Constructors

ColumnIndex Int

Specify the index of the sort column. Index 0 corresponds to the first value column. In a textual report, the very first column consists of benchmark names, therefore index 0 addresses the second column of the report.

ColumnName (Either String (String, Int))

Specify the column using the name of the group or the field it represents, and the runId. When just the name is enough to uniquely identify the sort column the Left constructor can be used, otherwise the Right constructor is used which can use the runId to disambiguate. In a Fields presentation, just the field name is enough. In a Groups presentation, when there is a single benchmark run in the input file, just the group name is enough to identify the group, the runId defaults to 0. However, when there are multiple runs, a group needs to specify a runId as well.

data RelativeUnit Source #

Describe a relative unit i.e. a unit in terms of another unit. A relative unit has a label and a ratio which when multiplied with the unit gives us the other unit. For example, if the known time unit is seconds, we can describe a millisecond as Unit "ms" (1/1000).

Constructors

RelativeUnit String Double 

Instances

Instances details
Show RelativeUnit Source # 
Instance details

Defined in BenchShow.Internal.Common

data Estimator Source #

The statistical estimator used to arrive at a single value for a benchmark when samples from multiple experiments are available.

Since: 0.2.0

Constructors

Median

Report the median, outliers and outlier variance using box-plot method. This is the most robust indicator with respect to outliers when successive runs of benchmarks are compared.

Mean

Report the mean and the standard deviation from the mean. This is less robust than median but more precise.

Regression

Report the coefficient of regression, discarding the constant factor, arrived at by linear regression using ordinary least square method. The R-square goodness-of-fit estimate is also reported. It works better when larger number of samples are taken. This cannot be used when the number of samples is less than 2, in that case a mean value is reported instead.

data DiffStrategy Source #

Strategy to compute the difference between two groups of benchmarks being compared.

Since: 0.2.0

Constructors

SingleEstimator

Use a single estimator to compute the difference between the baseline and the candidate. The estimator that is provided in the Config is used.

MinEstimator

Use Mean, Median and Regression estimators for both baseline and candidate, and report the estimator that shows the minimum difference. This is more robust against random variations.

data TitleAnnotation Source #

Deprecated: Please use mkTitle to make a custom title

Additional annotations that can be optionally added to the title of the report or graph.

Since: 0.2.2

data Config Source #

Configuration governing generation of chart. See defaultConfig for the default values of these fields.

Since: 0.2.0

Constructors

Config 

Fields

  • verbose :: Bool

    Provide more details in the report, especially the standard deviation, outlier variance, R-square estimate and an annotation to indicate the actual method used when using MinEstimator are reported.

  • outputDir :: Maybe FilePath

    The directory where the output graph or report file should be placed.

  • mkTitle :: Maybe (String -> String)

    Function to make a title for the report. The argument to the function is the benchmark field name for which the report is being made.

  • title :: Maybe String

    DEPRECATED: Please use mkTitle instead.

    Report title, more information like the plotted field name or the presentation style may be added to it.

  • titleAnnotations :: [TitleAnnotation]

    DEPRECATED: Please use mkTitle instead.

    Additional annotations to be added to the title

  • presentation :: Presentation

    How to determine the layout of the report or the chart.

  • estimator :: Estimator

    The estimator used for the report.

  • threshold :: Word

    The minimum percentage difference between two runs of a benchmark beyond which the benchmark is flagged to have regressed or improved.

  • diffStrategy :: DiffStrategy

    Strategy to compare two runs or groups of benchmarks.

  • omitBaseline :: Bool

    Omit the baseline group in normalized relative comparisons i.e. when the GroupStyle is PercentDiff or Multiples.

  • selectFields :: [String] -> [String]

    Filter and reorder the benchmarking fields. It is invoked with a list of all available benchmarking fields. Only those fields present in the output of this function are plotted and in that order.

  • fieldRanges :: [(String, Double, Double)]

    The values in the tuple are (fieldName, RangeMin, RangeMax). Specify the min and max range of benchmarking fields. If the field value is outside the range it is clipped to the range limit. For time fields, the range values are in microseconds, and for space fields they are in bytes. The minimum of the range is used to determine the unit for the field.

  • fieldTicks :: [(String, FieldTick)]

    The values in the tuple are (fieldName, tick). Specify the tick size of the fields to be used for the graphical reports.

  • classifyBenchmark :: String -> Maybe (String, String)

    Filter, group and translate benchmark names. This function is invoked once for all benchmark names found in the results. It produces a tuple (groupname, benchname), where groupname is the name of the group the benchmark should be placed in, and benchname is the translated benchmark name to be used in the report. If it returns Nothing for a benchmark, that benchmark is omitted from the results.

  • selectGroups :: [(String, Int)] -> [(String, Int)]

    Filter and reorder the benchmark group names. A benchmark group may be assigned using classifyBenchmark; when not assigned, all benchmarks are placed in the default group. The input to this function is a list of tuples with benchmark group names and the runIds. The output produced by this function is a filtered and reordered subset of the input. Only those benchmark groups present in the output are rendered and are presented in that order.

  • selectBenchmarks :: (SortColumn -> Maybe GroupStyle -> Either String [(String, Double)]) -> [String]

    Filter and reorder benchmarks. selectBenchmarks takes a function argument, the function is invoked with a sorting column name or index and a GroupStyle. The output of the function is either a Right value consisting of tuples of the benchmark names and values corresponding to the given column and style or a Left value indicating an error. selectBenchmarks can inspect these benchmarks and their values to produce a filtered and sorted list of benchmark names that are to be rendered.

    The style argument is ignored when the report presentation is not Groups. When style is Nothing, the presentation setting specified in the configuration is used.

    Signature changed in 0.3.0

defaultConfig :: Config Source #

Default configuration. Use this as the base configuration and modify the required fields. The defaults are:

 verbose           = False
 mkTitle           = Nothing
 titleAnnotations  = [TitleField]
 outputDir         = Nothing
 presentation      = Groups Absolute
 estimator         = Median
 threshold         = 3
 diffStrategy      = SingleEstimator
 omitBaseline      = False
 selectFields      = filter (flip elem ["time", "mean", "maxrss"] . map toLower)
 fieldRanges       = []
 fieldTicks        = []
 classifyBenchmark = Just . ("default",)
 selectGroups      = id
 selectBenchmarks  = f -> either error (map fst) $ f (ColumnIndex 0) Nothing

Since: 0.2.0

data GroupMatrix Source #

Instances

Instances details
Show GroupMatrix Source # 
Instance details

Defined in BenchShow.Internal.Common

data ReportColumn Source #

Instances

Instances details
Show ReportColumn Source # 
Instance details

Defined in BenchShow.Internal.Common