1scheduler(3) Erlang Module Definition scheduler(3)
2
3
4
6 scheduler - Measure scheduler utilization
7
9 This module contains utility functions for easier measurement and cal‐
10 culation of scheduler utilization, otherwise obtained from calling the
11 more primitive statistics(scheduler_wall_time).
12
13 The simplest usage is to call scheduler:utilization(Seconds).
14
16 sched_sample()
17
18 sched_type() = normal | cpu | io
19
20 sched_id() = integer()
21
22 sched_util_result() =
23 [{sched_type(), sched_id(), float(), string()} |
24 {total, float(), string()} |
25 {weighted, float(), string()}]
26
27 A list of tuples containing results for individual schedulers as
28 well as aggregated averages. Util is the scheduler utilization
29 as a floating point value between 0.0 and 1.0. Percent is the
30 same utilization as a more human readable string expressed in
31 percent.
32
33 {normal, SchedulerId, Util, Percent}:
34 Scheduler utilization of a normal scheduler with number
35 SchedulerId. Schedulers that are not online will also be in‐
36 cluded. Online schedulers have the lowest SchedulerId.
37
38 {cpu, SchedulerId, Util, Percent}:
39 Scheduler utilization of a dirty-cpu scheduler with number
40 SchedulerId.
41
42 {io, SchedulerId, Util, Percent}:
43 Scheduler utilization of a dirty-io scheduler with number
44 SchedulerId. This tuple will only exist if both samples were
45 taken with sample_all/0.
46
47 {total, Util, Percent}:
48 Total utilization of all normal and dirty-cpu schedulers.
49
50 {weighted, Util, Percent}:
51 Total utilization of all normal and dirty-cpu schedulers,
52 weighted against maximum amount of available CPU time.
53
55 sample() -> sched_sample()
56
57 Return a scheduler utilization sample for normal and dirty-cpu
58 schedulers.
59
60 sample_all() -> sched_sample()
61
62 Return a scheduler utilization sample for all schedulers, in‐
63 cluding dirty-io schedulers.
64
65 utilization(Seconds) -> sched_util_result()
66
67 Types:
68
69 Seconds = integer() >= 1
70
71 Measure utilization for normal and dirty-cpu schedulers during
72 Seconds seconds, and then return the result.
73
74 utilization(Sample) -> sched_util_result()
75
76 Types:
77
78 Sample = sched_sample()
79
80 Calculate scheduler utilizations for the time interval from when
81 Sample was taken and "now". The same as calling scheduler:uti‐
82 lization(Sample, scheduler:sample_all()).
83
84 Note:
85 Scheduler utilization is measured as an average value over a
86 time interval, calculated as the difference between two samples.
87 To get good useful utilization values at least a couple of sec‐
88 onds should have passed between the two samples. For this rea‐
89 son, you should not do
90
91 scheduler:utilization(scheduler:sample()). % DO NOT DO THIS!
92
93
94 The above example takes two samples in rapid succession and cal‐
95 culates the scheduler utilization between them. The resulting
96 values will probably be more misleading than informative.
97
98 Instead use scheduler:utilization(Seconds) or let some time pass
99 between Sample=scheduler:sample() and scheduler:utilization(Sam‐
100 ple).
101
102
103 utilization(Sample1, Sample2) -> sched_util_result()
104
105 Types:
106
107 Sample1 = Sample2 = sched_sample()
108
109 Calculates scheduler utilizations for the time interval between
110 the two samples obtained from calling sample/0 or sample_all/0.
111
112
113
114Ericsson AB runtime_tools 1.17 scheduler(3)