Module ep_job

Job runner, taking care of init/done, workers added and removed.

Copyright © (C) 2019, Maxim Fedorov

Behaviours: gen_server.

Authors: Maxim Fedorov (maximfca@gmail.com).

Description

Job runner, taking care of init/done, workers added and removed.

Data Types

callable()

callable() = mfargs() | [mfargs()] | function() | fun((term()) -> term()) | string()

code()

code() = callable() | code_map()

code_map()

code_map() = #{runner := callable(), init => callable(), init_runner => callable(), done => callable(), initial_concurrency => non_neg_integer(), name => string()}

mfargs()

mfargs() = {module(), atom(), [term()]}

state()

state() = #state{code = code(), init = callable(), done = callable(), init_runner = callable(), runner = callable(), module = module() | [], init_result = term(), init_runner_result = term(), workers = [pid()], cref = atomics:atomics_ref()}

Function Index

get_counters/1 Internally used by the monitoring process to access job atomic counter.
handle_call/3
handle_cast/2
handle_info/2
info/1 Returns information about currently running job.
init/1
profile/1 Runs a single iteration, using fprof profiler.
profile/3 Runs a profiler for a selected number of runner iterations.
set_concurrency/2 Change concurrency setting for this job.
start/1 Starts the benchmark instance using default (ep_job_sup) supervisor.
start_link/1 Starts the benchmark instance and links it to caller.
stop/1 Stops the benchmark instance (via supervisor).
terminate/2

Function Details

get_counters/1

get_counters(JobId::pid()) -> atomics:atomics_ref()

Internally used by the monitoring process to access job atomic counter.

handle_call/3

handle_call(Request::term(), From::{pid(), reference()}, State::state()) -> {reply, term(), state()}

handle_cast/2

handle_cast(Request::term(), State::state()) -> no_return()

handle_info/2

handle_info(Info::term(), State::state()) -> {noreply, state()}

info/1

info(JobId::pid()) -> {ok, code(), Concurrency::non_neg_integer()}

Returns information about currently running job. Includes job description, and number of currently running workers.

init/1

init(Code::code()) -> {ok, state()}

profile/1

profile(JobId::pid()) -> term()

Runs a single iteration, using fprof profiler

profile/3

profile(JobId::pid(), Profiler::fprof, Format::term | binary | string) -> term()

Runs a profiler for a selected number of runner iterations.

set_concurrency/2

set_concurrency(JobId::pid(), Concurrency::non_neg_integer()) -> ok

Change concurrency setting for this job. Does not reset counting.

start/1

start(Code::code()) -> {ok, Pid::pid()} | {error, {already_started, pid()}} | {error, Reason::term()}

Starts the benchmark instance using default (ep_job_sup) supervisor.

start_link/1

start_link(Code::code()) -> {ok, Pid::pid()} | {error, {already_started, pid()}} | {error, Reason::term()}

Starts the benchmark instance and links it to caller. Job starts with no workers, use set_concurrency/2 to start some.

stop/1

stop(JobId::pid()) -> ok

Stops the benchmark instance (via supervisor).

terminate/2

terminate(Reason::term(), State::state()) -> ok


Generated by EDoc