| 1 | LTTng Flight Recorder Snapshot HOWTO |
| 2 | |
| 3 | Mathieu Desnoyers |
| 4 | July 21st, 2013 |
| 5 | |
| 6 | This document presents how to use the snapshot feature of LTTng. |
| 7 | |
| 8 | Snapshots allow to grab the content of flight recorder tracing buffers |
| 9 | at the time the snapshot record command is invoked. Flight recorder |
| 10 | tracing gather trace data in memory, overwriting the oldest information, |
| 11 | without requiring any disk I/O. The snapshot record command exports the |
| 12 | snapshot to the destination specified by the user. |
| 13 | |
| 14 | Basic usage: |
| 15 | |
| 16 | Session daemon started as root for kernel tracing: |
| 17 | |
| 18 | # lttng-sessiond -d |
| 19 | |
| 20 | From a user part of the tracing group (for kernel tracing): |
| 21 | |
| 22 | $ lttng create --snapshot |
| 23 | $ lttng enable-event -k -a # enable kernel tracing |
| 24 | $ lttng enable-event -u -a # enable user-space tracing |
| 25 | $ lttng start |
| 26 | |
| 27 | [ do something, generate activity on the system ] |
| 28 | |
| 29 | $ lttng snapshot record |
| 30 | |
| 31 | [ do more stuff... ] |
| 32 | |
| 33 | $ lttng snapshot record |
| 34 | |
| 35 | $ lttng stop |
| 36 | $ lttng destroy |
| 37 | |
| 38 | Each "lttng snapshot" command records a snapshot of the current buffer |
| 39 | state. "lttng enable --snapshot" automatically setups the buffers in |
| 40 | overwrite mode for flight recording, and does not attach any output file |
| 41 | to the trace. The "lttng snapshot record" command can be performed |
| 42 | either while tracing is started or stopped. |
| 43 | |
| 44 | As an example, this generates the following hierarchy under the |
| 45 | directory reported by the "create" command above: |
| 46 | |
| 47 | . |
| 48 | ├── snapshot-1-20130721-141838-0 |
| 49 | │ ├── kernel |
| 50 | │ │ ├── channel0_0 |
| 51 | │ │ ├── channel0_1 |
| 52 | │ │ ├── channel0_2 |
| 53 | │ │ ├── channel0_3 |
| 54 | │ │ └── metadata |
| 55 | │ └── ust |
| 56 | │ └── uid |
| 57 | │ └── 1000 |
| 58 | │ └── 64-bit |
| 59 | │ ├── channel0_0 |
| 60 | │ ├── channel0_1 |
| 61 | │ ├── channel0_2 |
| 62 | │ ├── channel0_3 |
| 63 | │ └── metadata |
| 64 | └── snapshot-1-20130721-141842-1 |
| 65 | ├── kernel |
| 66 | │ ├── channel0_0 |
| 67 | │ ├── channel0_1 |
| 68 | │ ├── channel0_2 |
| 69 | │ ├── channel0_3 |
| 70 | │ └── metadata |
| 71 | └── ust |
| 72 | └── uid |
| 73 | └── 1000 |
| 74 | └── 64-bit |
| 75 | ├── channel0_0 |
| 76 | ├── channel0_1 |
| 77 | ├── channel0_2 |
| 78 | ├── channel0_3 |
| 79 | └── metadata |
| 80 | |
| 81 | |
| 82 | Then, running babeltrace on, e.g. |
| 83 | |
| 84 | babeltrace snapshot-1-20130721-141838-0 |
| 85 | |
| 86 | shows the content of the first snapshot. |
| 87 | |
| 88 | Please refer to the lttng(1) manpage for details on the snapshot mode. |