9
9
10
10
B < Note: > This class is a Rakudo-specific feature and not standard Perl 6.
11
11
12
- On creation, a C < Telemetry > object contains a snapshot of the current state
13
- of the virtual machine. This is in itself useful, but generally one needs
14
- two snapshots for the difference (which is a
12
+ On creation, a C < Telemetry > object contains a snapshot of various aspects of
13
+ the current state of the virtual machine. This is in itself useful, but
14
+ generally one needs two snapshots for the difference (which is a
15
15
L < Telemetry::Period|/type/Telemetry::Period > object).
16
16
17
- The following data is available both as a method on a C < Telemetry > type object,
18
- as well as on an instantiated C < Telemetry > object. When loading it as a
19
- module with the C < :COLUMNS > named parameter, these are also available as
20
- standalone subroutines.
17
+ The Telemetry object is really a collection of snapshots taken by different
18
+ "instruments". By default, the
19
+ L < Telemetry::Instrument::Usage|/type/Telemetry::Instrument::Usage >
20
+ and L < Telemetry::Instrument::ThreadPool|/type/Telemetry::Instrument::ThreadPool >
21
+ instruments are activated.
21
22
22
- = begin code
23
- use Telemetry; # imports default subroutines: T, snap, snapper, periods, report
24
- use Telemetry :COLUMNS; # imports all of the possible columns of report
25
- use Telemetry < cpu wallclock snap >; # only imports cpu, wallclock and snap
26
- = end code
27
-
28
- Apart from this data, other fields in the POSIX C < getrusage > struct are also
29
- collected, but are probably not in use on most operating systems and will thus
30
- always give 0. These are (column names in parenthesis):
31
-
32
- id-rss, inblock (inb), invcw, is-rss, ix-rss, maj-flt (aft), min-flt (ift),
33
- msgrcv (mrc), msgsnd (msd), nsignals (ngs), nswap (nsw), nvcsw (vcs),
34
- outblock (oub).
35
-
36
- Please consult the C < getrusage > manual information for the meaning of these
37
- fields.
38
-
39
- = head1 Methods
40
-
41
- = head2 method affinity-tasks-completed
42
-
43
- = for code :preamble<use Telemetry;>
44
- multi method affinity-tasks-completed(Telemetry:U: --> Int)
45
- multi method affinity-tasks-completed(Telemetry:D: --> Int)
46
-
47
- Available data. Column name: C < atc > .
48
-
49
- Returns the number of tasks completed in affinity threads in this period.
50
-
51
- = head2 method affinity-tasks-queued
52
-
53
- = for code :preamble<use Telemetry;>
54
- multi method affinity-tasks-queued(Telemetry:U: --> Int)
55
- multi method affinity-tasks-queued(Telemetry:D: --> Int)
56
-
57
- Available data. Column name: C < atq > .
58
-
59
- Returns the number of tasks queued for execution in affinity threads.
60
-
61
- = head2 method affinity-workers
62
-
63
- = for code :preamble<use Telemetry;>
64
- multi method affinity-workers(Telemetry:U: --> Int)
65
- multi method affinity-workers(Telemetry:D: --> Int)
66
-
67
- Available data. Column name: C < aw > .
68
-
69
- Returns the number of affinity threads added in this period.
70
-
71
- = head2 method cpu
72
-
73
- = for code :preamble<use Telemetry;>
74
- multi method cpu(Telemetry:U: --> Int)
75
- multi method cpu(Telemetry:D: --> Int)
76
-
77
- Available data.
78
-
79
- Returns the total amount of CPU time of this period (in microseconds),
80
- essentially the sum of C < cpu-user > and C < cpu-sys > .
81
-
82
- = head2 method cpu-user
83
-
84
- = for code :preamble<use Telemetry;>
85
- multi method cpu-user(Telemetry:U: --> Int)
86
- multi method cpu-user(Telemetry:D: --> Int)
87
-
88
- Available data.
89
-
90
- Returns the amount of CPU time spent on executing user code of this period
91
- (in microseconds).
92
-
93
- = head2 method cpu-sys
94
-
95
- = for code :preamble<use Telemetry;>
96
- multi method cpu-sys(Telemetry:U: --> Int)
97
- multi method cpu-sys(Telemetry:D: --> Int)
98
-
99
- Available data.
100
-
101
- Returns the amount of CPU time spent in system overhead of this period (in
102
- microseconds).
103
-
104
- = head2 method general-tasks-completed
105
-
106
- = for code :preamble<use Telemetry;>
107
- multi method general-tasks-completed(Telemetry:U: --> Int)
108
- multi method general-tasks-completed(Telemetry:D: --> Int)
109
-
110
- Available data. Column name: C < gtc > .
111
-
112
- Returns the number of tasks completed in general worker threads in this period.
113
-
114
- = head2 method general-tasks-queued
115
-
116
- = for code :preamble<use Telemetry;>
117
- multi method general-tasks-queued(Telemetry:U: --> Int)
118
- multi method general-tasks-queued(Telemetry:D: --> Int)
119
-
120
- Available data. Column name: C < gtq > .
121
-
122
- Returns the number of tasks queued for execution in general worker threads
123
- in this period.
124
-
125
- = head2 method general-workers
126
-
127
- = for code :preamble<use Telemetry;>
128
- multi method general-workers(Telemetry:U: --> Int)
129
- multi method general-workers(Telemetry:D: --> Int)
130
-
131
- Available data. Column name: C < gw > .
132
-
133
- Returns the number of general worker threads that were added in this period.
134
-
135
- = head2 method max-rss
136
-
137
- = for code :preamble<use Telemetry;>
138
- multi method max-rss(Telemetry:U: --> Int)
139
- multi method max-rss(Telemetry:D: --> Int)
140
-
141
- Available data.
142
-
143
- Returns the maximum resident set size increase for this period (in KiB).
144
-
145
- = head2 method supervisor
146
-
147
- = for code :preamble<use Telemetry;>
148
- multi method supervisor(Telemetry:U: --> Int)
149
- multi method supervisor(Telemetry:D: --> Int)
150
-
151
- Available data. Column name: C < s > .
152
-
153
- Returns The number of supervisor threads running, usually C < 0 > or C < 1 > .
154
-
155
- = head2 method timer-tasks-completed
156
-
157
- = for code :preamble<use Telemetry;>
158
- multi method timer-tasks-completed(Telemetry:U: --> Int)
159
- multi method timer-tasks-completed(Telemetry:D: --> Int)
160
-
161
- Available data. Column name: C < ttc > .
162
-
163
- Returns the number of tasks completed in timer worker threads.
164
-
165
- = head2 method timer-tasks-queued
166
-
167
- = for code :preamble<use Telemetry;>
168
- multi method timer-tasks-queued(Telemetry:U: --> Int)
169
- multi method timer-tasks-queued(Telemetry:D: --> Int)
23
+ The Telemetry (and Telemetry::Period) object also C < Associative > . This means
24
+ that you can treat a Telemetry object as a read-only C < Hash > , with all of the
25
+ data values of the instruments as keys.
170
26
171
- Available data. Column name: C < ttq > .
27
+ You can determine which instruments C < Telemetry > should use by setting the
28
+ C < $*SAMPLER > dynamic variable, which is a
29
+ L < Telemetry::Sampler|/type/Telemetry::Sampler > object.
172
30
173
- Returns the number of tasks queued for execution in timer worker threads.
31
+ Currently, the following instruments are supported by the Rakudo core:
174
32
175
- = head2 method timer-workers
33
+ = item Telemetry::Instrument::Usage
176
34
177
- = for code :preamble<use Telemetry;>
178
- multi method timer-workers(Telemetry:U: --> Int)
179
- multi method timer-workers(Telemetry:D: --> Int)
35
+ Provides (in alphabetical order): C < cpu > , C < cpu-sys > , C < cpu-user > , C < cpus > ,
36
+ C < id-rss > , C < inb > , C < invcsw > , C < is-rss > , C < ix-rss > , C < majf > , C < max-rss > ,
37
+ C < minf > , C < mrcv > , C < msnd > , C < nsig > , C < nswp > , C < volcsw > , C < outb > , C < util% >
38
+ and C < wallclock > . For complete documentation of the meaning of these data
39
+ values, see L < Telemetry::Instrument::Usage|/type/Telemetry::Instrument::Usage > .
180
40
181
- Available data. Column name: C < tw > .
41
+ = item Telemetry::Instrument::Thread
182
42
183
- Returns the number of timer worker threads.
43
+ Provides (in alphabetical order): C < tad > , C < tcd > , C < thid > , C < tjd > , C < tsd > and
44
+ C < tys > . For complete documentation of the meaning of these data values, see
45
+ L < Telemetry::Instrument::Thread|/type/Telemetry::Instrument::Thread > .
184
46
185
- = head2 method wallclock
47
+ = item Telemetry::Instrument::ThreadPool
186
48
187
- = for code :preamble<use Telemetry;>
188
- multi method wallclock(Telemetry:U: --> Int)
189
- multi method wallclock(Telemetry:D: --> Int)
49
+ Provides (in alphabetical order): C < atc > , C < atq > , C < aw > , C < gtc > , C < gtq > , C < gw > ,
50
+ C < s > , C < ttc > , C < ttq > and C < tw > . For complete documentation of the meaning of
51
+ these data values, see
52
+ L < Telemetry::Instrument::ThreadPool|/type/Telemetry::Instrument::ThreadPool > .
190
53
191
- Available data.
54
+ = item Telemetry::Instrument::AdHoc
192
55
193
- Returns the time the program has been executing (in microseconds).
56
+ Does not provide any data by itself: one must indicate which variables are
57
+ to be monitored, which will then become available as methods with the same name
58
+ on the instrument. For complete documentation, see
59
+ L < Telemetry::Instrument::AdHoc|/type/Telemetry::Instrument::AdHoc > .
194
60
195
61
= head2 routine T
196
62
@@ -249,15 +115,15 @@ generates a L<Seq> of C<Telemetry::Period> objects out of that. It is exported
249
115
by default.
250
116
251
117
= begin code :preamble<my @t;use Telemetry;>
252
- .say for periods(@t);
118
+ .<cpu wallclock>. say for periods(@t);
253
119
254
120
# OUTPUT:
255
121
# ====================
256
- # 164 / 160
257
- # 23 / 21
258
- # 17 / 17
259
- # 15 / 16
260
- # 29 / 28
122
+ # ( 164 / 160)
123
+ # ( 23 / 21)
124
+ # ( 17 / 17)
125
+ # ( 15 / 16)
126
+ # ( 29 / 28)
261
127
= end code
262
128
263
129
If no array is specified, it will use the internal array of C < snap > without
@@ -270,7 +136,7 @@ for ^5 {
270
136
snap;
271
137
LAST snap;
272
138
}
273
- . say for periods;
139
+ say .<cpu wallclock>.join(" / ") for periods;
274
140
275
141
# OUTPUT:
276
142
# ====================
@@ -299,8 +165,7 @@ Below are the additional named parameters of C<report>.
299
165
= item C < :columns >
300
166
301
167
Specify the names of the columns to be included in the report. Names can
302
- be specified with the full method name (e.g. C < general-workers > ) or with
303
- the abbreviated column name (e.g. C < gw > ). If not specified, defaults to
168
+ be specified with the column name (e.g. C < gw > ). If not specified, defaults to
304
169
what is specified in the C < RAKUDO_REPORT_COLUMNS > environment variable.
305
170
If that is not set either, defaults to:
306
171
0 commit comments