aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Brooksby2012-09-03 15:28:57 +0100
committerRichard Brooksby2012-09-03 15:28:57 +0100
commit13e0ecd5fe642a243f98090d73cc4aa7bd699cff (patch)
tree53b94f466923fa62deb571025a215cca3ba5361a
parent986d55351a66a9078c0da496e27f025c9cb33485 (diff)
downloademacs-13e0ecd5fe642a243f98090d73cc4aa7bd699cff.tar.gz
emacs-13e0ecd5fe642a243f98090d73cc4aa7bd699cff.zip
Removed basic untruths and added some discussion of debugging, though this starts to resemble a manual rather than a design document, and needs to be reworked.
Copied from Perforce Change: 179203 ServerID: perforce.ravenbrook.com
-rw-r--r--mps/design/telemetry/index.html131
1 files changed, 80 insertions, 51 deletions
diff --git a/mps/design/telemetry/index.html b/mps/design/telemetry/index.html
index 167613215ef..4807a058df2 100644
--- a/mps/design/telemetry/index.html
+++ b/mps/design/telemetry/index.html
@@ -234,10 +234,7 @@ IMPLEMENTATION:
234Annotation 234Annotation
235 235
236<a id="annot" name="annot">.annot</a>: An event annotation is of the form: 236<a id="annot" name="annot">.annot</a>: An event annotation is of the form:
237 EVENT_PAW(FooCreate, pointer, address, word); 237 EVENT3(FooCreate, pointer, address, word);
238
239<a id="annot.format" name="annot.format">.annot.format</a>: Note that the format is indicated in the macro name. See
240.format.
241 238
242<a id="annot.string" name="annot.string">.annot.string</a>: If there is a string in the format, it must be the last 239<a id="annot.string" name="annot.string">.annot.string</a>: If there is a string in the format, it must be the last
243parameter (and hence there can be only one). There is currrently a maximum 240parameter (and hence there can be only one). There is currrently a maximum
@@ -247,29 +244,27 @@ string length, defined by EventMaxStringLength in impl.h.eventcom.
247macro, as registered in impl.h.eventdef. 244macro, as registered in impl.h.eventdef.
248 245
249<a id="annot.param" name="annot.param">.annot.param</a>: The parameters of the event should be given as the remaining 246<a id="annot.param" name="annot.param">.annot.param</a>: The parameters of the event should be given as the remaining
250parameters of the event macro, in order as indicated in the format. 247parameters of the event macro, in order as indicated in the event parameters definition in impl.h.eventdef.
251 248
252 249
253Registration 250Registration
254 251
255<a id="reg" name="reg">.reg</a>: All event types should be registered in impl.h.eventdef, in the form of a 252<a id="reg" name="reg">.reg</a>: All event types and parameters should
256relation. 253be registered in impl.h.eventdef, in the form of a higher-order list
254macros.
257 255
258<a id="reg.just" name="reg.just">.reg.just</a>: This use of a relation macro enables great flexibility in the use of 256<a id="reg.just" name="reg.just">.reg.just</a>: This use of a higher-order macros enables great flexibility in the use of
259this file. 257this file.
260 258
261<a id="reg.rel" name="reg.rel">.reg.rel</a>: The relation is of the form: 259<a id="reg.rel" name="reg.rel">.reg.rel</a>: The event type registration is of the form:
262 RELATION(FooCreate, 0x1234, TRUE, Arena, PAW) 260 EVENT(X, FooCreate, 0x1234, TRUE, Arena)
263 261
264<a id="reg.type" name="reg.type">.reg.type</a>: The first parameter of the relation is the event type. This needs 262<a id="reg.type" name="reg.type">.reg.type</a>: The first parameter of the relation is the event type. This needs
265no prefix, and should correspond to that used in the annotation. 263no prefix, and should correspond to that used in the annotation.
266 264
267<a id="reg.code" name="reg.code">.reg.code</a>: The second parameter is the event code, a 16-bit value used to 265<a id="reg.code" name="reg.code">.reg.code</a>: The second parameter is the event code, a 16-bit value used to
268represent this event type. [Not yet used. GavinM 1997-07-18] 266represent this event type. Codes should not be re-used for new event types, to allow interpretation of event
269 267log files of all ages.
270<a id="reg.code.temp" name="reg.code.temp">.reg.code.temp</a>: On an interim basis, new events also have to be registered in
271impl.h.eventcom. This will no longer be required when the event file format is
272revised.
273 268
274<a id="reg.always" name="reg.always">.reg.always</a>: The third parameter is a boolean value indicating whether this 269<a id="reg.always" name="reg.always">.reg.always</a>: The third parameter is a boolean value indicating whether this
275event type should be implemented in all varieties. See .control.buffer. 270event type should be implemented in all varieties. See .control.buffer.
@@ -284,48 +279,46 @@ event falls into. See .control. The possible values are:
284 Seg -- per segment 279 Seg -- per segment
285 Ref -- per reference or fix 280 Ref -- per reference or fix
286 Object -- per object or allocation 281 Object -- per object or allocation
287This list can be seen in impl.h.event. 282 User -- invoked by the user through the MPS interface
283This list can be seen in impl.h.eventcom.
288 284
289<a id="reg.format" name="reg.format">.reg.format</a>: The fifth parameter is the format (see .format) and should 285[.reg.doc: Add a docstring column. RB 2012-09-03]
290correspond to the annotation (see .annot.format).
291 286
292<a id="reg.dup" name="reg.dup">.reg.dup</a>: It is permissible for the one event type to be used for more than one 287.reg.params: The event parameters registration is of the form:
293annotation. There are generally two reasons for this:
294 - Variable control flow for successful function completion;
295 - Platform/Otherwise-dependent implementations of a function.
296Note that all annotations for one event type must have the same format (as
297implied by .reg.format).
298 288
289 #define EVENT_FooCreate_PARAMS(PARAM, X) \
290 PARAM(X, 0, P, firstParamPointer) \
291 PARAM(X, 1, U, secondParamUnsigned)
299 292
300Format 293.reg.param.index: The first column is the index, and must start at zero
294and increase by one for each row.
301 295
302<a id="format" name="format">.format</a>: Where a format is used to indicate the type, it is a sequence of 296.reg.param.sort: The second column is the parameter "sort", which, when
303letters from the following list: 297appended to EventF, yields a type for the parameter. It is a letter from the following list:
304 P -- void * 298 P -- void *
305 A -- Addr 299 A -- Addr
306 W -- Word 300 W -- Word
307 U -- unsigned int 301 U -- unsigned int
308 S -- char * 302 S -- char *
309 D -- double 303 D -- double
310The corresponding event parameters must be assignment compatible with these 304 B -- Bool
311types. 305The corresponding event parameter must be assignment compatible with the type.
312
313<a id="format.zero" name="format.zero">.format.zero</a>: If there are no parameters for an event, then the special format
314"0" should be used.
315 306
316<a id="format.types" name="format.types">.format.types</a>: When an event has parameters whose type is not in the above 307.param.types: When an event has parameters whose type is not in the above
317list, use the following guidelines: All C pointer types not representing 308list, use the following guidelines: All C pointer types not representing
318strings use P; Size, Count, Index use W; Bool use U; others should be obvious. 309strings use P; Size, Count, Index use W; others should be obvious.
319 310
320<a id="format.support" name="format.support">.format.support</a>: Every format used needs bespoke support in impl.h.eventgen. 311.reg.param.name: The third column is the parameter name. It should be a valid C identifier
321It has not been possible to provide support for all possible formats, so such 312and is used for debugging display and human readable output.
322support is added when required. <a id="format.support.auto" name="format.support.auto">.format.support.auto</a>: There is a tool in 313
323impl.pl.eventgen that will generate impl.h.eventgen automatically. It is used 314[.reg.param.doc: Add a docstring column. RB 2012-09-03]
324as follows: 315
325 1. Claim the file eventgen.h. 316<a id="reg.dup" name="reg.dup">.reg.dup</a>: It is permissible for the one event type to be used for more than one
326 2. Invoke eventgen.pl. 317annotation. There are generally two reasons for this:
327 3. Check it compiles correctly in all varieties. 318 - Variable control flow for successful function completion;
328 4. Check in eventgen.h. 319 - Platform/Otherwise-dependent implementations of a function.
320Note that all annotations for one event type must have the same format (as
321implied by .reg.format).
329 322
330 323
331Control 324Control
@@ -334,32 +327,59 @@ Control
334 327
335<a id="control.buffer" name="control.buffer">.control.buffer</a>: Buffer control affects whether particular events implemented 328<a id="control.buffer" name="control.buffer">.control.buffer</a>: Buffer control affects whether particular events implemented
336at all, and is controlled statically by variety using the always value (see 329at all, and is controlled statically by variety using the always value (see
337.reg.always) for the event type. This is only relevant to release varieties. 330.reg.always) for the event type. The hot variety does compiles out annotations
338[Not yet implemented. GavinM 1997-07-18] 331with always=FALSE. The cool variety does not, so always buffers a complete
332set of events.
339 333
340<a id="control.output" name="control.output">.control.output</a>: Output control affects whether events written to the internal 334<a id="control.output" name="control.output">.control.output</a>: Output control affects whether events written to the internal
341buffer are output via the plinth. This is set on a per-kind basis (see 335buffer are output via the plinth. This is set on a per-kind basis (see
342.reg.kind), using a control bit table stored in EventKindControl. By default, 336.reg.kind), using a control bit table stored in EventKindControl. By default,
343all event kinds are on (in variety.ti). You may switch some kinds off using a 337all event kinds are off. You may switch some kinds on using a
344debugger. 338debugger.
345 339
346For example, to disable Ref events using gdb (see impl.h.event for numeric 340For example, to disable Ref events using gdb (see impl.h.event for numeric
347codes): 341codes):
348 342
349 break ArenaCreate 343 break TraceCreate
350 run 344 run
351 delete 1 345 delete 1
352 call BTRes(EventKindControl, 4) 346 print EventKindControl |= 4
353 continue 347 continue
354 348
349.control.env: The initial value of EventKindControl is read from the C environment
350when the ANSI Plinth is used, and so event output can be controlled like this:
351
352 MPS_TELEMETRY_CONTROL=127 amcss
353
355<a id="control.just" name="control.just">.control.just</a>: These controls are coarse, but very cheap. 354<a id="control.just" name="control.just">.control.just</a>: These controls are coarse, but very cheap.
356 355
357<a id="control.external" name="control.external">.control.external</a>: There will be an MPS interface function to control 356<a id="control.external" name="control.external">.control.external</a>: The MPS interface function mps_telemetry_control
358EventKindControl. 357can be used to change EventKindControl.
359 358
360<a id="control.tool" name="control.tool">.control.tool</a>: The tools will be able to control EventKindControl. 359<a id="control.tool" name="control.tool">.control.tool</a>: The tools will be able to control EventKindControl.
361 360
362 361
362Debugging
363
364.debug.buffer: Each event kind is logged in a separate buffer, EventBuffer[kind].
365
366.debug.buffer.reverse: The events are logged in reverse order from the top of the buffer, with the last logged
367event at EventLast[kind]. This allows recovery of the list of recent events using the event->any.size field.
368
369.debug.dump: The contents of all buffers can be dumped with the EventDump function from a debugger, e.g.
370
371 gdb> print EventDump(mps_lib_get_stdout())
372
373.debug.describe: Individual events can be described with the EventDescribe function, e.g.
374
375 gdb> print EventDescribe(EventLast[3], mps_lib_get_stdout())
376
377.debug.core: The event buffers are preserved in core dumps and can be used
378to work out what the MPS was doing before a crash. Since the kinds correspond
379to frequencies, ancient events may still be available in some buffers, even
380if they have been flushed to the output stream. Some digging may be required.
381
382
363Dumper Tool 383Dumper Tool
364 384
365<a id="dumper" name="dumper">.dumper</a>: A primitive dumper tool is available in impl.c.eventcnv. For details, 385<a id="dumper" name="dumper">.dumper</a>: A primitive dumper tool is available in impl.c.eventcnv. For details,
@@ -377,7 +397,6 @@ TEXT:
377 397
378<a id="notes" name="notes">.notes</a>: 398<a id="notes" name="notes">.notes</a>:
379 - Set always to FALSE for all Ref and Object events; 399 - Set always to FALSE for all Ref and Object events;
380 - Fix use of BT for size in bytes, guess then check, BTInit;
381 - Resolve protection transgression in impl.h.eventdef; 400 - Resolve protection transgression in impl.h.eventdef;
382 - Make EventKind* enum members so they can be used from the debugger. 401 - Make EventKind* enum members so they can be used from the debugger.
383 402
@@ -422,6 +441,16 @@ TEXT:
422 441
423</tr> 442</tr>
424 443
444<tr valign="top">
445
446 <td>2012-09-03</td>
447
448 <td><a href="mailto:rb@ravenbrook.com">RB</a></td>
449
450 <td>Removed basic untruths and added some discussion of debugging, though this starts to resemble a manual rather than a design document, and needs to be reworked.</td>
451
452</tr>
453
425</table> 454</table>
426 455
427 456