Erlang --

Runtime_Tools

Reference Manual

Version 1.16.2

- User's Guide
- Reference Manual
- Release Notes
- PDF
- Top

- Expand All
- Contract All

### Table of Contents

- runtime_tools (App)
- dbg
  - Top of manual page
  - c/3
  - c/4
  - cn/1
  - ctp/0
  - ctp/1
  - ctp/2
  - ctp/3
  - ctp/1
  - ctpe/1
  - ctpg/0
  - ctpg/1
  - ctpg/2
  - ctpg/3
  - ctpg/1
  - ctpl/0
  - ctpl/1
  - ctpl/2
  - ctpl/3
  - ctpl/1
  - dtp/0
  - dtp/1
  - flush_trace_port/0
  - flush_trace_port/1
  - fun2ms/1
  - get_tracer/0
  - get_tracer/1
  - h/0
  - h/1
  - i/0
  - ln/0
  - ltp/0
  - n/1
  - p/1
  - p/2
  - rtp/1
  - stop/0
  - stop_clear/0
  - stop_trace_client/1
  - tp/2
  - tp/3
  - tp/4
  - tp/2
  - tpe/2
  - tpl/2
  - tpl/3
  - tpl/4
  - tpl/2
  - trace_client/2
  - trace_client/3
  - trace_port/2
  - trace_port_control/1
  - trace_port_control/2
  - tracer/0
  - tracer/2
  - tracer/3
  - wtp/1
- dyntrace
  - Top of manual page
  - available/0
  - get_tag/0
  - get_tag/0
  - p/0
  - p/1
  - p/2
  - p/3
  - p/4
  - p/5
  - p/6
  - p/7
  - p/8
  - put_tag/1
  - restore_tag/1
  - spread_tag/1
- erts_alloc_config
  - Top of manual page
  - make_config/0
  - make_config/1
  - save_scenario/0
  - stop/0
- msacc
  - Top of manual page
  - available/0
  - from_file/1
  - print/0
  - print/1
  - print/2
  - print/3
  - reset/0
  - start/0
  - start/1
  - stats/0
  - stats/2
  - stop/0
  - to_file/1
- scheduler
  - Top of manual page
  - sample/0
  - sample_all/0
  - utilization/1
  - utilization/2
- system_information
  - Top of manual page
  - sanity_check/0
  - to_file/1

# 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_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.

{normal, SchedulerId, Util, Percent}
  Scheduler utilization of a normal scheduler with number SchedulerId. Schedulers that are not online will also be included. Online schedulers have the lowest 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.

### Exports

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

Sample = sched_sample()

Calculate scheduler utilizations for the time interval from when Sample was taken and "now". The same as calling scheduler:utilization(Sample, scheduler:sample_all()).

Note

Scheduler utilization is measured as an average value over a time interval, calculated as the difference between two samples. To get good useful utilization values at least a couple of seconds should have passed between the two samples. For this reason, you should not do

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