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