aivika-4.3.1: A multi-paradigm simulation library

Copyright Copyright (c) 2009-2015, David Sorokin BSD3 David Sorokin experimental Safe Haskell2010

Simulation.Aivika.Statistics

Description

Tested with: GHC 7.10.1

Represents statistics.

Synopsis

# Simple Statistics

data SamplingStats a Source

Describes when the statistics consists of only samples not bound to the simulation time.

Constructors

 SamplingStats FieldssamplingStatsCount :: !IntThe total number of samples.samplingStatsMin :: !aThe minimum value among the samples.samplingStatsMax :: !aThe maximum value among the samples.samplingStatsMean :: !DoubleThe average value.samplingStatsMean2 :: !DoubleThe average square value.

Instances

 Eq a => Eq (SamplingStats a) Source Ord a => Ord (SamplingStats a) Source Show a => Show (SamplingStats a) Source Source Source Source Source Source

class Num a => SamplingData a where Source

Specifies data type from which values we can gather the statistics.

Methods

An empty statistics that has no samples.

addSamplingStats :: a -> SamplingStats a -> SamplingStats a Source

Add a new sample to the statistics.

Combine two statistics.

Instances

 Source Source

If allows combining statistics more efficiently if we know that the first argument can be a scalar.

Return the variance.

Return the deviation.

Show the summary of the statistics using the specified indent.

Return the statistics by a single sample.

listSamplingStats :: SamplingData a => [a] -> SamplingStats a Source

Create the statistics by the specified list of data.

Convert the statistics from integer to double values.

# Timing Statistics

data TimingStats a Source

This is the timing statistics where data are bound to the time.

Constructors

 TimingStats FieldstimingStatsCount :: !IntReturn the number of samples.timingStatsMin :: !aReturn the minimum value.timingStatsMax :: !aReturn the maximum value.timingStatsLast :: !aReturn the last value.timingStatsMinTime :: !DoubleReturn the time at which the minimum is attained.timingStatsMaxTime :: !DoubleReturn the time at which the maximum is attained.timingStatsStartTime :: !DoubleReturn the start time of sampling.timingStatsLastTime :: !DoubleReturn the last time of sampling.timingStatsSum :: !DoubleReturn the sum of values.timingStatsSum2 :: !DoubleReturn the sum of square values.

Instances

 Eq a => Eq (TimingStats a) Source Ord a => Ord (TimingStats a) Source (Show a, TimingData a) => Show (TimingStats a) Source Source Source Source Source

class Num a => TimingData a where Source

Defines the data type from which values we can gather the timing statistics.

Methods

An empty statistics that has no samples.

addTimingStats :: Double -> a -> TimingStats a -> TimingStats a Source

Add a sample with the specified time to the statistics.

Return the average value.

Return the average square value.

Return the variance.

Instances

 Source Source

Return the deviation.

timingStatsSummary :: (Show a, TimingData a) => TimingStats a -> Int -> ShowS Source

Show the summary of the statistics using the specified indent.

returnTimingStats :: TimingData a => Double -> a -> TimingStats a Source

Return the statistics by single timing data.

Convert the statistics from integer to double values.

Convert the statistics to its normalised sampling-based representation, where the first argument specifies the number of pseudo-samples.

# Simple Counter

A counter for which the statistics is collected too.

Constructors

 SamplingCounter FieldssamplingCounterValue :: aThe counter value.samplingCounterStats :: SamplingStats aThe counter statistics.

Instances

 Eq a => Eq (SamplingCounter a) Source Ord a => Ord (SamplingCounter a) Source Show a => Show (SamplingCounter a) Source Source Source

An empty counter.

Increase the counter.

Decrease the counter.

Set a new value for the counter.

Create a counter with the specified initial value.

# Timing Counter

data TimingCounter a Source

A counter for which the timing statistics is collected too.

Constructors

 TimingCounter FieldstimingCounterValue :: aThe counter value.timingCounterStats :: TimingStats aThe counter statistics.

Instances

 Eq a => Eq (TimingCounter a) Source Ord a => Ord (TimingCounter a) Source (Show a, TimingData a) => Show (TimingCounter a) Source Source Source

An empty counter.

incTimingCounter :: TimingData a => Double -> a -> TimingCounter a -> TimingCounter a Source

Increase the counter at the specified time.

decTimingCounter :: TimingData a => Double -> a -> TimingCounter a -> TimingCounter a Source

Decrease the counter at the specified time.

setTimingCounter :: TimingData a => Double -> a -> TimingCounter a -> TimingCounter a Source

Set a new value for the counter at the specified time.

returnTimingCounter :: TimingData a => Double -> a -> TimingCounter a Source

Create a timing counter with the specified initial value at the given time.