Module pulse

A User Level Scheduler of Erlang resulting from the ProTest project.

Version: 1.42.1

Description

A User Level Scheduler of Erlang resulting from the ProTest project. Copyright Developer Team, see licence conditions

Function Index

format/1Equivalent to format(Fmt, []).
format/2Syncronized io:format.
get_events/0Obtain the events that pulse has used for scheduling processes.
get_schedule/0Obtain the schedule that pulse has used for scheduling processes.
get_seed/0Obtain the seed that the scheduler uses for scheduling processes.
import_process/1When executed by a process not managed by PULSE, this function makes PULSE adopt the process as one of its own.
is_instrumented/1 Checks whether the code is compiled using the pulse instrument parse transformation.
rerun/0Run the same function as before scheduled by pulse.
rerun_counterexample/2Re-run the last counterexample found by QuickCheck (counterexample returned by eqc:counterexample/0) with the verbosity specified in the first argument (see verbose/1).
rerun_counterexample/3Re-run the counterexample for the property with verbosity as specified in first argument.
rerun_verbose/1Run the same function as before scheduled by pulse with verbosity set as in the function verbose.
run/1Equivalent to run(Fun, []).
run/2Run a function scheduled by pulse.
seed/0Seed generator to be used in combination with for example the seed option in run/2.
start/0Start pulse as an application, it consists of a supervisor tree with an event manager and the pulse process.
stop/0Stop pulse application.
verbose/1Set verbose mode of all attached event handlers to items given as arguments.

Function Details

format/1

format(Fmt) -> any()

Equivalent to format(Fmt, []).

format/2

format(Fmt, Args) -> any()

Syncronized io:format. The normal io:format/2 function is a side-effect function and using it for printing debug statements does not work particularly well. When using print commands for debugging in a PULSE context, one should use this format function instead. Note that the printed commands only become visible when the format option is passed to the verbose/1 function.

get_events/0

get_events() -> events()

Obtain the events that pulse has used for scheduling processes

get_schedule/0

get_schedule() -> schedule()

Obtain the schedule that pulse has used for scheduling processes

get_seed/0

get_seed() -> {nat(), nat(), nat()}

Obtain the seed that the scheduler uses for scheduling processes

import_process/1

import_process(NameHint) -> any()

When executed by a process not managed by PULSE, this function makes PULSE adopt the process as one of its own. The typical use case is when you have control over (and can instrument) the code executed by a process, but not the code that is spawning the process.

is_instrumented/1

is_instrumented(Module::atom()) -> bool()

Checks whether the code is compiled using the pulse instrument parse transformation.

rerun/0

rerun() -> term()

Run the same function as before scheduled by pulse. The result of the scheduled run is one of the possible outcomes of running the function without the scheduler. In this way one need not copy the function to the scheduling process each time.

rerun_counterexample/2

rerun_counterexample(FlagList::[atom()], Property::property()) -> any()

Re-run the last counterexample found by QuickCheck (counterexample returned by eqc:counterexample/0) with the verbosity specified in the first argument (see verbose/1). Uses eqc:check/2 to re-evaluate the property.

rerun_counterexample/3

rerun_counterexample(FlagList::[atom()], Property::property(), Example::counterexample()) -> any()

Re-run the counterexample for the property with verbosity as specified in first argument. Uses eqc:check/2 to re-evaluate the property.

rerun_verbose/1

rerun_verbose(FlagList::[atom()]) -> term()

Run the same function as before scheduled by pulse with verbosity set as in the function verbose. The verbosity is only changed during the rerun. The result of the scheduled run is one of the possible outcomes of running the function without the scheduler. In this way one need not copy the function to the scheduling process each time.

run/1

run(Fun::function()) -> term()

Equivalent to run(Fun, []).

run/2

run(Fun::function(), Options::proplist()) -> term()

Run a function scheduled by pulse. The result of the scheduled run is one of the possible outcomes of running the function without the scheduler. The following options can be provided:

seed
Specify the seed to generate the random schedule with. If not provided, pulse uses a random seed
schedule
One can save a schedule and run the code with that schedule.
run_timeout
Deadlock is detected after a certain period of non-activity in the scheduling process. This period is default set to 30 seconds, but can be increased or decreased with this option.
strategy
Value: fair | unfair (default: fair). With unfair strategy PULSE will assign a random priority to each process and use that when deciding which process to schedule.
single_mailbox
Value: boolean (default: false). If true PULSE implements instant message delivery. This is how things work in the current implementation of the Erlang VM (within a single node), but it is not guaranteed by the Erlang semantics. Enabling single_mailbox prevents PULSE from finding some "false" race conditions that currently cannot appear in practice.

seed/0

seed() -> gen(seed())

Seed generator to be used in combination with for example the seed option in run/2. The idea is to have QuickCheck generate a seed with this generator and pass this on to pulse.

start/0

start() -> {ok, Pid} | error

Start pulse as an application, it consists of a supervisor tree with an event manager and the pulse process. One can add event handlers dynamically

stop/0

stop() -> ok

Stop pulse application.

verbose/1

verbose(FlagList::[atom()]) -> [atom()]

Set verbose mode of all attached event handlers to items given as arguments. We support flags similar to those in erlang:trace/3.

all
Set all pulse flags and therewith show all pulse events.
send
Show sending of messages.
'receive'
Show receiving and delivery of messages.
procs
Show process related events: spawn, exit, register, unregister, link, unlink.
side_effect
Show side effects. Specify which function calls are side effects when instrumenting the code (see pulse_instrument).
format
Visualize the calls to format/2 in the verbose output.

The function returns the verbosity settings as they were before changing them (in order to be able to change them back).


Generated by EDoc, Sep 18 2017, 16:17:35.