Skip to contentSkip to conversation

LTTng snapshot howto

DISCUSSION Mathieu Desnoyers 3 participants 5 messages Jul 21, 2013 – Jul 24, 2013 4 messages not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hi,

I just pushed a LTTng snapshot howto (new feature of lttng 2.3-rc). I'm posting it to lttng-dev, since it provides a quick insight on how to use the snapshot feature. Comments are welcome!

Thanks,

Mathieu

LTTng Flight Recorder Snapshot HOWTO

Mathieu Desnoyers
July 21st, 2013

This document presents how to use the snapshot feature of LTTng.

Snapshots allow to grab the content of flight recorder tracing buffers at the time the snapshot record command is invoked. Flight recorder tracing gather trace data in memory, overwriting the oldest information, without requiring any disk I/O. The snapshot record command exports the snapshot to the destination specified by the user.

Basic usage:

Session daemon started as root for kernel tracing:

# lttng-sessiond -d

From a user part of the tracing group (for kernel tracing):

$ lttng create --snapshot
$ lttng enable-event -k -a      # enable kernel tracing
$ lttng enable-event -u -a      # enable user-space tracing
$ lttng start

[ do something, generate activity on the system ]

$ lttng snapshot record

[ do more stuff... ]

$ lttng snapshot record
$ lttng stop
$ lttng destroy

Each "lttng snapshot" command records a snapshot of the current buffer state. "lttng enable --snapshot" automatically setups the buffers in overwrite mode for flight recording, and does not attach any output file to the trace. The "lttng snapshot record" command can be performed either while tracing is started or stopped.

As an example, this generates the following hierarchy under the directory reported by the "create" command above:

.

├── snapshot-1-20130721-141838-0
│   ├── kernel
│   │   ├── channel0_0
│   │   ├── channel0_1
│   │   ├── channel0_2
│   │   ├── channel0_3
│   │   └── metadata
│   └── ust
│       └── uid
│           └── 1000
│               └── 64-bit
│                   ├── channel0_0
│                   ├── channel0_1
│                   ├── channel0_2
│                   ├── channel0_3
│                   └── metadata
└── snapshot-1-20130721-141842-1
    ├── kernel
    │   ├── channel0_0
    │   ├── channel0_1
    │   ├── channel0_2
    │   ├── channel0_3
    │   └── metadata
    └── ust
        └── uid
            └── 1000
                └── 64-bit
                    ├── channel0_0
                    ├── channel0_1
                    ├── channel0_2
                    ├── channel0_3
                    └── metadata

Then, running babeltrace on, e.g.

babeltrace snapshot-1-20130721-141838-0

shows the content of the first snapshot.

Please refer to the lttng(1) manpage for details on the snapshot mode.

Signature · 8 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#3 lore raw
In reply to a message not in the archive

Hi Mathieu,

Can you explain how the snapshot record works. Is it going to dump the whole buffer even if the same buffer is dumped before.
How to do something like "tail -f" to the buffer.

Thanks,
/Yin

Quoted 105 lines · Mathieu Desnoyers

Hi,

I just pushed a LTTng snapshot howto (new feature of lttng 2.3-rc). I'm posting it to lttng-dev, since it provides a quick insight on how to use the snapshot feature. Comments are welcome!

Thanks,

Mathieu

LTTng Flight Recorder Snapshot HOWTO

Mathieu Desnoyers
July 21st, 2013

This document presents how to use the snapshot feature of LTTng.

Snapshots allow to grab the content of flight recorder tracing buffers at the time the snapshot record command is invoked. Flight recorder tracing gather trace data in memory, overwriting the oldest information, without requiring any disk I/O. The snapshot record command exports the snapshot to the destination specified by the user.

Basic usage:

Session daemon started as root for kernel tracing:

# lttng-sessiond -d

From a user part of the tracing group (for kernel tracing):

$ lttng create --snapshot
$ lttng enable-event -k -a      # enable kernel tracing
$ lttng enable-event -u -a      # enable user-space tracing
$ lttng start

[ do something, generate activity on the system ]

$ lttng snapshot record

[ do more stuff... ]

$ lttng snapshot record
$ lttng stop
$ lttng destroy

Each "lttng snapshot" command records a snapshot of the current buffer state. "lttng enable --snapshot" automatically setups the buffers in overwrite mode for flight recording, and does not attach any output file to the trace. The "lttng snapshot record" command can be performed either while tracing is started or stopped.

As an example, this generates the following hierarchy under the directory reported by the "create" command above:

.

├── snapshot-1-20130721-141838-0
│   ├── kernel
│   │   ├── channel0_0
│   │   ├── channel0_1
│   │   ├── channel0_2
│   │   ├── channel0_3
│   │   └── metadata
│   └── ust
│       └── uid
│           └── 1000
│               └── 64-bit
│                   ├── channel0_0
│                   ├── channel0_1
│                   ├── channel0_2
│                   ├── channel0_3
│                   └── metadata
└── snapshot-1-20130721-141842-1
    ├── kernel
    │   ├── channel0_0
    │   ├── channel0_1
    │   ├── channel0_2
    │   ├── channel0_3
    │   └── metadata
    └── ust
        └── uid
            └── 1000
                └── 64-bit
                    ├── channel0_0
                    ├── channel0_1
                    ├── channel0_2
                    ├── channel0_3
                    └── metadata

Then, running babeltrace on, e.g.

babeltrace snapshot-1-20130721-141838-0

shows the content of the first snapshot.

Please refer to the lttng(1) manpage for details on the snapshot mode.

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

Quoted 5 lines

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

#5 lore raw
In reply to a message not in the archive
Quoted 4 lines · * yin sun ([email protected]) wrote:

Hi Mathieu,

Can you explain how the snapshot record works. Is it going to dump the whole buffer even if the same buffer is dumped before.

Yes, it is going to dump everything that is still available from the buffer (not overwritten). If you want to grab less data, you can also use lttng snapshot add-output to set the maximum size of each snapshot (see lttng(1) for details).

Quoted 1 line

How to do something like "tail -f" to the buffer.

So if I understand correctly, you would like the second snapshot not to gather data from the previous snapshot (no repeated events). Am I correct ?

Unfortunately, this is not yet implemented in lttng-tools, but I can definitely see how this could be useful! You might want to file a feature request on bugs.lttng.org for it.

Thanks,

Mathieu

Quoted 118 lines

Thanks,
/Yin

Quoted 110 lines · Mathieu Desnoyers

Hi,

I just pushed a LTTng snapshot howto (new feature of lttng 2.3-rc). I'm posting it to lttng-dev, since it provides a quick insight on how to use the snapshot feature. Comments are welcome!

Thanks,

Mathieu

LTTng Flight Recorder Snapshot HOWTO

Mathieu Desnoyers
July 21st, 2013

This document presents how to use the snapshot feature of LTTng.

Snapshots allow to grab the content of flight recorder tracing buffers at the time the snapshot record command is invoked. Flight recorder tracing gather trace data in memory, overwriting the oldest information, without requiring any disk I/O. The snapshot record command exports the snapshot to the destination specified by the user.

Basic usage:

Session daemon started as root for kernel tracing:

# lttng-sessiond -d

From a user part of the tracing group (for kernel tracing):

$ lttng create --snapshot
$ lttng enable-event -k -a      # enable kernel tracing
$ lttng enable-event -u -a      # enable user-space tracing
$ lttng start

[ do something, generate activity on the system ]

$ lttng snapshot record

[ do more stuff... ]

$ lttng snapshot record
$ lttng stop
$ lttng destroy

Each "lttng snapshot" command records a snapshot of the current buffer state. "lttng enable --snapshot" automatically setups the buffers in overwrite mode for flight recording, and does not attach any output file to the trace. The "lttng snapshot record" command can be performed either while tracing is started or stopped.

As an example, this generates the following hierarchy under the directory reported by the "create" command above:

.

├── snapshot-1-20130721-141838-0
│   ├── kernel
│   │   ├── channel0_0
│   │   ├── channel0_1
│   │   ├── channel0_2
│   │   ├── channel0_3
│   │   └── metadata
│   └── ust
│       └── uid
│           └── 1000
│               └── 64-bit
│                   ├── channel0_0
│                   ├── channel0_1
│                   ├── channel0_2
│                   ├── channel0_3
│                   └── metadata
└── snapshot-1-20130721-141842-1
    ├── kernel
    │   ├── channel0_0
    │   ├── channel0_1
    │   ├── channel0_2
    │   ├── channel0_3
    │   └── metadata
    └── ust
        └── uid
            └── 1000
                └── 64-bit
                    ├── channel0_0
                    ├── channel0_1
                    ├── channel0_2
                    ├── channel0_3
                    └── metadata

Then, running babeltrace on, e.g.

babeltrace snapshot-1-20130721-141838-0

shows the content of the first snapshot.

Please refer to the lttng(1) manpage for details on the snapshot mode.

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 8 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#6 lore raw
In reply to a message not in the archive

A question about the snapshot: is there a way to trigger a new state dump? Le 2013-07-21 14:29, "Mathieu Desnoyers" <[email protected]> a écrit :

Quoted 105 lines

Hi,

I just pushed a LTTng snapshot howto (new feature of lttng 2.3-rc). I'm posting it to lttng-dev, since it provides a quick insight on how to use the snapshot feature. Comments are welcome!

Thanks,

Mathieu

LTTng Flight Recorder Snapshot HOWTO

Mathieu Desnoyers
July 21st, 2013

This document presents how to use the snapshot feature of LTTng.

Snapshots allow to grab the content of flight recorder tracing buffers at the time the snapshot record command is invoked. Flight recorder tracing gather trace data in memory, overwriting the oldest information, without requiring any disk I/O. The snapshot record command exports the snapshot to the destination specified by the user.

Basic usage:

Session daemon started as root for kernel tracing:

# lttng-sessiond -d

From a user part of the tracing group (for kernel tracing):

$ lttng create --snapshot
$ lttng enable-event -k -a      # enable kernel tracing
$ lttng enable-event -u -a      # enable user-space tracing
$ lttng start

[ do something, generate activity on the system ]

$ lttng snapshot record

[ do more stuff... ]

$ lttng snapshot record
$ lttng stop
$ lttng destroy

Each "lttng snapshot" command records a snapshot of the current buffer state. "lttng enable --snapshot" automatically setups the buffers in overwrite mode for flight recording, and does not attach any output file to the trace. The "lttng snapshot record" command can be performed either while tracing is started or stopped.

As an example, this generates the following hierarchy under the directory reported by the "create" command above:

.

├── snapshot-1-20130721-141838-0
│   ├── kernel
│   │   ├── channel0_0
│   │   ├── channel0_1
│   │   ├── channel0_2
│   │   ├── channel0_3
│   │   └── metadata
│   └── ust
│       └── uid
│           └── 1000
│               └── 64-bit
│                   ├── channel0_0
│                   ├── channel0_1
│                   ├── channel0_2
│                   ├── channel0_3
│                   └── metadata
└── snapshot-1-20130721-141842-1
    ├── kernel
    │   ├── channel0_0
    │   ├── channel0_1
    │   ├── channel0_2
    │   ├── channel0_3
    │   └── metadata
    └── ust
        └── uid
            └── 1000
                └── 64-bit
                    ├── channel0_0
                    ├── channel0_1
                    ├── channel0_2
                    ├── channel0_3
                    └── metadata

Then, running babeltrace on, e.g.

babeltrace snapshot-1-20130721-141838-0

shows the content of the first snapshot.

Please refer to the lttng(1) manpage for details on the snapshot mode.

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

Quoted 5 lines

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

#8 lore raw
In reply to a message not in the archive
Quoted 1 line · * Brosseau, Yannick ([email protected]) wrote:

A question about the snapshot: is there a way to trigger a new state dump?

Not at this point, no.

Quoted 113 lines

Le 2013-07-21 14:29, "Mathieu Desnoyers" <[email protected]> a écrit :

Quoted 110 lines

Hi,

I just pushed a LTTng snapshot howto (new feature of lttng 2.3-rc). I'm posting it to lttng-dev, since it provides a quick insight on how to use the snapshot feature. Comments are welcome!

Thanks,

Mathieu

LTTng Flight Recorder Snapshot HOWTO

Mathieu Desnoyers
July 21st, 2013

This document presents how to use the snapshot feature of LTTng.

Snapshots allow to grab the content of flight recorder tracing buffers at the time the snapshot record command is invoked. Flight recorder tracing gather trace data in memory, overwriting the oldest information, without requiring any disk I/O. The snapshot record command exports the snapshot to the destination specified by the user.

Basic usage:

Session daemon started as root for kernel tracing:

# lttng-sessiond -d

From a user part of the tracing group (for kernel tracing):

$ lttng create --snapshot
$ lttng enable-event -k -a      # enable kernel tracing
$ lttng enable-event -u -a      # enable user-space tracing
$ lttng start

[ do something, generate activity on the system ]

$ lttng snapshot record

[ do more stuff... ]

$ lttng snapshot record
$ lttng stop
$ lttng destroy

Each "lttng snapshot" command records a snapshot of the current buffer state. "lttng enable --snapshot" automatically setups the buffers in overwrite mode for flight recording, and does not attach any output file to the trace. The "lttng snapshot record" command can be performed either while tracing is started or stopped.

As an example, this generates the following hierarchy under the directory reported by the "create" command above:

.

├── snapshot-1-20130721-141838-0
│   ├── kernel
│   │   ├── channel0_0
│   │   ├── channel0_1
│   │   ├── channel0_2
│   │   ├── channel0_3
│   │   └── metadata
│   └── ust
│       └── uid
│           └── 1000
│               └── 64-bit
│                   ├── channel0_0
│                   ├── channel0_1
│                   ├── channel0_2
│                   ├── channel0_3
│                   └── metadata
└── snapshot-1-20130721-141842-1
    ├── kernel
    │   ├── channel0_0
    │   ├── channel0_1
    │   ├── channel0_2
    │   ├── channel0_3
    │   └── metadata
    └── ust
        └── uid
            └── 1000
                └── 64-bit
                    ├── channel0_0
                    ├── channel0_1
                    ├── channel0_2
                    ├── channel0_3
                    └── metadata

Then, running babeltrace on, e.g.

babeltrace snapshot-1-20130721-141838-0

shows the content of the first snapshot.

Please refer to the lttng(1) manpage for details on the snapshot mode.

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 8 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev