# percept_analyzer

## Utility functions to operate on percept data.

Utility functions to operate on percept data. These functions should be considered experimental. Behaviour may change in future releases.

#### Functions

### activities2count(Acts::#activity{}, StartTs::timestamp()) -> Result

`Result = [{Time, ProcessCount, PortCount}]`

`Time = float()`

`ProcessCount = integer()`

`PortCount = integer()`

Calculate the resulting active processes and ports during the activity interval. Also checks active/inactive consistency. A task will always begin with an active state and end with an inactive state.

### activities2count(Acts, StartTs, Type) -> term()

### activities2count2(Acts, StartTs) -> term()

### mean(List::[number()]) -> {Mean, StdDev, N}

`Mean = float()`

`StdDev = float()`

`N = integer()`

Calculates the mean and the standard deviation of a set of numbers.

### minmax(Data::[{X, Y}]) -> {MinX, MinY, MaxX, MaxY}

`X = number()`

`Y = number()`

`MinX = number()`

`MinY = number()`

`MaxX = number()`

`MaxY = number()`

Returns the min and max of a set of 2-dimensional numbers.

### minmax_activities(Activities::[#activity{}], Count::integer()) -> {integer(), integer()}

Calculates the minimum and maximum of runnable activites (processes and ports) during the interval of reffered by the activity list.

### runnable_count(Activities, StartCount) -> term()

### seconds2ts(Seconds::float(), StartTs::{integer(), integer(), integer()}) -> timestamp()

Calculates a timestamp given a duration in seconds and a starting timestamp.

### waiting_activities(Activities::[#activity{}]) -> FunctionList

`FunctionList = [{Seconds, Mfa, {Mean, StdDev, N}}]`

`Seconds = float()`

`Mfa = mfa()`

`Mean = float()`

`StdDev = float()`

`N = integer()`

Calculates the time, both average and total, that a process has spent in a receive state at specific function. However, if there are multiple receives in a function it cannot differentiate between them.