Loader.LoadProfile (loader v0.3.1)

A struct representing a distribution of discrete work tasks over a period of time, and functions for working with that data.

See Loader.LoadProfile.Curves for details on defining the function of a LoadProfile, which determines the distribution of work tasks.

A LoadProfile is defined independently from the type of work being done. It could describe calls made against a remote service as easily as work done in a local module.

Link to this section Summary

Functions

Returns a new LoadProfile based on the given props, with incorrect props set to default values.

Returns a 2-tuple: a plot of points that represents how tasks would be distributed for the given profile, and the total number of tasks "under the curve" (an approximate integral of the function, reflecting the total number of tasks that will be executed).

Link to this section Types

@type t() :: %Loader.LoadProfile{
  function: (integer() -> number()),
  target_running_time: integer(),
  tick_resolution: 10
}

Link to this section Functions

Link to this function

new(props \\ %{})

Returns a new LoadProfile based on the given props, with incorrect props set to default values.

rules-for-props

Rules for props:

  • target_running_time: must be a positive integer
  • function: must be a 1-arity function. It should also return a number, but this isn't enforced
Link to this function

plot_curve(profile)

@spec plot_curve(t()) :: {[{integer(), integer()}], integer()}

Returns a 2-tuple: a plot of points that represents how tasks would be distributed for the given profile, and the total number of tasks "under the curve" (an approximate integral of the function, reflecting the total number of tasks that will be executed).