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 static org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
.checkNotNull
;
19 import java
.util
.regex
.Pattern
;
21 import org
.eclipse
.jdt
.annotation
.NonNullByDefault
;
25 * Constants for LTTng Control Service.
28 * @author Bernd Hufmann
31 public interface LTTngControlServiceConstants
{
33 // ------------------------------------------------------------------------
35 // ------------------------------------------------------------------------
37 * Pattern to match the LTTng toolchain version 2.x.y.
39 Pattern VERSION_2_PATTERN
= checkNotNull(Pattern
.compile("(2\\.\\d+\\.\\d+).*")); //$NON-NLS-1$
41 // ------------------------------------------------------------------------
43 // ------------------------------------------------------------------------
47 int UNUSED_VALUE
= -1;
49 * String representation of numerical true element
51 String TRUE_NUMERICAL
= "1"; //$NON-NLS-1$
53 /** The default directory for session */
54 public static final String DEFAULT_PATH
= ".lttng/sessions"; //$NON-NLS-1$
56 // ------------------------------------------------------------------------
57 // LTTng Machine Interface constants
58 // ------------------------------------------------------------------------
61 * Name of the XSD to validate against the xml machine interface
64 String MI_XSD_FILENAME
= "mi_lttng.xsd"; //$NON-NLS-1$
65 // ------------------------------------------------------------------------
67 // ------------------------------------------------------------------------
69 * The lttng tools command.
71 String CONTROL_COMMAND
= "lttng"; //$NON-NLS-1$
73 * The lttng tools machine interface command.
75 String CONTROL_COMMAND_MI_OPTION
= "--mi"; //$NON-NLS-1$
77 * The lttng tools XML machine interface command.
79 String CONTROL_COMMAND_MI_XML
= "xml"; //$NON-NLS-1$
81 * Command: lttng version.
83 String COMMAND_VERSION
= "version"; //$NON-NLS-1$
85 * Command: lttng list.
87 String COMMAND_LIST
= "list"; //$NON-NLS-1$
89 * Command to create a session.
91 String COMMAND_CREATE_SESSION
= "create"; //$NON-NLS-1$
93 * Command to destroy a session.
95 String COMMAND_DESTROY_SESSION
= "destroy"; //$NON-NLS-1$
97 * Command to destroy a session.
99 String COMMAND_START_SESSION
= "start"; //$NON-NLS-1$
101 * Command to destroy a session.
103 String COMMAND_STOP_SESSION
= "stop"; //$NON-NLS-1$
105 * Command to enable a channel.
107 String COMMAND_ENABLE_CHANNEL
= "enable-channel"; //$NON-NLS-1$
109 * Command to disable a channel.
111 String COMMAND_DISABLE_CHANNEL
= "disable-channel"; //$NON-NLS-1$
113 * Command to enable a event.
115 String COMMAND_ENABLE_EVENT
= "enable-event"; //$NON-NLS-1$
117 * Command to disable a event.
119 String COMMAND_DISABLE_EVENT
= "disable-event"; //$NON-NLS-1$
121 * Command to add a context to channels and/or events
123 String COMMAND_ADD_CONTEXT
= "add-context"; //$NON-NLS-1$
125 * Command to execute calibrate command to quantify LTTng overhead
127 String COMMAND_CALIBRATE
= "calibrate"; //$NON-NLS-1$
129 * Command to execute sub-command snapshot
131 String COMMAND_SNAPSHOT
= "snapshot"; //$NON-NLS-1$
133 * Command to list the snapshot outputs
135 String COMMAND_LIST_SNAPSHOT_OUTPUT
= "list-output"; //$NON-NLS-1$
137 * Command to record a snapshot
139 String COMMAND_RECORD_SNAPSHOT
= "record"; //$NON-NLS-1$
141 * Command to load a session.
143 String COMMAND_LOAD_SESSION
= "load"; //$NON-NLS-1$
145 * Command to save a session
147 String COMMAND_SAVE_SESSION
= "save"; //$NON-NLS-1$
149 // ------------------------------------------------------------------------
150 // Command line options constants
151 // ------------------------------------------------------------------------
153 * Command line option to add tracing group of user.
155 String OPTION_TRACING_GROUP
= "-g"; //$NON-NLS-1$
157 * Command line option for verbose output.
159 String OPTION_VERBOSE
= "-v"; //$NON-NLS-1$
161 * Command line option for verbose output.
163 String OPTION_VERY_VERBOSE
= "-vv"; //$NON-NLS-1$
165 * Command line option for verbose output.
167 String OPTION_VERY_VERY_VERBOSE
= "-vvv"; //$NON-NLS-1$
169 * Command line option for output path.
171 String OPTION_OUTPUT_PATH
= "-o"; //$NON-NLS-1$
173 * Command line option for output path.
175 String OPTION_SNAPSHOT
= "--snapshot"; //$NON-NLS-1$
177 * Command line option for live
179 String OPTION_LIVE
= "--live"; //$NON-NLS-1$
181 * Command line option for kernel tracer.
183 String OPTION_KERNEL
= "-k"; //$NON-NLS-1$
185 * Command line option for UST tracer.
187 String OPTION_UST
= "-u"; //$NON-NLS-1$
189 * Command line option for specifying a session.
191 String OPTION_SESSION
= "-s"; //$NON-NLS-1$
193 * Command line option for specifying a channel.
195 String OPTION_CHANNEL
= "-c"; //$NON-NLS-1$
197 * Command line option for specifying a event.
199 String OPTION_EVENT
= "-e"; //$NON-NLS-1$
201 * Command line option for specifying all events.
203 String OPTION_ALL
= "-a"; //$NON-NLS-1$
205 * Command line option for specifying a context.
207 String OPTION_CONTEXT_TYPE
= "-t"; //$NON-NLS-1$
209 * Command line option for specifying tracepoint events.
211 String OPTION_TRACEPOINT
= "--tracepoint"; //$NON-NLS-1$
213 * Command line option for specifying syscall events.
215 String OPTION_SYSCALL
= "--syscall"; //$NON-NLS-1$
217 * Command line option for specifying a dynamic probe.
219 String OPTION_PROBE
= "--probe"; //$NON-NLS-1$
221 * Command line option for specifying a dynamic function entry/return probe.
223 String OPTION_FUNCTION_PROBE
= "--function"; //$NON-NLS-1$
225 * Command line option for specifying a log level range.
227 String OPTION_LOGLEVEL
= "--loglevel"; //$NON-NLS-1$
229 * Command line option for specifying a specific log level.
231 String OPTION_LOGLEVEL_ONLY
= "--loglevel-only"; //$NON-NLS-1$
233 * Optional command line option for configuring a channel's overwrite mode.
235 String OPTION_OVERWRITE
= "--overwrite"; //$NON-NLS-1$
237 * Optional command line option for configuring a channel's number of sub buffers.
239 String OPTION_NUM_SUB_BUFFERS
= "--num-subbuf"; //$NON-NLS-1$
241 * Optional command line option for configuring a channel's sub buffer size.
243 String OPTION_SUB_BUFFER_SIZE
= "--subbuf-size"; //$NON-NLS-1$
245 * Optional command line option for configuring a channel's switch timer interval.
247 String OPTION_SWITCH_TIMER
= "--switch-timer"; //$NON-NLS-1$
249 * Optional command line option for configuring a channel's read timer interval.
251 String OPTION_READ_TIMER
= "--read-timer"; //$NON-NLS-1$
253 * Command line option for printing the help of a specif command
255 String OPTION_HELP
= "-h"; //$NON-NLS-1$
257 * Command line option for listing the fields of UST tracepoints
259 String OPTION_FIELDS
= "-f"; //$NON-NLS-1$
261 * Command line option for configuring event's filter
263 String OPTION_FILTER
= "--filter"; //$NON-NLS-1$
265 * Command line option for configuring the streaming network URL (common for control and data channel).
267 String OPTION_NETWORK_URL
= "-U"; //$NON-NLS-1$
269 * Command line option for configuring the streaming control URL.
271 String OPTION_CONTROL_URL
= "-C"; //$NON-NLS-1$
273 * Command line option for configuring the streaming data URL.
275 String OPTION_DATA_URL
= "-D"; //$NON-NLS-1$
277 * Command line option for per UID buffers
279 String OPTION_PER_UID_BUFFERS
= "--buffers-uid"; //$NON-NLS-1$
281 * Command line option for per PID buffers
283 String OPTION_PER_PID_BUFFERS
= "--buffers-pid"; //$NON-NLS-1$
285 * Command line option for maximum size of trace files
287 String OPTION_MAX_SIZE_TRACE_FILES
= "-C"; //$NON-NLS-1$
289 * Command line option for maximum trace files
291 String OPTION_MAX_TRACE_FILES
= "-W"; //$NON-NLS-1$
293 * Command line option for force overwrite
295 String OPTION_FORCE
= "-f"; //$NON-NLS-1$
297 * Command line option for specifying input path
299 String OPTION_INPUT_PATH
= "-i"; //$NON-NLS-1$
301 * Maximum live timer interval value
303 Long MAX_LIVE_TIMER_INTERVAL
= 0xFFFFFFFEL
;
305 // ------------------------------------------------------------------------
307 // ------------------------------------------------------------------------
309 * Pattern to match the version.
311 Pattern VERSION_PATTERN
= checkNotNull(Pattern
.compile(".*lttng\\s+version\\s+.*(\\d+\\.\\d+\\.\\d+).*")); //$NON-NLS-1$
313 * Pattern to match for error output
315 Pattern ERROR_PATTERN
= checkNotNull(Pattern
.compile("\\s*Error\\:.*")); //$NON-NLS-1$
317 * Pattern to match for session information (lttng list)
319 Pattern SESSION_PATTERN
= checkNotNull(Pattern
.compile("\\s+(\\d+)\\)\\s+(.*)\\s+\\((.*)\\)\\s+\\[(active|inactive).*\\].*")); //$NON-NLS-1$
321 * Pattern to match for session information (lttng list <session>)
323 Pattern TRACE_SESSION_PATTERN
= checkNotNull(Pattern
.compile("\\s*Tracing\\s+session\\s+(.*)\\:\\s+\\[(active|inactive)\\].*")); //$NON-NLS-1$
325 * Pattern to match for snapshot session information (lttng list <session>)
327 Pattern TRACE_SNAPSHOT_SESSION_PATTERN
= checkNotNull(Pattern
.compile("\\s*Tracing\\s+session\\s+(.*)\\:\\s+\\[(active|inactive)\\s*snapshot\\].*")); //$NON-NLS-1$
329 * Pattern to match for session path information (lttng list <session>)
331 Pattern TRACE_SESSION_PATH_PATTERN
= checkNotNull(Pattern
.compile("\\s*Trace\\s+path\\:\\s+(.*)")); //$NON-NLS-1$
333 * Pattern to match session path for network tracing (lttng list <session>)
334 * Note: file for protocol is not considered as network trace since local consumer will be used.
336 Pattern TRACE_NETWORK_PATH_PATTERN
= checkNotNull(Pattern
.compile("\\s*Trace\\s+path\\:\\s+(net|net4|net6|tcp|tcp4|tcp6)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}")); //$NON-NLS-1$
338 * Pattern to match session path for network tracing
339 * Note: file for protocol is not considered as network trace since local consumer will be used.
341 Pattern TRACE_NETWORK_PATTERN
= checkNotNull(Pattern
.compile("\\s*(net|net4|net6|tcp|tcp4|tcp6)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}")); //$NON-NLS-1$
343 * Sub-pattern to pattern TRACE_NETWORK_PATH_PATTERN to match file protocol
345 Pattern TRACE_FILE_PROTOCOL_PATTERN
= checkNotNull(Pattern
.compile("(file)\\:\\/\\/(.*)")); //$NON-NLS-1$
347 * Pattern to match for kernel domain information (lttng list <session>)
349 Pattern DOMAIN_KERNEL_PATTERN
= checkNotNull(Pattern
.compile("=== Domain: Kernel ===")); //$NON-NLS-1$
351 * Pattern to match for ust domain information (lttng list <session>)
353 Pattern DOMAIN_UST_GLOBAL_PATTERN
= checkNotNull(Pattern
.compile("=== Domain: UST global ===")); //$NON-NLS-1$
355 * Pattern to match for matching warning about no kernel channel
357 Pattern DOMAIN_NO_KERNEL_CHANNEL_PATTERN
= checkNotNull(Pattern
.compile("\\s*Warning\\:\\s+No kernel\\s+channel.*")); //$NON-NLS-1$
359 * Pattern to match for matching warning about no UST channel
361 Pattern DOMAIN_NO_UST_CHANNEL_PATTERN
= checkNotNull(Pattern
.compile("\\s*Error\\:\\s+UST\\s+channel\\s+not\\s+found.*")); //$NON-NLS-1$
363 * Pattern to match for buffer type (lttng list <session>)
365 Pattern BUFFER_TYPE_PATTERN
= checkNotNull(Pattern
.compile("\\s*Buffer\\s+type\\:.*")); //$NON-NLS-1$
367 * Pattern to match for channels section (lttng list <session>)
369 Pattern CHANNELS_SECTION_PATTERN
= checkNotNull(Pattern
.compile("\\s*Channels\\:")); //$NON-NLS-1$
371 * Pattern to match for channel information (lttng list <session>)
373 Pattern CHANNEL_PATTERN
= checkNotNull(Pattern
.compile("\\s*-\\s+(.*)\\:\\s+\\[(enabled|disabled)\\]")); //$NON-NLS-1$
375 * Pattern to match for events section information (lttng list <session>)
377 Pattern EVENT_SECTION_PATTERN
= checkNotNull(Pattern
.compile("\\s*Events\\:")); //$NON-NLS-1$
379 * Pattern to match for event information (lttng list <session>)
381 Pattern EVENT_PATTERN
= checkNotNull(Pattern
.compile("\\s+(.*)\\s+\\(loglevel\\s*(:|<=|==)\\s+(.*)\\s+\\(\\d*\\)\\)\\s+\\(type:\\s+(.*)\\)\\s+\\[(enabled|disabled)\\]\\s*(\\[.*\\]){0,1}.*")); //$NON-NLS-1$
383 * Pattern to match a wildcarded event information (lttng list <session>)
385 Pattern WILDCARD_EVENT_PATTERN
= checkNotNull(Pattern
.compile("\\s+(.*)\\s+\\(type:\\s+(.*)\\)\\s+\\[(enabled|disabled)\\]\\s*(\\[.*\\]){0,1}.*")); //$NON-NLS-1$
387 * Pattern to match a probe address information (lttng list <session>)
389 Pattern PROBE_ADDRESS_PATTERN
= checkNotNull(Pattern
.compile("\\s+(addr)\\:\\s+(0x[0-9a-fA-F]{1,16})")); //$NON-NLS-1$
391 * Pattern to match a probe OFFSET information (lttng list <session>)
393 Pattern PROBE_OFFSET_PATTERN
= checkNotNull(Pattern
.compile("\\s+(offset)\\:\\s+(0x[0-9a-fA-F]{1,16})")); //$NON-NLS-1$
395 * Pattern to match a probe SYMBOL information (lttng list <session>)
397 Pattern PROBE_SYMBOL_PATTERN
= checkNotNull(Pattern
.compile("\\s+(symbol)\\:\\s+(.+)")); //$NON-NLS-1$
399 * Pattern to match for channel (overwite mode) information (lttng list <session>)
401 Pattern OVERWRITE_MODE_ATTRIBUTE
= checkNotNull(Pattern
.compile("\\s+overwrite\\s+mode\\:.*")); //$NON-NLS-1$
403 * Pattern to match indicating false for overwrite mode
405 String OVERWRITE_MODE_ATTRIBUTE_FALSE
= "0"; //$NON-NLS-1$
407 * Pattern to match indicating false for overwrite mode in machine interface mode
409 String OVERWRITE_MODE_ATTRIBUTE_FALSE_MI
= "DISCARD"; //$NON-NLS-1$
411 * Pattern to match for channel (sub-buffer size) information (lttng list <session>)
413 Pattern SUBBUFFER_SIZE_ATTRIBUTE
= checkNotNull(Pattern
.compile("\\s+subbufers\\s+size\\:.*")); //$NON-NLS-1$
415 * Pattern to match for channel (number of sub-buffers) information (lttng list <session>)
417 Pattern NUM_SUBBUFFERS_ATTRIBUTE
= checkNotNull(Pattern
.compile("\\s+number\\s+of\\s+subbufers\\:.*")); //$NON-NLS-1$
419 * Pattern to match for channel (switch timer) information (lttng list <session>)
421 Pattern SWITCH_TIMER_ATTRIBUTE
= checkNotNull(Pattern
.compile("\\s+switch\\s+timer\\s+interval\\:.*")); //$NON-NLS-1$
423 * Pattern to match for channel (read timer) information (lttng list <session>)
425 Pattern READ_TIMER_ATTRIBUTE
= checkNotNull(Pattern
.compile("\\s+read\\s+timer\\s+interval\\:.*")); //$NON-NLS-1$
427 * Pattern to match for channel (output type) information (lttng list <session>)
429 Pattern OUTPUT_ATTRIBUTE
= checkNotNull(Pattern
.compile("\\s+output\\:.*")); //$NON-NLS-1$
431 * Pattern to match for channel (trace file size) information (lttng list <session>)
433 Pattern TRACE_FILE_COUNT_ATTRIBUTE
= checkNotNull(Pattern
.compile("\\s+trace\\s+file\\s+count\\:.*")); //$NON-NLS-1$
435 * Pattern to match for channel (trace file size) information (lttng list <session>)
437 Pattern TRACE_FILE_SIZE_ATTRIBUTE
= checkNotNull(Pattern
.compile("\\s+trace\\s+file\\s+size\\s+\\(bytes\\)\\:.*")); //$NON-NLS-1$
439 * Pattern to match for provider information (lttng list -k/-u)
441 Pattern PROVIDER_EVENT_PATTERN
= checkNotNull(Pattern
.compile("\\s*(.*)\\s+\\(loglevel:\\s+(.*)\\s+\\(\\d*\\)\\)\\s+\\(type:\\s+(.*)\\)")); //$NON-NLS-1$
443 * Pattern to match event fields
445 Pattern EVENT_FIELD_PATTERN
= checkNotNull(Pattern
.compile("\\s*(field:)\\s+(.*)\\s+\\((.*)\\)")); //$NON-NLS-1$
447 * Pattern to match for UST provider information (lttng list -u)
449 Pattern UST_PROVIDER_PATTERN
= checkNotNull(Pattern
.compile("\\s*PID\\:\\s+(\\d+)\\s+-\\s+Name\\:\\s+(.*)")); //$NON-NLS-1$
451 * Pattern to match for session information (lttng create <session name>)
453 Pattern CREATE_SESSION_NAME_PATTERN
= checkNotNull(Pattern
.compile(".*Session\\s+(.*)\\s+created\\.")); //$NON-NLS-1$
455 * Pattern to match for session path information (lttng create <session name>)
457 Pattern CREATE_SESSION_PATH_PATTERN
= checkNotNull(Pattern
.compile("\\s*Traces\\s+will\\s+be\\s+written\\s+in\\s+(.*).*")); //$NON-NLS-1$
459 * Pattern to match for session command output for "session name not found".
461 Pattern SESSION_NOT_FOUND_ERROR_PATTERN
= checkNotNull(Pattern
.compile("\\s*Error:\\s+Session\\s+name\\s.*not\\s+found")); //$NON-NLS-1$
463 * Pattern to match introduction line of context list.
465 Pattern ADD_CONTEXT_HELP_CONTEXTS_INTRO
= checkNotNull(Pattern
.compile("\\s*TYPE can\\s+be\\s+one\\s+of\\s+the\\s+strings\\s+below.*")); //$NON-NLS-1$
467 * Pattern to match introduction line of context list.
469 Pattern ADD_CONTEXT_HELP_CONTEXTS_END_LINE
= checkNotNull(Pattern
.compile("\\s*Example.*")); //$NON-NLS-1$
471 * Pattern to match error line if no kernel tracer is available or installed.
473 Pattern LIST_KERNEL_NO_KERNEL_PROVIDER_PATTERN
= checkNotNull(Pattern
.compile("\\s*Error:\\s+Unable\\s+to\\s+list\\s+kernel\\s+events.*")); //$NON-NLS-1$;
475 * Pattern to match error line if no ust tracer is available or installed.
477 Pattern LIST_UST_NO_UST_PROVIDER_PATTERN
= checkNotNull(Pattern
.compile(".*Unable\\s*to\\s*list\\s*UST\\s*event.*")); //$NON-NLS-1$;
479 * Pattern to match for list snapshot information (lttng snapshot list-output)
481 Pattern LIST_SNAPSHOT_OUTPUT_PATTERN
= checkNotNull(Pattern
.compile("\\s+\\[(\\d+)\\]\\s+(\\S*)\\:\\s+(\\S*)(.*)")); //$NON-NLS-1$
483 * Pattern to match the live timer interval line of session list.
485 Pattern LIST_LIVE_TIMER_INTERVAL_PATTERN
= checkNotNull(Pattern
.compile("\\s*Live\\stimer\\sinterval\\s\\(usec\\):\\s(\\d+)")); //$NON-NLS-1$
487 * Pattern to match snapshot path for network tracing (lttng list <session>)
488 * Note: file for protocol is not considered as network trace since local consumer will be used.
490 Pattern SNAPSHOT_NETWORK_PATH_PATTERN
= checkNotNull(Pattern
.compile("(net|net4|net6|tcp|tcp4|tcp6)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}")); //$NON-NLS-1$