scheduler

Module

scheduler

Module Summary

Measure scheduler utilization

Since

Module scheduler was introduced in OTP 21.0.

Description

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).

Data Types

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.

{normal, SchedulerId, Util, Percent}
Scheduler utilization of a normal scheduler with number SchedulerId.
{cpu, SchedulerId, Util, Percent}
Scheduler utilization of a dirty-cpu scheduler with number SchedulerId.
{io, SchedulerId, Util, Percent}
Scheduler utilization of a dirty-io scheduler with number SchedulerId. This tuple will only exist if both samples were taken with sample_all/0.
{total, Util, Percent}
Total utilization of all normal and dirty-cpu schedulers.
{weighted, Util, Percent}
Total utilization of all normal and dirty-cpu schedulers, weighted against maximum amount of available CPU time.

sample() -> sched_sample()
OTP 21.0

Return a scheduler utilization sample for normal and dirty-cpu schedulers.

sample_all() -> sched_sample()
OTP 21.0

Return a scheduler utilization sample for all schedulers, including dirty-io schedulers.

utilization(Seconds) -> sched_util_result()
OTP 21.0

Types

Seconds = integer() >= 1

Measure utilization for normal and dirty-cpu schedulers during Seconds seconds, and then return the result.

utilization(Sample) -> sched_util_result()
OTP 21.0

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()).

utilization(Sample1, Sample2) -> sched_util_result()
OTP 21.0

Types

Sample1 = Sample2 = sched_sample()

Calculates scheduler utilizations for the time interval between the two samples obtained from calling sample/0 or sample_all/0.