bag-play

Synopsis

bag-play [OPTIONS] LOGFILE [URI]

Description

The bag-play program can be used to publish RSB event s from a log file of recorded event s. Replaying event flows as closely to the original as possible or with certain modifications can be very useful when debugging components, doing performance or regressions tests or testing the influence of parameters.

See also

Common Commandline Options
The usual RSB-related commandline options are accepted.
replay-related-options
The usual replay-related commandline options are accepted.

Playback of All Recorded Channels

To play all recorded events of a log file on their original channel s, two commandline arguments have to be specified:

  1. The log file from which event s should be read
  2. The “base” scope to which event s should be published

For details regarding the URI syntax involved in transport and channel specifications, see URIs.

Selective Playback and Timing

The default behavior of bag-play is to play back all channel s found in the given file. However, when only a subset of the recorded channel s should be played back, the --channel commandline option can be used to select channel s for playback.

The default behavior of bag-play is to play back all event s of the selected channels ordered by timestamp, from earliest to latest. However, it is possible to select a subset of these event s by specifying temporal or index-based intervals. The --start-index, --end-index, --start-time and --end-time commandline options allow specifying these restrictions.

Different strategies for controlling the replay timing can be used. Strategies and their parameters are specified using the --replay-strategy commandline option. The default replay strategy tries to mimic the original timing.

Other strategies include

  • Replay events as fast as possible
  • Replay events at a fixed rate

In addition, some strategies permit modification of their behavior via parameters. For example

-r 'fixed-rate :rate 20'
-r 'recorded-timing :speed 1.5'

Tip

Available strategies and their parameters are described in the output of bag-play --help.

Interactive Playback

TODO

-r 'interactive'

Remote-controlled Playback

bag-play can expose an RPC interface that allows navigating the bag file being played back and controlling emission of event s. An URI has to be supplied as the :uri argument of the --replay-strategy option to configure the scope and transport through which the RPC interface should be exposed. The full syntax of the commandline option therefore is

-r 'remote-controlled :uri "URI"'

The interface consists of the following methods:

length()
Returns uint64:length of the replayed sequence

Return the length of the replayed sequence.

index()
Returns uint64:current position in the replayed sequence

Return the current position in the replayed sequence.

next()
Returns uint64:new index

Move the replay cursor to the next entry.

previous()
Returns uint64:new index

Move the replay cursor to the previous entry.

seek()
Arguments:
  • position (uint64) – new replay cursor position.

Position the replay cursor at position.

emit()

Publish the entry at which the replay cursor is currently positioned.

emitandnext()
Returns uint64:new index

Publish the entry at which the replay cursor is currently positioned, advance to the next entry.

get()
Returns bytes:the serialized entry

Return the entry at which the replay cursor is currently positioned. Do not emit or change anything.

quit()

Terminate the replay.

Examples

  • $ bag-play /tmp/nao.tide 'spread://remote:4803'
    

    In the above example, the specified scope is / which causes all event s to be played on their original scope s since recorded event scope s are appended to the specified base scope.

  • $ bag-play -c 'vision' -c 'audio' /tmp/nao.tide 'spread:?name=5555'
    

    The above command plays all channel s of the log file /tmp/nao.tide whose names match one of the regular expressions vision and audio.

  • $ bag-play --start-index 1000 /tmp/nao.tide 'spread:?name=5555'
    

    The above command replays the event s of the log file /tmp/nao.tide starting with the 1000-th event.