scheduler
Measure scheduler utilization
- Provided by: erlang-manpages (Version: 1:24.2.1+dfsg-1ubuntu0.6)
- Source: erlang
- Report a bug
Measure scheduler utilization
This module contains utility functions for easier measurement and calculation of scheduler utilization, otherwise obtained from calling the more primitive statistics(scheduler_wall_time).
The simplest usage is to call scheduler:utilization(Seconds).
sched_sample()
sched_type() = normal | cpu | io
sched_id() = integer()
sched_util_result() =
[{sched_type(), sched_id(), float(), string()} |
{total, float(), string()} |
{weighted, float(), string()}]
A list of tuples containing results for individual schedulers as well as aggregated averages. Util is the scheduler utilization as a floating point value between 0.0 and 1.0. Percent is the same utilization as a more human readable string expressed in percent.
sample() -> sched_sample()
Return a scheduler utilization sample for normal and dirty-cpu schedulers.
sample_all() -> sched_sample()
Return a scheduler utilization sample for all schedulers, including dirty-io schedulers.
utilization(Seconds) -> sched_util_result()
Types:
Measure utilization for normal and dirty-cpu schedulers during Seconds seconds, and then return the result.
utilization(Sample) -> sched_util_result()
Types:
Calculate scheduler utilizations for the time interval from when Sample was taken and "now". The same as calling scheduler:utilization(Sample, scheduler:sample_all()).
scheduler:utilization(scheduler:sample()). % DO NOT DO THIS!
The above example takes two samples in rapid succession and calculates the scheduler utilization between them. The resulting values will probably be more misleading than informative.
Instead use scheduler:utilization(Seconds) or let some time pass between Sample=scheduler:sample() and scheduler:utilization(Sample).
utilization(Sample1, Sample2) -> sched_util_result()
Types:
Calculates scheduler utilizations for the time interval between the two samples obtained from calling sample/0 or sample_all/0.