lttng: Fix not being able to get available context with LTTng 2.8
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.control.ui / src / org / eclipse / tracecompass / internal / lttng2 / control / ui / views / service / LTTngControlServiceConstants.java
1 /**********************************************************************
2 * Copyright (c) 2012, 2015 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Bernd Hufmann - Initial API and implementation
11 * Bernd Hufmann - Updated for support of LTTng Tools 2.1
12 * Simon Delisle - Updated for support of LTTng Tools 2.2
13 * Marc-Andre Laperle - Support for creating a live session
14 **********************************************************************/
15 package org.eclipse.tracecompass.internal.lttng2.control.ui.views.service;
16
17 import java.util.regex.Pattern;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20
21 /**
22 * <p>
23 * Constants for LTTng Control Service.
24 * </p>
25 *
26 * @author Bernd Hufmann
27 */
28 @NonNullByDefault
29 public interface LTTngControlServiceConstants {
30
31 // ------------------------------------------------------------------------
32 // Version constants
33 // ------------------------------------------------------------------------
34 /**
35 * Pattern to match the LTTng toolchain version 2.x.y.
36 */
37 Pattern VERSION_2_PATTERN = Pattern.compile("(2\\.\\d+\\.\\d+).*"); //$NON-NLS-1$
38
39 // ------------------------------------------------------------------------
40 // Constants
41 // ------------------------------------------------------------------------
42 /**
43 * Unused value
44 */
45 int UNUSED_VALUE = -1;
46 /**
47 * String representation of numerical true element
48 */
49 String TRUE_NUMERICAL = "1"; //$NON-NLS-1$
50
51 /** The default directory for session */
52 public static final String DEFAULT_PATH = ".lttng/sessions"; //$NON-NLS-1$
53
54 // ------------------------------------------------------------------------
55 // LTTng Machine Interface constants
56 // ------------------------------------------------------------------------
57
58 /**
59 * Name of the XSD to validate against the xml machine interface
60 * output from LTTng
61 */
62 String MI_XSD_FILENAME = "mi_lttng.xsd"; //$NON-NLS-1$
63 // ------------------------------------------------------------------------
64 // Command constants
65 // ------------------------------------------------------------------------
66 /**
67 * The lttng tools command.
68 */
69 String CONTROL_COMMAND = "lttng"; //$NON-NLS-1$
70 /**
71 * The lttng tools machine interface command.
72 */
73 String CONTROL_COMMAND_MI_OPTION = "--mi"; //$NON-NLS-1$
74 /**
75 * The lttng tools XML machine interface command.
76 */
77 String CONTROL_COMMAND_MI_XML = "xml"; //$NON-NLS-1$
78 /**
79 * Command: lttng version.
80 */
81 String COMMAND_VERSION = "version"; //$NON-NLS-1$
82 /**
83 * Command: lttng list.
84 */
85 String COMMAND_LIST = "list"; //$NON-NLS-1$
86 /**
87 * Command to create a session.
88 */
89 String COMMAND_CREATE_SESSION = "create"; //$NON-NLS-1$
90 /**
91 * Command to destroy a session.
92 */
93 String COMMAND_DESTROY_SESSION = "destroy"; //$NON-NLS-1$
94 /**
95 * Command to destroy a session.
96 */
97 String COMMAND_START_SESSION = "start"; //$NON-NLS-1$
98 /**
99 * Command to destroy a session.
100 */
101 String COMMAND_STOP_SESSION = "stop"; //$NON-NLS-1$
102 /**
103 * Command to enable a channel.
104 */
105 String COMMAND_ENABLE_CHANNEL = "enable-channel"; //$NON-NLS-1$
106 /**
107 * Command to disable a channel.
108 */
109 String COMMAND_DISABLE_CHANNEL = "disable-channel"; //$NON-NLS-1$
110 /**
111 * Command to enable a event.
112 */
113 String COMMAND_ENABLE_EVENT = "enable-event"; //$NON-NLS-1$
114 /**
115 * Command to disable a event.
116 */
117 String COMMAND_DISABLE_EVENT = "disable-event"; //$NON-NLS-1$
118 /**
119 * Command to add a context to channels and/or events
120 */
121 String COMMAND_ADD_CONTEXT = "add-context"; //$NON-NLS-1$
122 /**
123 * Command to execute sub-command snapshot
124 */
125 String COMMAND_SNAPSHOT = "snapshot"; //$NON-NLS-1$
126 /**
127 * Command to list the snapshot outputs
128 */
129 String COMMAND_LIST_SNAPSHOT_OUTPUT = "list-output"; //$NON-NLS-1$
130 /**
131 * Command to record a snapshot
132 */
133 String COMMAND_RECORD_SNAPSHOT = "record"; //$NON-NLS-1$
134 /**
135 * Command to load a session.
136 */
137 String COMMAND_LOAD_SESSION = "load"; //$NON-NLS-1$
138 /**
139 * Command to save a session
140 */
141 String COMMAND_SAVE_SESSION = "save"; //$NON-NLS-1$
142
143 // ------------------------------------------------------------------------
144 // Command line options constants
145 // ------------------------------------------------------------------------
146 /**
147 * Command line option to add tracing group of user.
148 */
149 String OPTION_TRACING_GROUP = "-g"; //$NON-NLS-1$
150 /**
151 * Command line option for verbose output.
152 */
153 String OPTION_VERBOSE = "-v"; //$NON-NLS-1$
154 /**
155 * Command line option for verbose output.
156 */
157 String OPTION_VERY_VERBOSE = "-vv"; //$NON-NLS-1$
158 /**
159 * Command line option for verbose output.
160 */
161 String OPTION_VERY_VERY_VERBOSE = "-vvv"; //$NON-NLS-1$
162 /**
163 * Command line option for output path.
164 */
165 String OPTION_OUTPUT_PATH = "-o"; //$NON-NLS-1$
166 /**
167 * Command line option for output path.
168 */
169 String OPTION_SNAPSHOT = "--snapshot"; //$NON-NLS-1$
170 /**
171 * Command line option for live
172 */
173 String OPTION_LIVE = "--live"; //$NON-NLS-1$
174 /**
175 * Command line option for kernel tracer.
176 */
177 String OPTION_KERNEL = "-k"; //$NON-NLS-1$
178 /**
179 * Command line option for UST tracer.
180 */
181 String OPTION_UST = "-u"; //$NON-NLS-1$
182 /**
183 * Command line option for specifying a session.
184 */
185 String OPTION_SESSION = "-s"; //$NON-NLS-1$
186 /**
187 * Command line option for specifying a channel.
188 */
189 String OPTION_CHANNEL = "-c"; //$NON-NLS-1$
190 /**
191 * Command line option for specifying a event.
192 */
193 String OPTION_EVENT = "-e"; //$NON-NLS-1$
194 /**
195 * Command line option for specifying all events.
196 */
197 String OPTION_ALL = "-a"; //$NON-NLS-1$
198 /**
199 * Command line option for specifying a context.
200 */
201 String OPTION_CONTEXT_TYPE = "-t"; //$NON-NLS-1$
202 /**
203 * Command line option for specifying tracepoint events.
204 */
205 String OPTION_TRACEPOINT = "--tracepoint"; //$NON-NLS-1$
206 /**
207 * Command line option for specifying syscall events.
208 */
209 String OPTION_SYSCALL = "--syscall"; //$NON-NLS-1$
210 /**
211 * Command line option for specifying a dynamic probe.
212 */
213 String OPTION_PROBE = "--probe"; //$NON-NLS-1$
214 /**
215 * Command line option for specifying a dynamic function entry/return probe.
216 */
217 String OPTION_FUNCTION_PROBE = "--function"; //$NON-NLS-1$
218 /**
219 * Command line option for specifying a log level range.
220 */
221 String OPTION_LOGLEVEL = "--loglevel"; //$NON-NLS-1$
222 /**
223 * Command line option for specifying a specific log level.
224 */
225 String OPTION_LOGLEVEL_ONLY = "--loglevel-only"; //$NON-NLS-1$
226 /**
227 * Optional command line option for configuring a channel's overwrite mode.
228 */
229 String OPTION_OVERWRITE = "--overwrite"; //$NON-NLS-1$
230 /**
231 * Optional command line option for configuring a channel's number of sub buffers.
232 */
233 String OPTION_NUM_SUB_BUFFERS = "--num-subbuf"; //$NON-NLS-1$
234 /**
235 * Optional command line option for configuring a channel's sub buffer size.
236 */
237 String OPTION_SUB_BUFFER_SIZE = "--subbuf-size"; //$NON-NLS-1$
238 /**
239 * Optional command line option for configuring a channel's switch timer interval.
240 */
241 String OPTION_SWITCH_TIMER = "--switch-timer"; //$NON-NLS-1$
242 /**
243 * Optional command line option for configuring a channel's read timer interval.
244 */
245 String OPTION_READ_TIMER = "--read-timer"; //$NON-NLS-1$
246 /**
247 * Command line option for printing the help of a specific command
248 */
249 String OPTION_HELP = "-h"; //$NON-NLS-1$
250 /**
251 * Command line option for listing things. For example listing available
252 * context.
253 */
254 String OPTION_LIST = "--list"; //$NON-NLS-1$
255 /**
256 * Command line option for listing the fields of UST tracepoints
257 */
258 String OPTION_FIELDS = "-f"; //$NON-NLS-1$
259 /**
260 * Command line option for configuring event's filter
261 */
262 String OPTION_FILTER = "--filter"; //$NON-NLS-1$
263 /**
264 * Command line option for configuring the streaming network URL (common for control and data channel).
265 */
266 String OPTION_NETWORK_URL = "-U"; //$NON-NLS-1$
267 /**
268 * Command line option for configuring the streaming control URL.
269 */
270 String OPTION_CONTROL_URL = "-C"; //$NON-NLS-1$
271 /**
272 * Command line option for configuring the streaming data URL.
273 */
274 String OPTION_DATA_URL = "-D"; //$NON-NLS-1$
275 /**
276 * Command line option for per UID buffers
277 */
278 String OPTION_PER_UID_BUFFERS = "--buffers-uid"; //$NON-NLS-1$
279 /**
280 * Command line option for per PID buffers
281 */
282 String OPTION_PER_PID_BUFFERS = "--buffers-pid"; //$NON-NLS-1$
283 /**
284 * Command line option for maximum size of trace files
285 */
286 String OPTION_MAX_SIZE_TRACE_FILES = "-C"; //$NON-NLS-1$
287 /**
288 * Command line option for maximum trace files
289 */
290 String OPTION_MAX_TRACE_FILES = "-W"; //$NON-NLS-1$
291 /**
292 * Command line option for force overwrite
293 */
294 String OPTION_FORCE = "-f"; //$NON-NLS-1$
295 /**
296 * Command line option for specifying input path
297 */
298 String OPTION_INPUT_PATH = "-i"; //$NON-NLS-1$
299 /**
300 * Maximum live timer interval value
301 */
302 Long MAX_LIVE_TIMER_INTERVAL = 0xFFFFFFFEL;
303
304 // ------------------------------------------------------------------------
305 // Parsing constants
306 // ------------------------------------------------------------------------
307 /**
308 * Pattern to match the version.
309 */
310 Pattern VERSION_PATTERN = Pattern.compile(".*lttng\\s+version\\s+.*(\\d+\\.\\d+\\.\\d+).*"); //$NON-NLS-1$
311 /**
312 * Pattern to match for error output
313 */
314 Pattern ERROR_PATTERN = Pattern.compile("\\s*Error\\:.*"); //$NON-NLS-1$
315 /**
316 * Pattern to match for session information (lttng list)
317 */
318 Pattern SESSION_PATTERN = Pattern.compile("\\s+(\\d+)\\)\\s+(.*)\\s+\\((.*)\\)\\s+\\[(active|inactive).*\\].*"); //$NON-NLS-1$
319 /**
320 * Pattern to match for session information (lttng list <session>)
321 */
322 Pattern TRACE_SESSION_PATTERN = Pattern.compile("\\s*Tracing\\s+session\\s+(.*)\\:\\s+\\[(active|inactive)\\].*"); //$NON-NLS-1$
323 /**
324 * Pattern to match for snapshot session information (lttng list <session>)
325 */
326 Pattern TRACE_SNAPSHOT_SESSION_PATTERN = Pattern.compile("\\s*Tracing\\s+session\\s+(.*)\\:\\s+\\[(active|inactive)\\s*snapshot\\].*"); //$NON-NLS-1$
327 /**
328 * Pattern to match for session path information (lttng list <session>)
329 */
330 Pattern TRACE_SESSION_PATH_PATTERN = Pattern.compile("\\s*Trace\\s+path\\:\\s+(.*)"); //$NON-NLS-1$
331 /**
332 * Pattern to match session path for network tracing (lttng list <session>)
333 * Note: file for protocol is not considered as network trace since local consumer will be used.
334 */
335 Pattern TRACE_NETWORK_PATH_PATTERN = Pattern.compile("\\s*Trace\\s+path\\:\\s+(net|net4|net6|tcp|tcp4|tcp6)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$
336 /**
337 * Pattern to match session path for network tracing
338 * Note: file for protocol is not considered as network trace since local consumer will be used.
339 */
340 Pattern TRACE_NETWORK_PATTERN = Pattern.compile("\\s*(net|net4|net6|tcp|tcp4|tcp6)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$
341 /**
342 * Sub-pattern to pattern TRACE_NETWORK_PATH_PATTERN to match file protocol
343 */
344 Pattern TRACE_FILE_PROTOCOL_PATTERN = Pattern.compile("(file)\\:\\/\\/(.*)"); //$NON-NLS-1$
345 /**
346 * Pattern to match for kernel domain information (lttng list <session>)
347 */
348 Pattern DOMAIN_KERNEL_PATTERN = Pattern.compile("=== Domain: Kernel ==="); //$NON-NLS-1$
349 /**
350 * Pattern to match for ust domain information (lttng list <session>)
351 */
352 Pattern DOMAIN_UST_GLOBAL_PATTERN = Pattern.compile("=== Domain: UST global ==="); //$NON-NLS-1$
353 /**
354 * Pattern to match for matching warning about no kernel channel
355 */
356 Pattern DOMAIN_NO_KERNEL_CHANNEL_PATTERN = Pattern.compile("\\s*Warning\\:\\s+No kernel\\s+channel.*"); //$NON-NLS-1$
357 /**
358 * Pattern to match for matching warning about no UST channel
359 */
360 Pattern DOMAIN_NO_UST_CHANNEL_PATTERN = Pattern.compile("\\s*Error\\:\\s+UST\\s+channel\\s+not\\s+found.*"); //$NON-NLS-1$
361 /**
362 * Pattern to match for buffer type (lttng list <session>)
363 */
364 Pattern BUFFER_TYPE_PATTERN = Pattern.compile("\\s*Buffer\\s+type\\:.*"); //$NON-NLS-1$
365 /**
366 * Pattern to match for channels section (lttng list <session>)
367 */
368 Pattern CHANNELS_SECTION_PATTERN = Pattern.compile("\\s*Channels\\:"); //$NON-NLS-1$
369 /**
370 * Pattern to match for channel information (lttng list <session>)
371 */
372 Pattern CHANNEL_PATTERN = Pattern.compile("\\s*-\\s+(.*)\\:\\s+\\[(enabled|disabled)\\]"); //$NON-NLS-1$
373 /**
374 * Pattern to match for events section information (lttng list <session>)
375 */
376 Pattern EVENT_SECTION_PATTERN = Pattern.compile("\\s*Events\\:"); //$NON-NLS-1$
377 /**
378 * Pattern to match for event information (lttng list <session>)
379 */
380 Pattern EVENT_PATTERN = Pattern.compile("\\s+(.*)\\s+\\(loglevel\\s*(:|<=|==)\\s+(.*)\\s+\\(\\d*\\)\\)\\s+\\(type:\\s+(.*)\\)\\s+\\[(enabled|disabled)\\]\\s*(\\[.*\\]){0,1}.*"); //$NON-NLS-1$
381 /**
382 * Pattern to match a wildcarded event information (lttng list <session>)
383 */
384 Pattern WILDCARD_EVENT_PATTERN = Pattern.compile("\\s+(.*)\\s+\\(type:\\s+(.*)\\)\\s+\\[(enabled|disabled)\\]\\s*(\\[.*\\]){0,1}.*"); //$NON-NLS-1$
385 /**
386 * Pattern to match a probe address information (lttng list <session>)
387 */
388 Pattern PROBE_ADDRESS_PATTERN = Pattern.compile("\\s+(addr)\\:\\s+(0x[0-9a-fA-F]{1,16})"); //$NON-NLS-1$
389 /**
390 * Pattern to match a probe OFFSET information (lttng list <session>)
391 */
392 Pattern PROBE_OFFSET_PATTERN = Pattern.compile("\\s+(offset)\\:\\s+(0x[0-9a-fA-F]{1,16})"); //$NON-NLS-1$
393 /**
394 * Pattern to match a probe SYMBOL information (lttng list <session>)
395 */
396 Pattern PROBE_SYMBOL_PATTERN = Pattern.compile("\\s+(symbol)\\:\\s+(.+)"); //$NON-NLS-1$
397 /**
398 * Pattern to match for channel (overwite mode) information (lttng list <session>)
399 */
400 Pattern OVERWRITE_MODE_ATTRIBUTE = Pattern.compile("\\s+overwrite\\s+mode\\:.*"); //$NON-NLS-1$
401 /**
402 * Pattern to match indicating false for overwrite mode
403 */
404 String OVERWRITE_MODE_ATTRIBUTE_FALSE = "0"; //$NON-NLS-1$
405 /**
406 * Pattern to match indicating false for overwrite mode in machine interface mode
407 */
408 String OVERWRITE_MODE_ATTRIBUTE_FALSE_MI = "DISCARD"; //$NON-NLS-1$
409 /**
410 * Pattern to match for channel (sub-buffer size) information (lttng list <session>)
411 */
412 Pattern SUBBUFFER_SIZE_ATTRIBUTE = Pattern.compile("\\s+subbufers\\s+size\\:.*"); //$NON-NLS-1$
413 /**
414 * Pattern to match for channel (number of sub-buffers) information (lttng list <session>)
415 */
416 Pattern NUM_SUBBUFFERS_ATTRIBUTE = Pattern.compile("\\s+number\\s+of\\s+subbufers\\:.*"); //$NON-NLS-1$
417 /**
418 * Pattern to match for channel (switch timer) information (lttng list <session>)
419 */
420 Pattern SWITCH_TIMER_ATTRIBUTE = Pattern.compile("\\s+switch\\s+timer\\s+interval\\:.*"); //$NON-NLS-1$
421 /**
422 * Pattern to match for channel (read timer) information (lttng list <session>)
423 */
424 Pattern READ_TIMER_ATTRIBUTE = Pattern.compile("\\s+read\\s+timer\\s+interval\\:.*"); //$NON-NLS-1$
425 /**
426 * Pattern to match for channel (output type) information (lttng list <session>)
427 */
428 Pattern OUTPUT_ATTRIBUTE = Pattern.compile("\\s+output\\:.*"); //$NON-NLS-1$
429 /**
430 * Pattern to match for channel (trace file size) information (lttng list <session>)
431 */
432 Pattern TRACE_FILE_COUNT_ATTRIBUTE = Pattern.compile("\\s+trace\\s+file\\s+count\\:.*"); //$NON-NLS-1$
433 /**
434 * Pattern to match for channel (trace file size) information (lttng list <session>)
435 */
436 Pattern TRACE_FILE_SIZE_ATTRIBUTE = Pattern.compile("\\s+trace\\s+file\\s+size\\s+\\(bytes\\)\\:.*"); //$NON-NLS-1$
437 /**
438 * Pattern to match for provider information (lttng list -k/-u)
439 */
440 Pattern PROVIDER_EVENT_PATTERN = Pattern.compile("\\s*(.*)\\s+\\(loglevel:\\s+(.*)\\s+\\(\\d*\\)\\)\\s+\\(type:\\s+(.*)\\)"); //$NON-NLS-1$
441 /**
442 * Pattern to match event fields
443 */
444 Pattern EVENT_FIELD_PATTERN = Pattern.compile("\\s*(field:)\\s+(.*)\\s+\\((.*)\\)"); //$NON-NLS-1$
445 /**
446 * Pattern to match for UST provider information (lttng list -u)
447 */
448 Pattern UST_PROVIDER_PATTERN = Pattern.compile("\\s*PID\\:\\s+(\\d+)\\s+-\\s+Name\\:\\s+(.*)"); //$NON-NLS-1$
449 /**
450 * Pattern to match for session information (lttng create <session name>)
451 */
452 Pattern CREATE_SESSION_NAME_PATTERN = Pattern.compile(".*Session\\s+(.*)\\s+created\\."); //$NON-NLS-1$
453 /**
454 * Pattern to match for session path information (lttng create <session name>)
455 */
456 Pattern CREATE_SESSION_PATH_PATTERN = Pattern.compile("\\s*Traces\\s+will\\s+be\\s+written\\s+in\\s+(.*).*"); //$NON-NLS-1$
457 /**
458 * Pattern to match for session command output for "session name not found".
459 */
460 Pattern SESSION_NOT_FOUND_ERROR_PATTERN = Pattern.compile("\\s*Error:\\s+Session\\s+name\\s.*not\\s+found"); //$NON-NLS-1$
461 /**
462 * Pattern to match introduction line of context list.
463 */
464 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$
465 /**
466 * Pattern to match introduction line of context list.
467 */
468 Pattern ADD_CONTEXT_HELP_CONTEXTS_END_LINE = Pattern.compile("\\s*Example.*"); //$NON-NLS-1$
469 /**
470 * Pattern to match error line if no kernel tracer is available or installed.
471 */
472 Pattern LIST_KERNEL_NO_KERNEL_PROVIDER_PATTERN = Pattern.compile("\\s*Error:\\s+Unable\\s+to\\s+list\\s+kernel\\s+events.*"); //$NON-NLS-1$;
473 /**
474 * Pattern to match error line if no ust tracer is available or installed.
475 */
476 Pattern LIST_UST_NO_UST_PROVIDER_PATTERN = Pattern.compile(".*Unable\\s*to\\s*list\\s*UST\\s*event.*"); //$NON-NLS-1$;
477 /**
478 * Pattern to match for list snapshot information (lttng snapshot list-output)
479 */
480 Pattern LIST_SNAPSHOT_OUTPUT_PATTERN = Pattern.compile("\\s+\\[(\\d+)\\]\\s+(\\S*)\\:\\s+(\\S*)(.*)"); //$NON-NLS-1$
481 /**
482 * Pattern to match the live timer interval line of session list.
483 */
484 Pattern LIST_LIVE_TIMER_INTERVAL_PATTERN = Pattern.compile("\\s*Live\\stimer\\sinterval\\s\\(usec\\):\\s(\\d+)"); //$NON-NLS-1$
485 /**
486 * Pattern to match snapshot path for network tracing (lttng list <session>)
487 * Note: file for protocol is not considered as network trace since local consumer will be used.
488 */
489 Pattern SNAPSHOT_NETWORK_PATH_PATTERN = Pattern.compile("(net|net4|net6|tcp|tcp4|tcp6)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$
490
491 }
This page took 0.04307 seconds and 6 git commands to generate.