1 /**********************************************************************
2 * Copyright (c) 2012, 2016 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$
64 * Name of the XSD to validate against the xml machine interface
65 * output from LTTng, version 3.0
67 String MI3_XSD_FILENAME
= "mi-lttng-3.0.xsd"; //$NON-NLS-1$
68 // ------------------------------------------------------------------------
70 // ------------------------------------------------------------------------
72 * The lttng tools command.
74 String CONTROL_COMMAND
= "lttng"; //$NON-NLS-1$
76 * The lttng tools machine interface command.
78 String CONTROL_COMMAND_MI_OPTION
= "--mi"; //$NON-NLS-1$
80 * The lttng tools XML machine interface command.
82 String CONTROL_COMMAND_MI_XML
= "xml"; //$NON-NLS-1$
84 * Command: lttng version.
86 String COMMAND_VERSION
= "version"; //$NON-NLS-1$
88 * Command: lttng list.
90 String COMMAND_LIST
= "list"; //$NON-NLS-1$
92 * Command to create a session.
94 String COMMAND_CREATE_SESSION
= "create"; //$NON-NLS-1$
96 * Command to destroy a session.
98 String COMMAND_DESTROY_SESSION
= "destroy"; //$NON-NLS-1$
100 * Command to destroy a session.
102 String COMMAND_START_SESSION
= "start"; //$NON-NLS-1$
104 * Command to destroy a session.
106 String COMMAND_STOP_SESSION
= "stop"; //$NON-NLS-1$
108 * Command to enable a channel.
110 String COMMAND_ENABLE_CHANNEL
= "enable-channel"; //$NON-NLS-1$
112 * Command to disable a channel.
114 String COMMAND_DISABLE_CHANNEL
= "disable-channel"; //$NON-NLS-1$
116 * Command to enable a event.
118 String COMMAND_ENABLE_EVENT
= "enable-event"; //$NON-NLS-1$
120 * Command to disable a event.
122 String COMMAND_DISABLE_EVENT
= "disable-event"; //$NON-NLS-1$
124 * Command to add a context to channels and/or events
126 String COMMAND_ADD_CONTEXT
= "add-context"; //$NON-NLS-1$
128 * Command to execute sub-command snapshot
130 String COMMAND_SNAPSHOT
= "snapshot"; //$NON-NLS-1$
132 * Command to list the snapshot outputs
134 String COMMAND_LIST_SNAPSHOT_OUTPUT
= "list-output"; //$NON-NLS-1$
136 * Command to record a snapshot
138 String COMMAND_RECORD_SNAPSHOT
= "record"; //$NON-NLS-1$
140 * Command to load a session.
142 String COMMAND_LOAD_SESSION
= "load"; //$NON-NLS-1$
144 * Command to save a session
146 String COMMAND_SAVE_SESSION
= "save"; //$NON-NLS-1$
148 // ------------------------------------------------------------------------
149 // Command line options constants
150 // ------------------------------------------------------------------------
152 * Command line option to add tracing group of user.
154 String OPTION_TRACING_GROUP
= "-g"; //$NON-NLS-1$
156 * Command line option for verbose output.
158 String OPTION_VERBOSE
= "-v"; //$NON-NLS-1$
160 * Command line option for verbose output.
162 String OPTION_VERY_VERBOSE
= "-vv"; //$NON-NLS-1$
164 * Command line option for verbose output.
166 String OPTION_VERY_VERY_VERBOSE
= "-vvv"; //$NON-NLS-1$
168 * Command line option for output path.
170 String OPTION_OUTPUT_PATH
= "-o"; //$NON-NLS-1$
172 * Command line option for output path.
174 String OPTION_SNAPSHOT
= "--snapshot"; //$NON-NLS-1$
176 * Command line option for live
178 String OPTION_LIVE
= "--live"; //$NON-NLS-1$
180 * Command line option for kernel tracer.
182 String OPTION_KERNEL
= "-k"; //$NON-NLS-1$
184 * Command line option for UST tracer.
186 String OPTION_UST
= "-u"; //$NON-NLS-1$
188 * Command line option for specifying a session.
190 String OPTION_SESSION
= "-s"; //$NON-NLS-1$
192 * Command line option for specifying a channel.
194 String OPTION_CHANNEL
= "-c"; //$NON-NLS-1$
196 * Command line option for specifying a event.
198 String OPTION_EVENT
= "-e"; //$NON-NLS-1$
200 * Command line option for specifying all events.
202 String OPTION_ALL
= "-a"; //$NON-NLS-1$
204 * Command line option for specifying a context.
206 String OPTION_CONTEXT_TYPE
= "-t"; //$NON-NLS-1$
208 * Command line option for specifying tracepoint events.
210 String OPTION_TRACEPOINT
= "--tracepoint"; //$NON-NLS-1$
212 * Command line option for specifying syscall events.
214 String OPTION_SYSCALL
= "--syscall"; //$NON-NLS-1$
216 * Command line option for specifying a dynamic probe.
218 String OPTION_PROBE
= "--probe"; //$NON-NLS-1$
220 * Command line option for specifying a dynamic function entry/return probe.
222 String OPTION_FUNCTION_PROBE
= "--function"; //$NON-NLS-1$
224 * Command line option for specifying a log level range.
226 String OPTION_LOGLEVEL
= "--loglevel"; //$NON-NLS-1$
228 * Command line option for specifying a specific log level.
230 String OPTION_LOGLEVEL_ONLY
= "--loglevel-only"; //$NON-NLS-1$
232 * Optional command line option for configuring a channel's overwrite mode.
234 String OPTION_OVERWRITE
= "--overwrite"; //$NON-NLS-1$
236 * Optional command line option for configuring a channel's number of sub buffers.
238 String OPTION_NUM_SUB_BUFFERS
= "--num-subbuf"; //$NON-NLS-1$
240 * Optional command line option for configuring a channel's sub buffer size.
242 String OPTION_SUB_BUFFER_SIZE
= "--subbuf-size"; //$NON-NLS-1$
244 * Optional command line option for configuring a channel's switch timer interval.
246 String OPTION_SWITCH_TIMER
= "--switch-timer"; //$NON-NLS-1$
248 * Optional command line option for configuring a channel's read timer interval.
250 String OPTION_READ_TIMER
= "--read-timer"; //$NON-NLS-1$
252 * Command line option for printing the help of a specific command
254 String OPTION_HELP
= "-h"; //$NON-NLS-1$
256 * Command line option for listing things. For example listing available
259 String OPTION_LIST
= "--list"; //$NON-NLS-1$
261 * Command line option for listing the fields of UST tracepoints
263 String OPTION_FIELDS
= "-f"; //$NON-NLS-1$
265 * Command line option for configuring event's filter
267 String OPTION_FILTER
= "--filter"; //$NON-NLS-1$
269 * Command line option for configuring the streaming network URL (common for control and data channel).
271 String OPTION_NETWORK_URL
= "-U"; //$NON-NLS-1$
273 * Command line option for configuring the streaming control URL.
275 String OPTION_CONTROL_URL
= "-C"; //$NON-NLS-1$
277 * Command line option for configuring the streaming data URL.
279 String OPTION_DATA_URL
= "-D"; //$NON-NLS-1$
281 * Command line option for per UID buffers
283 String OPTION_PER_UID_BUFFERS
= "--buffers-uid"; //$NON-NLS-1$
285 * Command line option for per PID buffers
287 String OPTION_PER_PID_BUFFERS
= "--buffers-pid"; //$NON-NLS-1$
289 * Command line option for maximum size of trace files
291 String OPTION_MAX_SIZE_TRACE_FILES
= "-C"; //$NON-NLS-1$
293 * Command line option for maximum trace files
295 String OPTION_MAX_TRACE_FILES
= "-W"; //$NON-NLS-1$
297 * Command line option for force overwrite
299 String OPTION_FORCE
= "-f"; //$NON-NLS-1$
301 * Command line option for specifying input path
303 String OPTION_INPUT_PATH
= "-i"; //$NON-NLS-1$
305 * Maximum live timer interval value
307 Long MAX_LIVE_TIMER_INTERVAL
= 0xFFFFFFFEL
;
309 // ------------------------------------------------------------------------
311 // ------------------------------------------------------------------------
313 * Pattern to match the version.
315 Pattern VERSION_PATTERN
= Pattern
.compile(".*lttng\\s+version\\s+.*(\\d+\\.\\d+\\.\\d+).*"); //$NON-NLS-1$
317 * Pattern to match for error output
319 Pattern ERROR_PATTERN
= Pattern
.compile("\\s*Error\\:.*"); //$NON-NLS-1$
321 * Pattern to match for session information (lttng list)
323 Pattern SESSION_PATTERN
= Pattern
.compile("\\s+(\\d+)\\)\\s+(.*)\\s+\\((.*)\\)\\s+\\[(active|inactive).*\\].*"); //$NON-NLS-1$
325 * Pattern to match for session information (lttng list <session>)
327 Pattern TRACE_SESSION_PATTERN
= Pattern
.compile("\\s*Tracing\\s+session\\s+(.*)\\:\\s+\\[(active|inactive)\\].*"); //$NON-NLS-1$
329 * Pattern to match for snapshot session information (lttng list <session>)
331 Pattern TRACE_SNAPSHOT_SESSION_PATTERN
= Pattern
.compile("\\s*Tracing\\s+session\\s+(.*)\\:\\s+\\[(active|inactive)\\s*snapshot\\].*"); //$NON-NLS-1$
333 * Pattern to match for session path information (lttng list <session>)
335 Pattern TRACE_SESSION_PATH_PATTERN
= Pattern
.compile("\\s*Trace\\s+path\\:\\s+(.*)"); //$NON-NLS-1$
337 * Pattern to match session path for network tracing (lttng list <session>)
338 * Note: file for protocol is not considered as network trace since local consumer will be used.
340 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$
342 * Pattern to match session path for network tracing
343 * Note: file for protocol is not considered as network trace since local consumer will be used.
345 Pattern TRACE_NETWORK_PATTERN
= Pattern
.compile("\\s*(net|net4|net6|tcp|tcp4|tcp6)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$
347 * Sub-pattern to pattern TRACE_NETWORK_PATH_PATTERN to match file protocol
349 Pattern TRACE_FILE_PROTOCOL_PATTERN
= Pattern
.compile("(file)\\:\\/\\/(.*)"); //$NON-NLS-1$
351 * Pattern to match for kernel domain information (lttng list <session>)
353 Pattern DOMAIN_KERNEL_PATTERN
= Pattern
.compile("=== Domain: Kernel ==="); //$NON-NLS-1$
355 * Pattern to match for ust domain information (lttng list <session>)
357 Pattern DOMAIN_UST_GLOBAL_PATTERN
= Pattern
.compile("=== Domain: UST global ==="); //$NON-NLS-1$
359 * Pattern to match for matching warning about no kernel channel
361 Pattern DOMAIN_NO_KERNEL_CHANNEL_PATTERN
= Pattern
.compile("\\s*Warning\\:\\s+No kernel\\s+channel.*"); //$NON-NLS-1$
363 * Pattern to match for matching warning about no UST channel
365 Pattern DOMAIN_NO_UST_CHANNEL_PATTERN
= Pattern
.compile("\\s*Error\\:\\s+UST\\s+channel\\s+not\\s+found.*"); //$NON-NLS-1$
367 * Pattern to match for buffer type (lttng list <session>)
369 Pattern BUFFER_TYPE_PATTERN
= Pattern
.compile("\\s*Buffer\\s+type\\:.*"); //$NON-NLS-1$
371 * Pattern to match for channels section (lttng list <session>)
373 Pattern CHANNELS_SECTION_PATTERN
= Pattern
.compile("\\s*Channels\\:"); //$NON-NLS-1$
375 * Pattern to match for channel information (lttng list <session>)
377 Pattern CHANNEL_PATTERN
= Pattern
.compile("\\s*-\\s+(.*)\\:\\s+\\[(enabled|disabled)\\]"); //$NON-NLS-1$
379 * Pattern to match for events section information (lttng list <session>)
381 Pattern EVENT_SECTION_PATTERN
= Pattern
.compile("\\s*Events\\:"); //$NON-NLS-1$
383 * Pattern to match for event information (lttng list <session>)
385 Pattern EVENT_PATTERN
= Pattern
.compile("\\s+(.*)\\s+\\(loglevel\\s*(:|<=|==)\\s+(.*)\\s+\\(\\d*\\)\\)\\s+\\(type:\\s+(.*)\\)\\s+\\[(enabled|disabled)\\]\\s*(\\[.*\\]){0,1}.*"); //$NON-NLS-1$
387 * Pattern to match a wildcarded event information (lttng list <session>)
389 Pattern WILDCARD_EVENT_PATTERN
= Pattern
.compile("\\s+(.*)\\s+\\(type:\\s+(.*)\\)\\s+\\[(enabled|disabled)\\]\\s*(\\[.*\\]){0,1}.*"); //$NON-NLS-1$
391 * Pattern to match a probe address information (lttng list <session>)
393 Pattern PROBE_ADDRESS_PATTERN
= Pattern
.compile("\\s+(addr)\\:\\s+(0x[0-9a-fA-F]{1,16})"); //$NON-NLS-1$
395 * Pattern to match a probe OFFSET information (lttng list <session>)
397 Pattern PROBE_OFFSET_PATTERN
= Pattern
.compile("\\s+(offset)\\:\\s+(0x[0-9a-fA-F]{1,16})"); //$NON-NLS-1$
399 * Pattern to match a probe SYMBOL information (lttng list <session>)
401 Pattern PROBE_SYMBOL_PATTERN
= Pattern
.compile("\\s+(symbol)\\:\\s+(.+)"); //$NON-NLS-1$
403 * Pattern to match for channel (overwite mode) information (lttng list <session>)
405 Pattern OVERWRITE_MODE_ATTRIBUTE
= Pattern
.compile("\\s+overwrite\\s+mode\\:.*"); //$NON-NLS-1$
407 * Pattern to match indicating false for overwrite mode
409 String OVERWRITE_MODE_ATTRIBUTE_FALSE
= "0"; //$NON-NLS-1$
411 * Pattern to match indicating false for overwrite mode in machine interface mode
413 String OVERWRITE_MODE_ATTRIBUTE_FALSE_MI
= "DISCARD"; //$NON-NLS-1$
415 * Pattern to match for channel (sub-buffer size) information (lttng list <session>)
417 Pattern SUBBUFFER_SIZE_ATTRIBUTE
= Pattern
.compile("\\s+subbufers\\s+size\\:.*"); //$NON-NLS-1$
419 * Pattern to match for channel (number of sub-buffers) information (lttng list <session>)
421 Pattern NUM_SUBBUFFERS_ATTRIBUTE
= Pattern
.compile("\\s+number\\s+of\\s+subbufers\\:.*"); //$NON-NLS-1$
423 * Pattern to match for channel (switch timer) information (lttng list <session>)
425 Pattern SWITCH_TIMER_ATTRIBUTE
= Pattern
.compile("\\s+switch\\s+timer\\s+interval\\:.*"); //$NON-NLS-1$
427 * Pattern to match for channel (read timer) information (lttng list <session>)
429 Pattern READ_TIMER_ATTRIBUTE
= Pattern
.compile("\\s+read\\s+timer\\s+interval\\:.*"); //$NON-NLS-1$
431 * Pattern to match for channel (output type) information (lttng list <session>)
433 Pattern OUTPUT_ATTRIBUTE
= Pattern
.compile("\\s+output\\:.*"); //$NON-NLS-1$
435 * Pattern to match for channel (trace file size) information (lttng list <session>)
437 Pattern TRACE_FILE_COUNT_ATTRIBUTE
= Pattern
.compile("\\s+trace\\s+file\\s+count\\:.*"); //$NON-NLS-1$
439 * Pattern to match for channel (trace file size) information (lttng list <session>)
441 Pattern TRACE_FILE_SIZE_ATTRIBUTE
= Pattern
.compile("\\s+trace\\s+file\\s+size\\s+\\(bytes\\)\\:.*"); //$NON-NLS-1$
443 * Pattern to match for provider information (lttng list -k/-u)
445 Pattern PROVIDER_EVENT_PATTERN
= Pattern
.compile("\\s*(.*)\\s+\\(loglevel:\\s+(.*)\\s+\\(\\d*\\)\\)\\s+\\(type:\\s+(.*)\\)"); //$NON-NLS-1$
447 * Pattern to match event fields
449 Pattern EVENT_FIELD_PATTERN
= Pattern
.compile("\\s*(field:)\\s+(.*)\\s+\\((.*)\\)"); //$NON-NLS-1$
451 * Pattern to match for UST provider information (lttng list -u)
453 Pattern UST_PROVIDER_PATTERN
= Pattern
.compile("\\s*PID\\:\\s+(\\d+)\\s+-\\s+Name\\:\\s+(.*)"); //$NON-NLS-1$
455 * Pattern to match for session information (lttng create <session name>)
457 Pattern CREATE_SESSION_NAME_PATTERN
= Pattern
.compile(".*Session\\s+(.*)\\s+created\\."); //$NON-NLS-1$
459 * Pattern to match for session path information (lttng create <session name>)
461 Pattern CREATE_SESSION_PATH_PATTERN
= Pattern
.compile("\\s*Traces\\s+will\\s+be\\s+written\\s+in\\s+(.*).*"); //$NON-NLS-1$
463 * Pattern to match for session command output for "session name not found".
465 Pattern SESSION_NOT_FOUND_ERROR_PATTERN
= Pattern
.compile("\\s*Error:\\s+Session\\s+name\\s.*not\\s+found"); //$NON-NLS-1$
467 * Pattern to match introduction line of context list.
469 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$
471 * Pattern to match introduction line of context list.
473 Pattern ADD_CONTEXT_HELP_CONTEXTS_END_LINE
= Pattern
.compile("\\s*Example.*"); //$NON-NLS-1$
475 * Pattern to match error line if no kernel tracer is available or installed.
477 Pattern LIST_KERNEL_NO_KERNEL_PROVIDER_PATTERN
= Pattern
.compile("\\s*Error:\\s+Unable\\s+to\\s+list\\s+kernel\\s+events.*"); //$NON-NLS-1$;
479 * Pattern to match error line if no ust tracer is available or installed.
481 Pattern LIST_UST_NO_UST_PROVIDER_PATTERN
= Pattern
.compile(".*Unable\\s*to\\s*list\\s*UST\\s*event.*"); //$NON-NLS-1$;
483 * Pattern to match for list snapshot information (lttng snapshot list-output)
485 Pattern LIST_SNAPSHOT_OUTPUT_PATTERN
= Pattern
.compile("\\s+\\[(\\d+)\\]\\s+(\\S*)\\:\\s+(\\S*)(.*)"); //$NON-NLS-1$
487 * Pattern to match the live timer interval line of session list.
489 Pattern LIST_LIVE_TIMER_INTERVAL_PATTERN
= Pattern
.compile("\\s*Live\\stimer\\sinterval\\s\\(usec\\):\\s(\\d+)"); //$NON-NLS-1$
491 * Pattern to match snapshot path for network tracing (lttng list <session>)
492 * Note: file for protocol is not considered as network trace since local consumer will be used.
494 Pattern SNAPSHOT_NETWORK_PATH_PATTERN
= Pattern
.compile("(net|net4|net6|tcp|tcp4|tcp6)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$