# Module bench_server

- Description
- Data Types
- Function Index
- Function Details

This is a small server for running benchmarks.

Copyright © 2007-2015 Zuse Institute Berlin

Version: $Id$

Behaviours: `gen_component`.

Authors: Thorsten Schuett (`schuett@zib.de`).

## Description

This is a small server for running benchmarks

## Data Types

### erlang_timestamp()

    erlang_timestamp() =
        {MegaSecs :: non_neg_integer(),
         Secs :: 0..999999,
         MicroSecs :: 0..999999}

## Function Index

init/1 |
on/2 |
run_threads/2 | spawns threads and collect statistics.
start_gen_component/5 |
start_link/1 | spawns a bench_server.

## Function Details

### start_gen_component/5

    start_gen_component(Module :: module(),
                        Handler :: gen_component:handler(),
                        Args :: term(),
                        Options :: [gen_component:option()],
                        Self :: pid()) ->
                           no_return() | ok

### on/2

    on(X1 :: comm:message(),
       State ::
           #state{load_pid = undefined | pid() | ok,
                  bench_owner = comm:mypid() | ok,
                  bench_start = erlang_timestamp() | ok,
                  bench_threads = non_neg_integer(),
                  bench_data =
                      {N :: non_neg_integer(),
                       Mean :: float(),
                       M2 :: float(),
                       Min :: non_neg_integer(),
                       Max :: non_neg_integer(),
                       AggAborts :: non_neg_integer()} |
                      null}) ->
          #state{load_pid = undefined | pid() | ok,
                 bench_owner = comm:mypid() | ok,
                 bench_start = erlang_timestamp() | ok,
                 bench_threads = non_neg_integer(),
                 bench_data =
                     {N :: non_neg_integer(),
                      Mean :: float(),
                      M2 :: float(),
                      Min :: non_neg_integer(),
                      Max :: non_neg_integer(),
                      AggAborts :: non_neg_integer()} |
                     null}

### init/1

    init(X1 :: []) ->
            #state{load_pid = undefined | pid() | ok,
                   bench_owner = comm:mypid() | ok,
                   bench_start = erlang_timestamp() | ok,
                   bench_threads = non_neg_integer(),
                   bench_data =
                       {N :: non_neg_integer(),
                        Mean :: float(),
                        M2 :: float(),
                        Min :: non_neg_integer(),
                        Max :: non_neg_integer(),
                        AggAborts :: non_neg_integer()} |
                       null}

### start_link/1

    start_link(ServiceGroup :: pid_groups:groupname()) -> {ok, pid()}

spawns a bench_server

### run_threads/2

    run_threads(Threads :: integer(),
                Bench ::
                    fun((Parent :: comm:erl_local_pid()) -> any())) ->
                   ok

spawns threads and collect statistics

Generated by EDoc, Feb 29 2016, 16:12:18.