1 /**********************************************************************
2 * Copyright (c) 2012, 2015 Ericsson
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
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
;
17 import java
.util
.regex
.Pattern
;
19 import org
.eclipse
.jdt
.annotation
.NonNullByDefault
;
23 * Constants for LTTng Control Service.
26 * @author Bernd Hufmann
29 public interface LTTngControlServiceConstants
{
31 // ------------------------------------------------------------------------
33 // ------------------------------------------------------------------------
35 * Pattern to match the LTTng toolchain version 2.x.y.
37 Pattern VERSION_2_PATTERN
= Pattern
.compile("(2\\.\\d+\\.\\d+).*"); //$NON-NLS-1$
39 // ------------------------------------------------------------------------
41 // ------------------------------------------------------------------------
45 int UNUSED_VALUE
= -1;
47 * String representation of numerical true element
49 String TRUE_NUMERICAL
= "1"; //$NON-NLS-1$
51 /** The default directory for session */
52 public static final String DEFAULT_PATH
= ".lttng/sessions"; //$NON-NLS-1$
54 // ------------------------------------------------------------------------
55 // LTTng Machine Interface constants
56 // ------------------------------------------------------------------------
59 * Name of the XSD to validate against the xml machine interface
62 String MI_XSD_FILENAME
= "mi_lttng.xsd"; //$NON-NLS-1$
63 // ------------------------------------------------------------------------
65 // ------------------------------------------------------------------------
67 * The lttng tools command.
69 String CONTROL_COMMAND
= "lttng"; //$NON-NLS-1$
71 * The lttng tools machine interface command.
73 String CONTROL_COMMAND_MI_OPTION
= "--mi"; //$NON-NLS-1$
75 * The lttng tools XML machine interface command.
77 String CONTROL_COMMAND_MI_XML
= "xml"; //$NON-NLS-1$
79 * Command: lttng version.
81 String COMMAND_VERSION
= "version"; //$NON-NLS-1$
83 * Command: lttng list.
85 String COMMAND_LIST
= "list"; //$NON-NLS-1$
87 * Command to create a session.
89 String COMMAND_CREATE_SESSION
= "create"; //$NON-NLS-1$
91 * Command to destroy a session.
93 String COMMAND_DESTROY_SESSION
= "destroy"; //$NON-NLS-1$
95 * Command to destroy a session.
97 String COMMAND_START_SESSION
= "start"; //$NON-NLS-1$
99 * Command to destroy a session.
101 String COMMAND_STOP_SESSION
= "stop"; //$NON-NLS-1$
103 * Command to enable a channel.
105 String COMMAND_ENABLE_CHANNEL
= "enable-channel"; //$NON-NLS-1$
107 * Command to disable a channel.
109 String COMMAND_DISABLE_CHANNEL
= "disable-channel"; //$NON-NLS-1$
111 * Command to enable a event.
113 String COMMAND_ENABLE_EVENT
= "enable-event"; //$NON-NLS-1$
115 * Command to disable a event.
117 String COMMAND_DISABLE_EVENT
= "disable-event"; //$NON-NLS-1$
119 * Command to add a context to channels and/or events
121 String COMMAND_ADD_CONTEXT
= "add-context"; //$NON-NLS-1$
123 * Command to execute sub-command snapshot
125 String COMMAND_SNAPSHOT
= "snapshot"; //$NON-NLS-1$
127 * Command to list the snapshot outputs
129 String COMMAND_LIST_SNAPSHOT_OUTPUT
= "list-output"; //$NON-NLS-1$
131 * Command to record a snapshot
133 String COMMAND_RECORD_SNAPSHOT
= "record"; //$NON-NLS-1$
135 * Command to load a session.
137 String COMMAND_LOAD_SESSION
= "load"; //$NON-NLS-1$
139 * Command to save a session
141 String COMMAND_SAVE_SESSION
= "save"; //$NON-NLS-1$
143 // ------------------------------------------------------------------------
144 // Command line options constants
145 // ------------------------------------------------------------------------
147 * Command line option to add tracing group of user.
149 String OPTION_TRACING_GROUP
= "-g"; //$NON-NLS-1$
151 * Command line option for verbose output.
153 String OPTION_VERBOSE
= "-v"; //$NON-NLS-1$
155 * Command line option for verbose output.
157 String OPTION_VERY_VERBOSE
= "-vv"; //$NON-NLS-1$
159 * Command line option for verbose output.
161 String OPTION_VERY_VERY_VERBOSE
= "-vvv"; //$NON-NLS-1$
163 * Command line option for output path.
165 String OPTION_OUTPUT_PATH
= "-o"; //$NON-NLS-1$
167 * Command line option for output path.
169 String OPTION_SNAPSHOT
= "--snapshot"; //$NON-NLS-1$
171 * Command line option for live
173 String OPTION_LIVE
= "--live"; //$NON-NLS-1$
175 * Command line option for kernel tracer.
177 String OPTION_KERNEL
= "-k"; //$NON-NLS-1$
179 * Command line option for UST tracer.
181 String OPTION_UST
= "-u"; //$NON-NLS-1$
183 * Command line option for specifying a session.
185 String OPTION_SESSION
= "-s"; //$NON-NLS-1$
187 * Command line option for specifying a channel.
189 String OPTION_CHANNEL
= "-c"; //$NON-NLS-1$
191 * Command line option for specifying a event.
193 String OPTION_EVENT
= "-e"; //$NON-NLS-1$
195 * Command line option for specifying all events.
197 String OPTION_ALL
= "-a"; //$NON-NLS-1$
199 * Command line option for specifying a context.
201 String OPTION_CONTEXT_TYPE
= "-t"; //$NON-NLS-1$
203 * Command line option for specifying tracepoint events.
205 String OPTION_TRACEPOINT
= "--tracepoint"; //$NON-NLS-1$
207 * Command line option for specifying syscall events.
209 String OPTION_SYSCALL
= "--syscall"; //$NON-NLS-1$
211 * Command line option for specifying a dynamic probe.
213 String OPTION_PROBE
= "--probe"; //$NON-NLS-1$
215 * Command line option for specifying a dynamic function entry/return probe.
217 String OPTION_FUNCTION_PROBE
= "--function"; //$NON-NLS-1$
219 * Command line option for specifying a log level range.
221 String OPTION_LOGLEVEL
= "--loglevel"; //$NON-NLS-1$
223 * Command line option for specifying a specific log level.
225 String OPTION_LOGLEVEL_ONLY
= "--loglevel-only"; //$NON-NLS-1$
227 * Optional command line option for configuring a channel's overwrite mode.
229 String OPTION_OVERWRITE
= "--overwrite"; //$NON-NLS-1$
231 * Optional command line option for configuring a channel's number of sub buffers.
233 String OPTION_NUM_SUB_BUFFERS
= "--num-subbuf"; //$NON-NLS-1$
235 * Optional command line option for configuring a channel's sub buffer size.
237 String OPTION_SUB_BUFFER_SIZE
= "--subbuf-size"; //$NON-NLS-1$
239 * Optional command line option for configuring a channel's switch timer interval.
241 String OPTION_SWITCH_TIMER
= "--switch-timer"; //$NON-NLS-1$
243 * Optional command line option for configuring a channel's read timer interval.
245 String OPTION_READ_TIMER
= "--read-timer"; //$NON-NLS-1$
247 * Command line option for printing the help of a specific command
249 String OPTION_HELP
= "-h"; //$NON-NLS-1$
251 * Command line option for listing things. For example listing available
254 String OPTION_LIST
= "--list"; //$NON-NLS-1$
256 * Command line option for listing the fields of UST tracepoints
258 String OPTION_FIELDS
= "-f"; //$NON-NLS-1$
260 * Command line option for configuring event's filter
262 String OPTION_FILTER
= "--filter"; //$NON-NLS-1$
264 * Command line option for configuring the streaming network URL (common for control and data channel).
266 String OPTION_NETWORK_URL
= "-U"; //$NON-NLS-1$
268 * Command line option for configuring the streaming control URL.
270 String OPTION_CONTROL_URL
= "-C"; //$NON-NLS-1$
272 * Command line option for configuring the streaming data URL.
274 String OPTION_DATA_URL
= "-D"; //$NON-NLS-1$
276 * Command line option for per UID buffers
278 String OPTION_PER_UID_BUFFERS
= "--buffers-uid"; //$NON-NLS-1$
280 * Command line option for per PID buffers
282 String OPTION_PER_PID_BUFFERS
= "--buffers-pid"; //$NON-NLS-1$
284 * Command line option for maximum size of trace files
286 String OPTION_MAX_SIZE_TRACE_FILES
= "-C"; //$NON-NLS-1$
288 * Command line option for maximum trace files
290 String OPTION_MAX_TRACE_FILES
= "-W"; //$NON-NLS-1$
292 * Command line option for force overwrite
294 String OPTION_FORCE
= "-f"; //$NON-NLS-1$
296 * Command line option for specifying input path
298 String OPTION_INPUT_PATH
= "-i"; //$NON-NLS-1$
300 * Maximum live timer interval value
302 Long MAX_LIVE_TIMER_INTERVAL
= 0xFFFFFFFEL
;
304 // ------------------------------------------------------------------------
306 // ------------------------------------------------------------------------
308 * Pattern to match the version.
310 Pattern VERSION_PATTERN
= Pattern
.compile(".*lttng\\s+version\\s+.*(\\d+\\.\\d+\\.\\d+).*"); //$NON-NLS-1$
312 * Pattern to match for error output
314 Pattern ERROR_PATTERN
= Pattern
.compile("\\s*Error\\:.*"); //$NON-NLS-1$
316 * Pattern to match for session information (lttng list)
318 Pattern SESSION_PATTERN
= Pattern
.compile("\\s+(\\d+)\\)\\s+(.*)\\s+\\((.*)\\)\\s+\\[(active|inactive).*\\].*"); //$NON-NLS-1$
320 * Pattern to match for session information (lttng list <session>)
322 Pattern TRACE_SESSION_PATTERN
= Pattern
.compile("\\s*Tracing\\s+session\\s+(.*)\\:\\s+\\[(active|inactive)\\].*"); //$NON-NLS-1$
324 * Pattern to match for snapshot session information (lttng list <session>)
326 Pattern TRACE_SNAPSHOT_SESSION_PATTERN
= Pattern
.compile("\\s*Tracing\\s+session\\s+(.*)\\:\\s+\\[(active|inactive)\\s*snapshot\\].*"); //$NON-NLS-1$
328 * Pattern to match for session path information (lttng list <session>)
330 Pattern TRACE_SESSION_PATH_PATTERN
= Pattern
.compile("\\s*Trace\\s+path\\:\\s+(.*)"); //$NON-NLS-1$
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.
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$
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.
340 Pattern TRACE_NETWORK_PATTERN
= Pattern
.compile("\\s*(net|net4|net6|tcp|tcp4|tcp6)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$
342 * Sub-pattern to pattern TRACE_NETWORK_PATH_PATTERN to match file protocol
344 Pattern TRACE_FILE_PROTOCOL_PATTERN
= Pattern
.compile("(file)\\:\\/\\/(.*)"); //$NON-NLS-1$
346 * Pattern to match for kernel domain information (lttng list <session>)
348 Pattern DOMAIN_KERNEL_PATTERN
= Pattern
.compile("=== Domain: Kernel ==="); //$NON-NLS-1$
350 * Pattern to match for ust domain information (lttng list <session>)
352 Pattern DOMAIN_UST_GLOBAL_PATTERN
= Pattern
.compile("=== Domain: UST global ==="); //$NON-NLS-1$
354 * Pattern to match for matching warning about no kernel channel
356 Pattern DOMAIN_NO_KERNEL_CHANNEL_PATTERN
= Pattern
.compile("\\s*Warning\\:\\s+No kernel\\s+channel.*"); //$NON-NLS-1$
358 * Pattern to match for matching warning about no UST channel
360 Pattern DOMAIN_NO_UST_CHANNEL_PATTERN
= Pattern
.compile("\\s*Error\\:\\s+UST\\s+channel\\s+not\\s+found.*"); //$NON-NLS-1$
362 * Pattern to match for buffer type (lttng list <session>)
364 Pattern BUFFER_TYPE_PATTERN
= Pattern
.compile("\\s*Buffer\\s+type\\:.*"); //$NON-NLS-1$
366 * Pattern to match for channels section (lttng list <session>)
368 Pattern CHANNELS_SECTION_PATTERN
= Pattern
.compile("\\s*Channels\\:"); //$NON-NLS-1$
370 * Pattern to match for channel information (lttng list <session>)
372 Pattern CHANNEL_PATTERN
= Pattern
.compile("\\s*-\\s+(.*)\\:\\s+\\[(enabled|disabled)\\]"); //$NON-NLS-1$
374 * Pattern to match for events section information (lttng list <session>)
376 Pattern EVENT_SECTION_PATTERN
= Pattern
.compile("\\s*Events\\:"); //$NON-NLS-1$
378 * Pattern to match for event information (lttng list <session>)
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$
382 * Pattern to match a wildcarded event information (lttng list <session>)
384 Pattern WILDCARD_EVENT_PATTERN
= Pattern
.compile("\\s+(.*)\\s+\\(type:\\s+(.*)\\)\\s+\\[(enabled|disabled)\\]\\s*(\\[.*\\]){0,1}.*"); //$NON-NLS-1$
386 * Pattern to match a probe address information (lttng list <session>)
388 Pattern PROBE_ADDRESS_PATTERN
= Pattern
.compile("\\s+(addr)\\:\\s+(0x[0-9a-fA-F]{1,16})"); //$NON-NLS-1$
390 * Pattern to match a probe OFFSET information (lttng list <session>)
392 Pattern PROBE_OFFSET_PATTERN
= Pattern
.compile("\\s+(offset)\\:\\s+(0x[0-9a-fA-F]{1,16})"); //$NON-NLS-1$
394 * Pattern to match a probe SYMBOL information (lttng list <session>)
396 Pattern PROBE_SYMBOL_PATTERN
= Pattern
.compile("\\s+(symbol)\\:\\s+(.+)"); //$NON-NLS-1$
398 * Pattern to match for channel (overwite mode) information (lttng list <session>)
400 Pattern OVERWRITE_MODE_ATTRIBUTE
= Pattern
.compile("\\s+overwrite\\s+mode\\:.*"); //$NON-NLS-1$
402 * Pattern to match indicating false for overwrite mode
404 String OVERWRITE_MODE_ATTRIBUTE_FALSE
= "0"; //$NON-NLS-1$
406 * Pattern to match indicating false for overwrite mode in machine interface mode
408 String OVERWRITE_MODE_ATTRIBUTE_FALSE_MI
= "DISCARD"; //$NON-NLS-1$
410 * Pattern to match for channel (sub-buffer size) information (lttng list <session>)
412 Pattern SUBBUFFER_SIZE_ATTRIBUTE
= Pattern
.compile("\\s+subbufers\\s+size\\:.*"); //$NON-NLS-1$
414 * Pattern to match for channel (number of sub-buffers) information (lttng list <session>)
416 Pattern NUM_SUBBUFFERS_ATTRIBUTE
= Pattern
.compile("\\s+number\\s+of\\s+subbufers\\:.*"); //$NON-NLS-1$
418 * Pattern to match for channel (switch timer) information (lttng list <session>)
420 Pattern SWITCH_TIMER_ATTRIBUTE
= Pattern
.compile("\\s+switch\\s+timer\\s+interval\\:.*"); //$NON-NLS-1$
422 * Pattern to match for channel (read timer) information (lttng list <session>)
424 Pattern READ_TIMER_ATTRIBUTE
= Pattern
.compile("\\s+read\\s+timer\\s+interval\\:.*"); //$NON-NLS-1$
426 * Pattern to match for channel (output type) information (lttng list <session>)
428 Pattern OUTPUT_ATTRIBUTE
= Pattern
.compile("\\s+output\\:.*"); //$NON-NLS-1$
430 * Pattern to match for channel (trace file size) information (lttng list <session>)
432 Pattern TRACE_FILE_COUNT_ATTRIBUTE
= Pattern
.compile("\\s+trace\\s+file\\s+count\\:.*"); //$NON-NLS-1$
434 * Pattern to match for channel (trace file size) information (lttng list <session>)
436 Pattern TRACE_FILE_SIZE_ATTRIBUTE
= Pattern
.compile("\\s+trace\\s+file\\s+size\\s+\\(bytes\\)\\:.*"); //$NON-NLS-1$
438 * Pattern to match for provider information (lttng list -k/-u)
440 Pattern PROVIDER_EVENT_PATTERN
= Pattern
.compile("\\s*(.*)\\s+\\(loglevel:\\s+(.*)\\s+\\(\\d*\\)\\)\\s+\\(type:\\s+(.*)\\)"); //$NON-NLS-1$
442 * Pattern to match event fields
444 Pattern EVENT_FIELD_PATTERN
= Pattern
.compile("\\s*(field:)\\s+(.*)\\s+\\((.*)\\)"); //$NON-NLS-1$
446 * Pattern to match for UST provider information (lttng list -u)
448 Pattern UST_PROVIDER_PATTERN
= Pattern
.compile("\\s*PID\\:\\s+(\\d+)\\s+-\\s+Name\\:\\s+(.*)"); //$NON-NLS-1$
450 * Pattern to match for session information (lttng create <session name>)
452 Pattern CREATE_SESSION_NAME_PATTERN
= Pattern
.compile(".*Session\\s+(.*)\\s+created\\."); //$NON-NLS-1$
454 * Pattern to match for session path information (lttng create <session name>)
456 Pattern CREATE_SESSION_PATH_PATTERN
= Pattern
.compile("\\s*Traces\\s+will\\s+be\\s+written\\s+in\\s+(.*).*"); //$NON-NLS-1$
458 * Pattern to match for session command output for "session name not found".
460 Pattern SESSION_NOT_FOUND_ERROR_PATTERN
= Pattern
.compile("\\s*Error:\\s+Session\\s+name\\s.*not\\s+found"); //$NON-NLS-1$
462 * Pattern to match introduction line of context list.
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$
466 * Pattern to match introduction line of context list.
468 Pattern ADD_CONTEXT_HELP_CONTEXTS_END_LINE
= Pattern
.compile("\\s*Example.*"); //$NON-NLS-1$
470 * Pattern to match error line if no kernel tracer is available or installed.
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$;
474 * Pattern to match error line if no ust tracer is available or installed.
476 Pattern LIST_UST_NO_UST_PROVIDER_PATTERN
= Pattern
.compile(".*Unable\\s*to\\s*list\\s*UST\\s*event.*"); //$NON-NLS-1$;
478 * Pattern to match for list snapshot information (lttng snapshot list-output)
480 Pattern LIST_SNAPSHOT_OUTPUT_PATTERN
= Pattern
.compile("\\s+\\[(\\d+)\\]\\s+(\\S*)\\:\\s+(\\S*)(.*)"); //$NON-NLS-1$
482 * Pattern to match the live timer interval line of session list.
484 Pattern LIST_LIVE_TIMER_INTERVAL_PATTERN
= Pattern
.compile("\\s*Live\\stimer\\sinterval\\s\\(usec\\):\\s(\\d+)"); //$NON-NLS-1$
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.
489 Pattern SNAPSHOT_NETWORK_PATH_PATTERN
= Pattern
.compile("(net|net4|net6|tcp|tcp4|tcp6)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$