Safe Haskell | Safe |
---|

Utility functions for statistical accumulation.

## Synopsis

- type TagTagMap = Map (String, String) Int
- data Statistics
- data AggregateComponent
- = SimpleNumber Double
- | SpreadValues TagTagMap

- getSumStatistics :: [AggregateComponent] -> Statistics
- getStdDevStatistics :: [AggregateComponent] -> Statistics
- getMapStatistics :: [AggregateComponent] -> Statistics
- getStatisticValue :: Statistics -> Double
- updateStatistics :: Statistics -> (AggregateComponent, AggregateComponent) -> Statistics

# Documentation

type TagTagMap = Map (String, String) Int Source #

Type to store the number of instances for each exclusion and location pair. This is necessary to calculate second component of location score.

data Statistics Source #

Abstract type of statistical accumulations. They behave as if the given statistics were computed on the list of values, but they allow a potentially more efficient update of a given value.

## Instances

Show Statistics # | |

Defined in Ganeti.Utils.Statistics showsPrec :: Int -> Statistics -> ShowS show :: Statistics -> String showList :: [Statistics] -> ShowS |

data AggregateComponent Source #

Abstract type of per-node statistics measures. The SimpleNumber is used to construct SumStatistics and StdDevStatistics while SpreadValues is used to construct MapStatistics.

SimpleNumber Double | |

SpreadValues TagTagMap |

getSumStatistics :: [AggregateComponent] -> Statistics Source #

Get a statistics that sums up the values.

getStdDevStatistics :: [AggregateComponent] -> Statistics Source #

Get a statistics for the standard deviation.

getMapStatistics :: [AggregateComponent] -> Statistics Source #

Get a statistics for the standard deviation.

getStatisticValue :: Statistics -> Double Source #

Obtain the value of a statistics.

updateStatistics :: Statistics -> (AggregateComponent, AggregateComponent) -> Statistics Source #

In a given statistics replace on value by another. This will only give meaningful results, if the original value was actually part of the statistics.