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