Commit | Line | Data |
---|---|---|
276c17e7 BH |
1 | /********************************************************************** |
2 | * Copyright (c) 2012 Ericsson | |
cfdb727a | 3 | * |
276c17e7 BH |
4 | * All rights reserved. This program and the accompanying materials are |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
cfdb727a AM |
8 | * |
9 | * Contributors: | |
276c17e7 BH |
10 | * Bernd Hufmann - Initial API and implementation |
11 | **********************************************************************/ | |
12 | package org.eclipse.linuxtools.internal.lttng2.ui.views.control.service; | |
13 | ||
14 | import java.util.regex.Pattern; | |
15 | ||
16 | /** | |
276c17e7 BH |
17 | * <p> |
18 | * Constants for LTTng Control Service. | |
19 | * </p> | |
cfdb727a | 20 | * |
dbd4432d | 21 | * @author Bernd Hufmann |
276c17e7 BH |
22 | */ |
23 | public class LTTngControlServiceConstants { | |
24 | ||
25 | // ------------------------------------------------------------------------ | |
26 | // Version constants | |
27 | // ------------------------------------------------------------------------ | |
cfdb727a | 28 | /** |
cfe737e4 | 29 | * Pattern to match the LTTng toolchain version 2.x.y. |
cfdb727a | 30 | */ |
cfe737e4 | 31 | public final static Pattern VERSION_2_PATTERN = Pattern.compile("(2\\.\\d+\\.\\d+).*"); //$NON-NLS-1$ |
276c17e7 BH |
32 | |
33 | // ------------------------------------------------------------------------ | |
34 | // Command constants | |
35 | // ------------------------------------------------------------------------ | |
36 | /** | |
37 | * The lttng tools command. | |
38 | */ | |
39 | public final static String CONTROL_COMMAND = "lttng"; //$NON-NLS-1$ | |
40 | /** | |
41 | * Command: lttng version. | |
42 | */ | |
43 | public final static String COMMAND_VERSION = " version "; //$NON-NLS-1$ | |
44 | /** | |
45 | * Command: lttng list. | |
46 | */ | |
47 | public final static String COMMAND_LIST = " list "; //$NON-NLS-1$ | |
48 | /** | |
49 | * Command to list kernel tracer information. | |
50 | */ | |
51 | public final static String COMMAND_LIST_KERNEL = COMMAND_LIST + "-k"; //$NON-NLS-1$ | |
52 | /** | |
53 | * Command to list user space trace information. | |
54 | */ | |
55 | public final static String COMMAND_LIST_UST = COMMAND_LIST + "-u"; //$NON-NLS-1$ | |
56 | /** | |
cfdb727a | 57 | * Command to create a session. |
276c17e7 BH |
58 | */ |
59 | public final static String COMMAND_CREATE_SESSION = " create "; //$NON-NLS-1$ | |
60 | /** | |
cfdb727a | 61 | * Command to destroy a session. |
276c17e7 BH |
62 | */ |
63 | public final static String COMMAND_DESTROY_SESSION = " destroy "; //$NON-NLS-1$ | |
64 | /** | |
cfdb727a | 65 | * Command to destroy a session. |
276c17e7 BH |
66 | */ |
67 | public final static String COMMAND_START_SESSION = " start "; //$NON-NLS-1$ | |
68 | /** | |
cfdb727a | 69 | * Command to destroy a session. |
276c17e7 BH |
70 | */ |
71 | public final static String COMMAND_STOP_SESSION = " stop "; //$NON-NLS-1$ | |
72 | /** | |
cfdb727a | 73 | * Command to enable a channel. |
276c17e7 BH |
74 | */ |
75 | public final static String COMMAND_ENABLE_CHANNEL = " enable-channel "; //$NON-NLS-1$ | |
76 | /** | |
cfdb727a | 77 | * Command to disable a channel. |
276c17e7 BH |
78 | */ |
79 | public final static String COMMAND_DISABLE_CHANNEL = " disable-channel "; //$NON-NLS-1$ | |
80 | /** | |
cfdb727a | 81 | * Command to enable a event. |
276c17e7 BH |
82 | */ |
83 | public final static String COMMAND_ENABLE_EVENT = " enable-event "; //$NON-NLS-1$ | |
84 | /** | |
cfdb727a | 85 | * Command to disable a event. |
276c17e7 BH |
86 | */ |
87 | public final static String COMMAND_DISABLE_EVENT = " disable-event "; //$NON-NLS-1$ | |
88 | /** | |
89 | * Command to add a context to channels and/or events | |
90 | */ | |
91 | public final static String COMMAND_ADD_CONTEXT = " add-context "; //$NON-NLS-1$ | |
92 | /** | |
93 | * Command to execute calibrate command to quantify LTTng overhead | |
94 | */ | |
95 | public final static String COMMAND_CALIBRATE = " calibrate "; //$NON-NLS-1$ | |
96 | ||
97 | // ------------------------------------------------------------------------ | |
98 | // Command line options constants | |
99 | // ------------------------------------------------------------------------ | |
100 | /** | |
101 | * Command line option to add tracing group of user. | |
102 | */ | |
103 | public final static String OPTION_TRACING_GROUP = " -g "; //$NON-NLS-1$ | |
104 | /** | |
105 | * Command line option for verbose output. | |
106 | */ | |
107 | public final static String OPTION_VERBOSE = " -v "; //$NON-NLS-1$ | |
108 | /** | |
109 | * Command line option for verbose output. | |
110 | */ | |
111 | public final static String OPTION_VERY_VERBOSE = " -vv "; //$NON-NLS-1$ | |
112 | /** | |
113 | * Command line option for verbose output. | |
114 | */ | |
115 | public final static String OPTION_VERY_VERY_VERBOSE = " -vvv "; //$NON-NLS-1$ | |
116 | /** | |
117 | * Command line option for output path. | |
118 | */ | |
119 | public final static String OPTION_OUTPUT_PATH = " -o "; //$NON-NLS-1$ | |
120 | /** | |
121 | * Command line option for kernel tracer. | |
122 | */ | |
123 | public final static String OPTION_KERNEL = " -k "; //$NON-NLS-1$ | |
124 | /** | |
125 | * Command line option for UST tracer. | |
126 | */ | |
127 | public final static String OPTION_UST = " -u "; //$NON-NLS-1$ | |
128 | /** | |
129 | * Command line option for specifying a session. | |
130 | */ | |
131 | public final static String OPTION_SESSION = " -s "; //$NON-NLS-1$ | |
132 | /** | |
133 | * Command line option for specifying a channel. | |
134 | */ | |
135 | public final static String OPTION_CHANNEL = " -c "; //$NON-NLS-1$ | |
136 | /** | |
137 | * Command line option for specifying a event. | |
138 | */ | |
139 | public final static String OPTION_EVENT = " -e "; //$NON-NLS-1$ | |
140 | /** | |
141 | * Command line option for specifying all events. | |
142 | */ | |
143 | public final static String OPTION_ALL = " -a "; //$NON-NLS-1$ | |
144 | /** | |
145 | * Command line option for specifying a context. | |
146 | */ | |
147 | public final static String OPTION_CONTEXT_TYPE = " -t "; //$NON-NLS-1$ | |
148 | /** | |
149 | * Command line option for specifying tracepoint events. | |
150 | */ | |
151 | public final static String OPTION_TRACEPOINT = " --tracepoint "; //$NON-NLS-1$ | |
152 | /** | |
153 | * Command line option for specifying syscall events. | |
154 | */ | |
155 | public final static String OPTION_SYSCALL = " --syscall "; //$NON-NLS-1$ | |
156 | /** | |
157 | * Command line option for specifying a dynamic probe. | |
158 | */ | |
159 | public final static String OPTION_PROBE = " --probe "; //$NON-NLS-1$ | |
160 | /** | |
161 | * Command line option for specifying a dynamic function entry/return probe. | |
162 | */ | |
163 | public final static String OPTION_FUNCTION_PROBE = " --function "; //$NON-NLS-1$ | |
164 | /** | |
165 | * Command line option for specifying a log level range. | |
166 | */ | |
167 | public final static String OPTION_LOGLEVEL = " --loglevel "; //$NON-NLS-1$ | |
168 | /** | |
169 | * Command line option for specifying a specific log level. | |
170 | */ | |
171 | public final static String OPTION_LOGLEVEL_ONLY = " --loglevel-only "; //$NON-NLS-1$ | |
172 | /** | |
173 | * Optional command line option for configuring a channel's overwrite mode. | |
174 | */ | |
cfdb727a | 175 | public final static String OPTION_OVERWRITE = " --overwrite "; //$NON-NLS-1$ |
276c17e7 BH |
176 | /** |
177 | * Optional command line option for configuring a channel's number of sub buffers. | |
178 | */ | |
179 | public final static String OPTION_NUM_SUB_BUFFERS = " --num-subbuf "; //$NON-NLS-1$ | |
180 | /** | |
181 | * Optional command line option for configuring a channel's sub buffer size. | |
182 | */ | |
183 | public final static String OPTION_SUB_BUFFER_SIZE = " --subbuf-size "; //$NON-NLS-1$ | |
184 | /** | |
185 | * Optional command line option for configuring a channel's switch timer interval. | |
186 | */ | |
187 | public final static String OPTION_SWITCH_TIMER = " --switch-timer "; //$NON-NLS-1$ | |
188 | /** | |
189 | * Optional command line option for configuring a channel's read timer interval. | |
190 | */ | |
191 | public final static String OPTION_READ_TIMER = " --read-timer "; //$NON-NLS-1$ | |
192 | /** | |
cfdb727a | 193 | * Command line option for printing the help of a specif command |
276c17e7 BH |
194 | */ |
195 | public final static String OPTION_HELP = " -h "; //$NON-NLS-1$ | |
d4514365 BH |
196 | /** |
197 | * Command line option for listing the fields of UST tracepoints | |
198 | */ | |
199 | public final static String OPTION_FIELDS = " -f "; //$NON-NLS-1$ | |
200 | /** | |
201 | * Command line option for configuring event's filter | |
202 | */ | |
203 | public final static String OPTION_FILTER = " --filter "; //$NON-NLS-1$ | |
204 | ||
276c17e7 BH |
205 | |
206 | // ------------------------------------------------------------------------ | |
207 | // Parsing constants | |
208 | // ------------------------------------------------------------------------ | |
209 | /** | |
210 | * Pattern to match the version. | |
211 | */ | |
d6fc6e1b | 212 | public final static Pattern VERSION_PATTERN = Pattern.compile(".*lttng\\s+version\\s+(\\d+\\.\\d+\\.\\d+).*"); //$NON-NLS-1$ |
276c17e7 BH |
213 | /** |
214 | * Pattern to match for error output | |
215 | */ | |
216 | public final static Pattern ERROR_PATTERN = Pattern.compile("\\s*Error\\:.*"); //$NON-NLS-1$ | |
217 | /** | |
218 | * Pattern to match for session information (lttng list) | |
219 | */ | |
220 | public final static Pattern SESSION_PATTERN = Pattern.compile("\\s+(\\d+)\\)\\s+(.*)\\s+\\((.*)\\)\\s+\\[(active|inactive)\\].*"); //$NON-NLS-1$ | |
221 | /** | |
222 | * Pattern to match for session information (lttng list <session>) | |
223 | */ | |
224 | public final static Pattern TRACE_SESSION_PATTERN = Pattern.compile("\\s*Tracing\\s+session\\s+(.*)\\:\\s+\\[(active|inactive)\\].*"); //$NON-NLS-1$ | |
225 | /** | |
226 | * Pattern to match for session path information (lttng list <session>) | |
227 | */ | |
228 | public final static Pattern TRACE_SESSION_PATH_PATTERN = Pattern.compile("\\s*Trace\\s+path\\:\\s+(.*)"); //$NON-NLS-1$ | |
229 | /** | |
230 | * Pattern to match for kernel domain information (lttng list <session>) | |
231 | */ | |
232 | public final static Pattern DOMAIN_KERNEL_PATTERN = Pattern.compile("=== Domain: Kernel ==="); //$NON-NLS-1$ | |
233 | /** | |
234 | * Pattern to match for ust domain information (lttng list <session>) | |
235 | */ | |
236 | public final static Pattern DOMAIN_UST_GLOBAL_PATTERN = Pattern.compile("=== Domain: UST global ==="); //$NON-NLS-1$ | |
237 | /** | |
238 | * Pattern to match for channels section (lttng list <session>) | |
239 | */ | |
240 | public final static Pattern CHANNELS_SECTION_PATTERN = Pattern.compile("\\s*Channels\\:"); //$NON-NLS-1$ | |
241 | /** | |
242 | * Pattern to match for channel information (lttng list <session>) | |
243 | */ | |
244 | public final static Pattern CHANNEL_PATTERN = Pattern.compile("\\s*-\\s+(.*)\\:\\s+\\[(enabled|disabled)\\]"); //$NON-NLS-1$ | |
245 | /** | |
246 | * Pattern to match for events section information (lttng list <session>) | |
247 | */ | |
248 | public final static Pattern EVENT_SECTION_PATTERN = Pattern.compile("\\s*Events\\:"); //$NON-NLS-1$ | |
249 | /** | |
250 | * Pattern to match for event information (no enabled events) (lttng list <session>) | |
251 | */ | |
252 | // public final static String EVENT_NONE_PATTERN = "\\s+None"; //$NON-NLS-1$ | |
253 | /** | |
254 | * Pattern to match for event information (lttng list <session>) | |
255 | */ | |
d4514365 | 256 | public final static Pattern EVENT_PATTERN = Pattern.compile("\\s+(.*)\\s+\\(loglevel:\\s+(.*)\\s+\\(\\d*\\)\\)\\s+\\(type:\\s+(.*)\\)\\s+\\[(enabled|disabled)\\]\\s*(\\[.*\\]){0,1}.*"); //$NON-NLS-1$ |
276c17e7 BH |
257 | /** |
258 | * Pattern to match a wildcarded event information (lttng list <session>) | |
259 | */ | |
d4514365 | 260 | public final static Pattern WILDCARD_EVENT_PATTERN = Pattern.compile("\\s+(.*)\\s+\\(type:\\s+(.*)\\)\\s+\\[(enabled|disabled)\\]\\s*(\\[.*\\]){0,1}.*"); //$NON-NLS-1$ |
276c17e7 BH |
261 | /** |
262 | * Pattern to match a probe address information (lttng list <session>) | |
263 | */ | |
264 | public final static Pattern PROBE_ADDRESS_PATTERN = Pattern.compile("\\s+(addr)\\:\\s+(0x[0-9a-fA-F]{1,8})"); //$NON-NLS-1$ | |
265 | /** | |
266 | * Pattern to match a probe OFFSET information (lttng list <session>) | |
267 | */ | |
268 | public final static Pattern PROBE_OFFSET_PATTERN = Pattern.compile("\\s+(offset)\\:\\s+(0x[0-9a-fA-F]{1,8})"); //$NON-NLS-1$ | |
269 | /** | |
270 | * Pattern to match a probe SYMBOL information (lttng list <session>) | |
271 | */ | |
272 | public final static Pattern PROBE_SYMBOL_PATTERN = Pattern.compile("\\s+(symbol)\\:\\s+(.+)"); //$NON-NLS-1$ | |
273 | /** | |
274 | * Pattern to match for channel (overwite mode) information (lttng list <session>) | |
275 | */ | |
276 | public final static Pattern OVERWRITE_MODE_ATTRIBUTE = Pattern.compile("\\s+overwrite\\s+mode\\:.*"); //$NON-NLS-1$ | |
277 | /** | |
278 | * Pattern to match indicating false for overwrite mode | |
279 | */ | |
280 | public final static String OVERWRITE_MODE_ATTRIBUTE_FALSE = "0"; //$NON-NLS-1$ | |
281 | /** | |
282 | * Pattern to match for channel (sub-buffer size) information (lttng list <session>) | |
283 | */ | |
284 | public final static Pattern SUBBUFFER_SIZE_ATTRIBUTE = Pattern.compile("\\s+subbufers\\s+size\\:.*"); //$NON-NLS-1$ | |
285 | /** | |
286 | * Pattern to match for channel (number of sub-buffers) information (lttng list <session>) | |
287 | */ | |
288 | public final static Pattern NUM_SUBBUFFERS_ATTRIBUTE = Pattern.compile("\\s+number\\s+of\\s+subbufers\\:.*"); //$NON-NLS-1$ | |
289 | /** | |
290 | * Pattern to match for channel (switch timer) information (lttng list <session>) | |
291 | */ | |
292 | public final static Pattern SWITCH_TIMER_ATTRIBUTE = Pattern.compile("\\s+switch\\s+timer\\s+interval\\:.*"); //$NON-NLS-1$ | |
293 | /** | |
294 | * Pattern to match for channel (read timer) information (lttng list <session>) | |
295 | */ | |
296 | public final static Pattern READ_TIMER_ATTRIBUTE = Pattern.compile("\\s+read\\s+timer\\s+interval\\:.*"); //$NON-NLS-1$ | |
297 | /** | |
298 | * Pattern to match for channel (output type) information (lttng list <session>) | |
299 | */ | |
300 | public final static Pattern OUTPUT_ATTRIBUTE = Pattern.compile("\\s+output\\:.*"); //$NON-NLS-1$ | |
301 | /** | |
302 | * Pattern to match for provider information (lttng list -k/-u) | |
303 | */ | |
304 | public final static Pattern PROVIDER_EVENT_PATTERN = Pattern.compile("\\s*(.*)\\s+\\(loglevel:\\s+(.*)\\s+\\(\\d*\\)\\)\\s+\\(type:\\s+(.*)\\)"); //$NON-NLS-1$ | |
d4514365 BH |
305 | /** |
306 | * Pattern to match event fields | |
307 | */ | |
308 | // field: content (string) | |
309 | public final static Pattern EVENT_FIELD_PATTERN = Pattern.compile("\\s*(field:)\\s+(.*)\\s+\\((.*)\\)"); //$NON-NLS-1$ | |
276c17e7 BH |
310 | /** |
311 | * Pattern to match for UST provider information (lttng list -u) | |
312 | */ | |
313 | public final static Pattern UST_PROVIDER_PATTERN = Pattern.compile("\\s*PID\\:\\s+(\\d+)\\s+-\\s+Name\\:\\s+(.*)"); //$NON-NLS-1$ | |
314 | /** | |
315 | * Pattern to match for session information (lttng create <session name>) | |
316 | */ | |
d6fc6e1b | 317 | public final static Pattern CREATE_SESSION_NAME_PATTERN = Pattern.compile(".*Session\\s+(.*)\\s+created\\."); //$NON-NLS-1$ |
276c17e7 BH |
318 | /** |
319 | * Pattern to match for session path information (lttng create <session name>) | |
320 | */ | |
321 | public final static Pattern CREATE_SESSION_PATH_PATTERN = Pattern.compile("\\s*Traces\\s+will\\s+be\\s+written\\s+in\\s+(.*).*"); //$NON-NLS-1$ | |
322 | /** | |
323 | * Pattern to match for session command output for "session name not found". | |
324 | */ | |
325 | public final static Pattern SESSION_NOT_FOUND_ERROR_PATTERN = Pattern.compile("\\s*Error:\\s+Session\\s+name\\s+not\\s+found"); //$NON-NLS-1$ | |
326 | /** | |
327 | * Pattern to match introduction line of context list. | |
328 | */ | |
329 | public final static Pattern ADD_CONTEXT_HELP_CONTEXTS_INTRO = Pattern.compile("\\s*TYPE can\\s+be\\s+one\\s+of\\s+the\\s+strings\\s+below.*"); //$NON-NLS-1$ | |
330 | /** | |
331 | * Pattern to match introduction line of context list. | |
332 | */ | |
333 | public final static Pattern ADD_CONTEXT_HELP_CONTEXTS_END_LINE = Pattern.compile("\\s*Example.*"); //$NON-NLS-1$ | |
a07c7629 BH |
334 | /** |
335 | * Pattern to match error line if no kernel tracer is available or installed. | |
336 | */ | |
337 | public final static Pattern LIST_KERNEL_NO_KERNEL_PROVIDER_PATTERN = Pattern.compile("\\s*Error:\\s+Unable\\s+to\\s+list\\s+kernel\\s+events.*"); //$NON-NLS-1$; | |
276c17e7 | 338 | } |