1 # LTTng analyses machine interface
3 This document explains the input and output of the LTTng analyses'
6 The LTTng analyses project is a set of scripts which analyze one or more
7 traces and output the results of this analysis. Each script is responsible
13 There are two different phases. The client first gets the static metadata
14 of the analysis, then the client can perform as many analyses as needed
15 on different time ranges using this metadata.
17 The input format of the LTTng analyses MI scripts is a list of standard
18 command-line arguments.
22 | Argument | Description | Default |
24 | `--metadata` | Output the analysis' metadata instead of analyzing | N/A |
28 | Argument | Description | Default |
30 | 1st positional | Path to trace(s) to analyze | N/A |
31 | `--begin` | Beginning timestamp of analysis (ns) | Absolute beginning of the analyzed traces |
32 | `--end` | End timestamp of analysis (ns) | Absolute end of the analyzed traces |
33 | `--limit` | Maximum number of output rows per result table or `unlimited` | `unlimited` |
38 The output format is always UTF-8 [JSON](http://json.org/).
40 There are two different output phases. The client should first get the
41 analysis' metadata by running:
45 where `script` is the script containing the analysis. This is know as the
46 [metadata phase](#metadata). This output provides everything about the analysis
47 which is not result data: analysis title, authors, description, result table
48 column classes/titles/units, etc.
50 Then, the client can perform as many analyses as required by running the script
51 with the mandatory trace path argument. This is known
52 as the [analysis phase](#analysis).
54 Note that any [result table](#result-table) can still provide a dynamic table class
55 object along with the data when, for example, dynamic columns are required.
60 _Data objects_ contain data of specific classes.
62 All data objects share a common `class` property which identifies the
63 object's class. The available values are:
65 | Class name (string) | Object |
67 | `unknown` | [Unknown object](#unknown-object) |
68 | `ratio` | [Ratio object](#ratio-object) |
69 | `timestamp` | [Timestamp object](#timestamp-object) |
70 | `time-range` | [Time range object](#time-range-object) |
71 | `duration` | [Duration object](#duration-object) |
72 | `size` | [Size object](#size-object) |
73 | `bitrate` | [Bitrate object](#bitrate-object) |
74 | `syscall` | [Syscall object](#syscall-object) |
75 | `process` | [Process object](#process-object) |
76 | `path` | [Path object](#path-object) |
77 | `fd` | [File descriptor object](#file-descriptor-object) |
78 | `irq` | [IRQ object](#irq-object) |
79 | `cpu` | [CPU object](#cpu-object) |
80 | `disk` | [Disk object](#disk-object) |
81 | `part` | [Disk partition object](#disk-partition-object) |
82 | `netif` | [Network interface object](#network-interface-object) |
84 The following subsections explain each class of data object.
89 The special _unknown object_ represents an unknown value. It is
90 typically used in result table cells where a given computation cannot
91 produce a result for some reason.
93 This object has no properties.
106 A _ratio object_ describes a simple, dimensionless ratio, that is,
107 a relationship between two quantities having the same unit indicating
108 how many times the first quantity contains the second.
110 It is suggested that the client shows a ratio object as a percentage.
114 | Property | Type | Description | Required? | Default value |
115 |---|---|---|---|---|
116 | `value` | Number | Ratio as a decimal fraction | Yes | N/A |
128 #### Timestamp object
130 A _timestamp object_ describes a specific point in time.
134 | Property | Type | Description | Required? | Default value |
135 |---|---|---|---|---|
136 | `value` | Number | Number of nanoseconds since Unix epoch | Yes | N/A |
142 "class": "timestamp",
143 "value": 1444334398154194201
148 #### Time range object
150 A _time range object_ describes an interval bounded by two point in
155 | Property | Type | Description | Required? | Default value |
156 |---|---|---|---|---|
157 | `begin` | Number | Beginning timestamp (number of nanoseconds since Unix epoch) | Yes | N/A |
158 | `end` | Number | End timestamp (number of nanoseconds since Unix epoch) | Yes | N/A |
160 The `end` property must have a value greater or equal to the value of
161 the `begin` property.
167 "class": "time-range",
168 "begin": 1444334398154194201,
169 "end": 1444334425194487548
176 A _duration object_ describes the difference between two points in time.
180 | Property | Type | Description | Required? | Default value |
181 |---|---|---|---|---|
182 | `value` | Number | Time duration in nanoseconds | Yes | N/A |
196 A _size object_ describes the size of a file, of a buffer, of a transfer, etc.
200 | Property | Type | Description | Required? | Default value |
201 |---|---|---|---|---|
202 | `value` | Integer | Size in bytes | Yes | N/A |
216 A _bitrate object_ describes a transfer rate.
220 | Property | Type | Description | Required? | Default value |
221 |---|---|---|---|---|
222 | `value` | Number | Bitrate in bits/second | Yes | N/A |
236 A _syscall object_ describes the name of a system call.
240 | Property | Type | Description | Required? | Default value |
241 |---|---|---|---|---|
242 | `name` | String | System call name | Yes | N/A |
256 A _process object_ describes a system process.
260 | Property | Type | Description | Required? | Default value |
261 |---|---|---|---|---|
262 | `name` | String | Process name | No | No process name |
263 | `pid` | Integer | Process ID (PID) | No | No process ID |
264 | `tid` | Integer | Thread ID (TID) | No | No thread ID |
280 A _path object_ describes a relative or absolute file system path.
284 | Property | Type | Description | Required? | Default value |
285 |---|---|---|---|---|
286 | `path` | String | File system path | Yes | N/A |
293 "path": "/usr/bin/grep"
298 #### File descriptor object
300 A _file descriptor object_ describes the numeric descriptor of a file.
304 | Property | Type | Description | Required? | Default value |
305 |---|---|---|---|---|
306 | `fd` | Integer | File descriptor | Yes | N/A |
320 An _IRQ object_ describes an interrupt source.
324 | Property | Type | Description | Required? | Default value |
325 |---|---|---|---|---|
326 | `hard` | Boolean | `true` if this interrupt source generates hardware interrupts, `false` for software interrupts | No | `true` |
327 | `nr` | Integer | Interrupt source number | Yes | N/A |
328 | `name` | String | Interrupt source name | No | No interrupt source name |
344 A _CPU object_ describes a numeric CPU identifier.
348 | Property | Type | Description | Required? | Default value |
349 |---|---|---|---|---|
350 | `id` | Integer | CPU identifier number | Yes | N/A |
364 A _disk object_ describes a disk name.
368 | Property | Type | Description | Required? | Default value |
369 |---|---|---|---|---|
370 | `name` | String | Disk name | Yes | N/A |
382 #### Disk partition object
384 A _disk partition object_ describes a disk partition name.
388 | Property | Type | Description | Required? | Default value |
389 |---|---|---|---|---|
390 | `name` | String | Disk partition name | Yes | N/A |
402 #### Network interface object
404 A _network interface object_ describes a network interface name.
408 | Property | Type | Description | Required? | Default value |
409 |---|---|---|---|---|
410 | `name` | String | Network interface name | Yes | N/A |
424 The _metadata phase_ explains the analysis. It provides an optional title for the
425 analysis and the format of the result tables (outputted in the
426 [analysis phase](#analysis) by the same analysis).
428 The metadata phase writes a [metadata object](#metadata-object).
431 #### Column description object
433 A _column description object_ describes one table _column_.
437 | Property | Type | Description | Required? | Default value |
438 |---|---|---|---|---|
439 | `title` | String | Column's title | No | No title |
440 | `class` | String | Class of data in column's cells, amongst: <ul><li>`string`: JSON strings</li><li>`int`: JSON numbers limited to integers</li><li>`number`: JSON numbers</li><li>`bool`: JSON booleans</li><li>`ratio`: [ratio objects](#ratio-object)</li><li>`timestamp`: [timestamp objects](#timestamp-object)</li><li>`time-range`: [time range objects](#time-range-object)</li><li>`duration`: [duration objects](#duration-object)</li><li>`size`: [size objects](#size-object)</li><li>`bitrate`: [bitrate objects](#bitrate-object)</li><li>`syscall`: [syscall objects](#syscall-object)</li><li>`process`: [process objects](#process-object)</li><li>`path`: [path objects](#path-object)</li><li>`fd`: [file descriptor objects](#file-descriptor-object)</li><li>`irq`: [IRQ objects](#irq-object)</li><li>`cpu`: [CPU objects](#cpu-object)</li><li>`disk`: [disk objects](#disk-object)</li><li>`part`: [disk partition objects](#disk-partition-object)</li><li>`netif`: [network interface objects](#network-interface-object)</li><li>`mixed`: any object</li></ul> | No | `mixed` |
441 | `unit` | String | Column's unit, if the `class` property is `string`, `int`, `number`, or `bool` | No | No unit |
447 "title": "System call",
461 #### Table class object
463 A _table class object_ describes one class of
464 [result table](#result-table-object).
468 | Property | Type | Description | Required? | Default value |
469 |---|---|---|---|---|
470 | `inherit` | String | Name of inherited table class | No | No inheritance |
471 | `title` | String | Table's title | No | No title |
472 | `column-descriptions` | Array of [column description objects](#column-description-object) | Descriptions of table's columns | No | Zero columns |
474 When inheriting another table class using the `inherit` property,
475 the `title` and `column-descriptions` properties override the
478 **Example** (no inheritance):
482 "title": "Handler duration and raise latency statistics (hard IRQ)",
483 "column-descriptions": [
494 "title": "Minimum duration",
498 "title": "Average duration",
502 "title": "Maximum duration",
506 "title": "Standard deviation",
513 **Example** (with inheritance, redefining the title, keeping the same
514 column descriptions):
518 "inherit": "irq-stats",
519 "title": "IRQ statistics (ehci_hcd:usb1 [16])"
528 | Property | Type | Description | Required? | Default value |
529 |---|---|---|---|---|
530 | `major` | Integer | Major version | Yes, if `minor` exists | No major version |
531 | `minor` | Integer | Minor version | Yes, if `patch` exists | No minor version |
532 | `patch` | Integer | Patch version | No | No patch version |
533 | `extra` | String | Extra version information (e.g., `dev`, `pre`, `rc2`, commit ID) | No | No extra version |
551 | Property | Type | Description | Required? | Default value |
552 |---|---|---|---|---|
553 | `version` | [Version object](#version-object) | Version of the analysis | No | No version |
554 | `title` | String | Analysis title | No | No title |
555 | `authors` | Array of strings | Author(s) of the analysis | No | No authors |
556 | `description` | String | Analysis description | No | No description |
557 | `url` | String | URL where to find the analysis | No | No URL |
558 | `tags` | Array of strings | List of tags associated with the analysis | No | No tags |
559 | `table-classes` | Object mapping table class names (strings) to [table class objects](#table-class-object) | Classes of potential result tables | Yes (at least one table class) | N/A |
561 The `table-classes` property describes all the potential result
562 tables with a static layout that can be generated by the
563 [analysis phase](#analysis). A result table can specify the name
564 of its table class, or define a full table class in place for
565 dynamic result tables.
577 "title": "I/O latency statistics",
582 "description": "Provides statistics about the latency involved in various I/O operations.",
583 "url": "https://github.com/lttng/lttng-analyses",
592 "title": "System calls latency statistics",
593 "column-descriptions": [
594 {"title": "System call", "class": "syscall"},
595 {"title": "Count", "class": "int", "unit": "operations"},
596 {"title": "Minimum duration", "class": "duration"},
597 {"title": "Average duration", "class": "duration"},
598 {"title": "Maximum duration", "class": "duration"},
599 {"title": "Standard deviation", "class": "duration"}
603 "title": "Disk latency statistics",
604 "column-descriptions": [
605 {"title": "Disk name", "class": "disk"},
606 {"title": "Count", "class": "int", "unit": "operations"},
607 {"title": "Minimum duration", "class": "duration"},
608 {"title": "Average duration", "class": "duration"},
609 {"title": "Maximum duration", "class": "duration"},
610 {"title": "Standard deviation", "class": "duration"}
620 The _analysis phase_ outputs the actual data of the analysis.
622 The analysis phase writes an [analysis results object](#analysis-results-object).
625 #### Result table object
627 A _result table object_ represents the data of an analysis in rows
632 | Property | Type | Description | Required? | Default value |
633 |---|---|---|---|---|
634 | `time-range` | [Time range object](#time-range-object) | Time range over which the results contained in this table apply | Yes | N/A |
635 | `class` | String or [table class object](#table-class-object) | Table class name or table class object containing the metadata of this result table | Yes | N/A |
636 | `data` | Array of arrays of data objects/plain JSON values | Result table rows | Yes (at least one row) | N/A |
638 The `class` property indicates either:
640 * The name of the [table class object](#table-class-object),
641 as defined in the [metadata phase](#metadata), describing this
643 * A complete [table class object](#table-class-object). This is
644 useful when the result table's layout is dynamic (dynamic title,
645 dynamic column descriptions).
647 The `data` property is a JSON array of rows. Each row is a JSON array of
648 column cells. Each column cell contains a value (either a plain JSON
649 value, or a [data object](#data-objects)), as described by the `class`
650 property of the associated [column description object](#column-description-object).
652 Any column cell may contain the [unknown object](#unknown-object) when
653 it would be possible to get a result for this cell, but the result is
656 Any column cell may contain `null` when the cell is **empty**.
663 "class": "time-range",
664 "begin": 1444334398154194201,
665 "end": 1444334425194487548
667 "class": "syscall-latency",
670 {"class": "syscall", "name": "open"},
672 {"class": "duration", "value": 5562},
673 {"class": "duration", "value": 13835},
674 {"class": "duration", "value": 77683},
675 {"class": "duration", "value": 15263}
678 {"class": "syscall", "name": "read"},
680 {"class": "duration", "value": 316},
681 {"class": "duration", "value": 5774},
682 {"class": "unknown"},
683 {"class": "duration", "value": 9277}
689 **Example** (dynamic title):
694 "class": "time-range",
695 "begin": 1444334398154194201,
696 "end": 1444334425194487548
699 "inherit": "some-latency",
700 "title": "Latency of my stuff [42, 19, -3]"
704 {"class": "syscall", "name": "open"},
706 {"class": "duration", "value": 5562},
707 {"class": "duration", "value": 13835},
708 {"class": "duration", "value": 77683},
709 {"class": "duration", "value": 15263}
712 {"class": "syscall", "name": "read"},
714 {"class": "duration", "value": 316},
715 {"class": "duration", "value": 5774},
716 {"class": "unknown"},
717 {"class": "duration", "value": 9277}
723 **Example** (dynamic column descriptions):
728 "class": "time-range",
729 "begin": 1444334398154194201,
730 "end": 1444334425194487548
733 "title": "System call stuff for process zsh [4723]",
734 "column-descriptions": [
736 "title": "System call involved",
740 "title": "Count in region AX:23",
744 "title": "Count in region BC:86",
748 "title": "Count in region HE:37",
777 #### Analysis results object
779 An _analysis results object_ contains the actual data outputted by the
784 | Property | Type | Description | Required? | Default value |
785 |---|---|---|---|---|
786 | `results` | Array of [result table objects](#result-table-object) | Analysis results tables | Yes (at least one table) | N/A |
795 "class": "time-range",
796 "begin": 1444334398154194201,
797 "end": 1444334425194487548
799 "class": "syscall-latency",
802 {"class": "syscall", "name": "open"},
804 {"class": "duration", "value": 5562},
805 {"class": "duration", "value": 13835},
806 {"class": "duration", "value": 77683},
807 {"class": "duration", "value": 15263}
810 {"class": "syscall", "name": "read"},
812 {"class": "duration", "value": 316},
813 {"class": "duration", "value": 5774},
814 {"class": "unknown"},
815 {"class": "duration", "value": 9277}
821 "class": "time-range",
822 "begin": 1444334425194487549,
823 "end": 1444334425254887190
825 "class": "syscall-latency",
828 {"class": "syscall", "name": "open"},
830 {"class": "duration", "value": 1578},
831 {"class": "duration", "value": 16648},
832 {"class": "duration", "value": 15444},
833 {"class": "duration", "value": 68540}
836 {"class": "syscall", "name": "read"},
838 {"class": "duration", "value": 78},
839 {"class": "duration", "value": 1948},
840 {"class": "duration", "value": 11184},
841 {"class": "duration", "value": 94670}