Update documentation for new ustctl cli
[ust.git] / doc / man / ustctl.1.md
... / ...
CommitLineData
1ustctl(1) -- a program to control the tracing of userspace applications
2=======================================================================
3
4## SYNOPSIS
5
6`ustctl` [<COMMAND>] [<ARGS>]...
7
8## DESCRIPTION
9
10`ustctl` is a program to control the tracing of userspace applications. It can
11list markers, start the tracing, stop the tracing, enable/disable markers, etc.
12
13## OPTIONS
14
15These programs follow the usual GNU command line syntax, with long options
16starting with two dashes(`-'). A summary of options is included below.
17
18 * `-h`, `--help`:
19 Show summary of commands.
20
21## COMMANDS
22
23`ustctl` accepts commands followed by arguments for each respective command.
24Most commands require the pid of the application being traced.
25
26 * `create-trace` <PID> <TRACE>:
27 Create trace.
28
29 * `alloc-trace` <PID> <TRACE>:
30 Allocate trace.
31
32 * `start-trace` <PID> <TRACE>:
33 Start tracing.
34
35 * `stop-trace` <PID> <TRACE>:
36 Stop tracing.
37
38 * `destroy-trace` <PID> <TRACE>:
39 Destroy the trace.
40
41 * `set-subbuf-size` <PID> <TRACE> <CHANNEL>/<bytes>:
42 Set the size of subbuffers in CHANNEL.
43
44 * `set-subbuf-num` <PID> <TRACE> <CHANNEL>/<nr>:
45 Set the number of subbuffers per buffer for CHANNEL. Must be a power of 2.
46
47 * `set-sock-path` <PID> <SOCKPATH>:
48 Set the path of the daemon socket.
49
50 * `get-subbuf-size` <PID> <TRACE> <CHANNEL>:
51 Print the size of subbuffers per buffer for CHANNEL.
52
53 * `get-subbuf-num` <PID> <TRACE> <CHANNEL>:
54 Print the number of subbuffers per buffer for CHANNEL.
55
56 * `get-sock-path` <PID>:
57 Get the path of the daemon socket.
58
59 * `enable-marker` <PID> <TRACE> <CHANNEL>/<MARKER>:
60 Enable a marker.
61
62 * `disable-marker` <PID> <TRACE> <CHANNEL>/<MARKER>:
63 Disable a marker.
64
65 * `list-markers` <PID>:
66 List the markers of the process, their state and format string.
67
68 * `force-subbuf-switch` <PID> <TRACE>:
69 Force a subbuffer switch. This will flush all the data currently held.
70
71## LIFE CYCLE OF A TRACE
72
73Typically, the first step is to enable markers with `enable-marker`. An
74enabled marker generates an event when the control flow passes over it
75(assuming the trace is recording). A disabled marker produces nothing. Enabling
76and disabling markers may however be done at any point, including while the
77trace is being recorded.
78
79In order to record events, a trace is first created with `create-trace`. At
80this point, the subbuffer count and size may be changed with `set-subbuf-num`
81and `set-subbuf-size`.
82
83Afterward, the trace may be allocated with `alloc-trace`. This allocates the
84buffers in memory, so once this is done, the subbuffer size and count can not
85be changed. Trace allocation also causes the daemon to connect to the trace
86buffers and wait for data to arrive. Explicit allocation is optional, as it is
87done automatically at trace start.
88
89The trace may then be started with `start-trace`. This results in events
90being recorded in the buffer. The daemon automatically collects these events.
91
92The trace may be stopped with `stop-trace`, either definitely after all the
93wanted information is collected, or temporarily, before being started again
94with `start-trace`. This results in effectively 'pausing' the recording.
95After using `stop-trace`, if a daemon is collecting the trace, it may not
96have flushed to the disk the full contents of the buffer yet.
97
98Finally, when `destroy-trace` is used, the trace buffers are unallocated.
99However, the memory may not be effectively freed until the daemon finishes to
100collect them. When the trace is being collected by `ust-consumerd`, this command
101guarantees its full contents is flushed to the disk.
102
103## STRUCTURE OF A TRACE
104
105Each instrumentation point that is added in a program is associated to a
106channel.
107
108Trace events are put in buffers. There is one buffer per channel, per cpu.
109For example, on a system with 4 cores and tracing an application with 3
110channels, there will be 12 buffers in total. The content of each of these
111buffers is put in a distinct file in the trace directory. For example, the
112`metadata_2` file contains the data that was extracted from the buffer that
113contained the events from the metadata channel and having occurred on cpu 2.
114
115In memory, each buffer is divided in subbuffers. Subbuffers are equally-sized,
116contiguous parts of a buffer. The size of a buffer is equal to the number of
117subbuffers it contains times the size of each subbuffer. When a subbuffer is
118full, it is collected by the daemon while the others are filled. If, however,
119the buffer size is too small, buffer overflows may occur and result in event
120loss. By default, the number of subbuffers per buffer is 2. Subbuffer size
121for a given channel may be chosen with `set-subbuf-size` while the subbuffer
122count is set with `set-subbuf-num`.
123
124## SEE ALSO
125
126usttrace(1), ust-consumerd(1)
127
128## AUTHOR
129
130`ustctl` was written by Pierre-Marc Fournier.
131
132This manual page was written by Jon Bernard &lt;jbernard@debian.org&gt;, for
133the Debian project (and may be used by others). It was updated by Pierre-Marc
134Fournier.
This page took 0.02233 seconds and 4 git commands to generate.