Current section

Files

Jump to
dqe src dqe_hist_stddev.erl
Raw

src/dqe_hist_stddev.erl

-module(dqe_hist_stddev).
-behaviour(dqe_fun).
-include_lib("mmath/include/mmath.hrl").
-export([spec/0, describe/1, init/1, chunk/1, resolution/2, run/2, help/0]).
-record(state, {}).
init([]) ->
#state{}.
chunk(#state{}) ->
1.
resolution(_Resolution, State) ->
{1, State}.
describe(_y) ->
["stddev()"].
spec() ->
{<<"stddev">>, [histogram], none, metric}.
run([Data], S) ->
R = mmath_bin:from_list([hdr_histogram:stddev(H) || H <- Data]),
{R, S}.
help() ->
<<"Calculates the standard derivation for a histogram.">>.