1 /**********************************************************************
2 * Copyright (c) 2012, 2013 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 **********************************************************************/
13 package org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.service
;
15 import java
.util
.regex
.Pattern
;
19 * Constants for LTTng Control Service.
22 * @author Bernd Hufmann
24 interface LTTngControlServiceConstants
{
26 // ------------------------------------------------------------------------
28 // ------------------------------------------------------------------------
30 * Pattern to match the LTTng toolchain version 2.x.y.
32 public static final Pattern VERSION_2_PATTERN
= Pattern
.compile("(2\\.\\d+\\.\\d+).*"); //$NON-NLS-1$
34 // ------------------------------------------------------------------------
36 // ------------------------------------------------------------------------
38 * The lttng tools command.
40 public static final String CONTROL_COMMAND
= "lttng"; //$NON-NLS-1$
42 * Command: lttng version.
44 public static final String COMMAND_VERSION
= " version "; //$NON-NLS-1$
46 * Command: lttng list.
48 public static final String COMMAND_LIST
= " list "; //$NON-NLS-1$
50 * Command to list kernel tracer information.
52 public static final String COMMAND_LIST_KERNEL
= COMMAND_LIST
+ "-k"; //$NON-NLS-1$
54 * Command to list user space trace information.
56 public static final String COMMAND_LIST_UST
= COMMAND_LIST
+ "-u"; //$NON-NLS-1$
58 * Command to create a session.
60 public static final String COMMAND_CREATE_SESSION
= " create "; //$NON-NLS-1$
62 * Command to destroy a session.
64 public static final String COMMAND_DESTROY_SESSION
= " destroy "; //$NON-NLS-1$
66 * Command to destroy a session.
68 public static final String COMMAND_START_SESSION
= " start "; //$NON-NLS-1$
70 * Command to destroy a session.
72 public static final String COMMAND_STOP_SESSION
= " stop "; //$NON-NLS-1$
74 * Command to enable a channel.
76 public static final String COMMAND_ENABLE_CHANNEL
= " enable-channel "; //$NON-NLS-1$
78 * Command to disable a channel.
80 public static final String COMMAND_DISABLE_CHANNEL
= " disable-channel "; //$NON-NLS-1$
82 * Command to enable a event.
84 public static final String COMMAND_ENABLE_EVENT
= " enable-event "; //$NON-NLS-1$
86 * Command to disable a event.
88 public static final String COMMAND_DISABLE_EVENT
= " disable-event "; //$NON-NLS-1$
90 * Command to add a context to channels and/or events
92 public static final String COMMAND_ADD_CONTEXT
= " add-context "; //$NON-NLS-1$
94 * Command to execute calibrate command to quantify LTTng overhead
96 public static final String COMMAND_CALIBRATE
= " calibrate "; //$NON-NLS-1$
98 // ------------------------------------------------------------------------
99 // Command line options constants
100 // ------------------------------------------------------------------------
102 * Command line option to add tracing group of user.
104 public static final String OPTION_TRACING_GROUP
= " -g "; //$NON-NLS-1$
106 * Command line option for verbose output.
108 public static final String OPTION_VERBOSE
= " -v "; //$NON-NLS-1$
110 * Command line option for verbose output.
112 public static final String OPTION_VERY_VERBOSE
= " -vv "; //$NON-NLS-1$
114 * Command line option for verbose output.
116 public static final String OPTION_VERY_VERY_VERBOSE
= " -vvv "; //$NON-NLS-1$
118 * Command line option for output path.
120 public static final String OPTION_OUTPUT_PATH
= " -o "; //$NON-NLS-1$
122 * Command line option for kernel tracer.
124 public static final String OPTION_KERNEL
= " -k "; //$NON-NLS-1$
126 * Command line option for UST tracer.
128 public static final String OPTION_UST
= " -u "; //$NON-NLS-1$
130 * Command line option for specifying a session.
132 public static final String OPTION_SESSION
= " -s "; //$NON-NLS-1$
134 * Command line option for specifying a channel.
136 public static final String OPTION_CHANNEL
= " -c "; //$NON-NLS-1$
138 * Command line option for specifying a event.
140 public static final String OPTION_EVENT
= " -e "; //$NON-NLS-1$
142 * Command line option for specifying all events.
144 public static final String OPTION_ALL
= " -a "; //$NON-NLS-1$
146 * Command line option for specifying a context.
148 public static final String OPTION_CONTEXT_TYPE
= " -t "; //$NON-NLS-1$
150 * Command line option for specifying tracepoint events.
152 public static final String OPTION_TRACEPOINT
= " --tracepoint "; //$NON-NLS-1$
154 * Command line option for specifying syscall events.
156 public static final String OPTION_SYSCALL
= " --syscall "; //$NON-NLS-1$
158 * Command line option for specifying a dynamic probe.
160 public static final String OPTION_PROBE
= " --probe "; //$NON-NLS-1$
162 * Command line option for specifying a dynamic function entry/return probe.
164 public static final String OPTION_FUNCTION_PROBE
= " --function "; //$NON-NLS-1$
166 * Command line option for specifying a log level range.
168 public static final String OPTION_LOGLEVEL
= " --loglevel "; //$NON-NLS-1$
170 * Command line option for specifying a specific log level.
172 public static final String OPTION_LOGLEVEL_ONLY
= " --loglevel-only "; //$NON-NLS-1$
174 * Optional command line option for configuring a channel's overwrite mode.
176 public static final String OPTION_OVERWRITE
= " --overwrite "; //$NON-NLS-1$
178 * Optional command line option for configuring a channel's number of sub buffers.
180 public static final String OPTION_NUM_SUB_BUFFERS
= " --num-subbuf "; //$NON-NLS-1$
182 * Optional command line option for configuring a channel's sub buffer size.
184 public static final String OPTION_SUB_BUFFER_SIZE
= " --subbuf-size "; //$NON-NLS-1$
186 * Optional command line option for configuring a channel's switch timer interval.
188 public static final String OPTION_SWITCH_TIMER
= " --switch-timer "; //$NON-NLS-1$
190 * Optional command line option for configuring a channel's read timer interval.
192 public static final String OPTION_READ_TIMER
= " --read-timer "; //$NON-NLS-1$
194 * Command line option for printing the help of a specif command
196 public static final String OPTION_HELP
= " -h "; //$NON-NLS-1$
198 * Command line option for listing the fields of UST tracepoints
200 public static final String OPTION_FIELDS
= " -f "; //$NON-NLS-1$
202 * Command line option for configuring event's filter
204 public static final String OPTION_FILTER
= " --filter "; //$NON-NLS-1$
206 * Command line option for configuring the streaming network URL (common for control and data channel).
208 public static final String OPTION_NETWORK_URL
= " -U "; //$NON-NLS-1$
210 * Command line option for configuring the streaming control URL.
212 public static final String OPTION_CONTROL_URL
= " -C "; //$NON-NLS-1$
214 * Command line option for configuring the streaming data URL.
216 public static final String OPTION_DATA_URL
= " -D "; //$NON-NLS-1$
218 // ------------------------------------------------------------------------
220 // ------------------------------------------------------------------------
222 * Pattern to match the version.
224 public static final Pattern VERSION_PATTERN
= Pattern
.compile(".*lttng\\s+version\\s+(\\d+\\.\\d+\\.\\d+).*"); //$NON-NLS-1$
226 * Pattern to match for error output
228 public static final Pattern ERROR_PATTERN
= Pattern
.compile("\\s*Error\\:.*"); //$NON-NLS-1$
230 * Pattern to match for session information (lttng list)
232 public static final Pattern SESSION_PATTERN
= Pattern
.compile("\\s+(\\d+)\\)\\s+(.*)\\s+\\((.*)\\)\\s+\\[(active|inactive)\\].*"); //$NON-NLS-1$
234 * Pattern to match for session information (lttng list <session>)
236 public static final Pattern TRACE_SESSION_PATTERN
= Pattern
.compile("\\s*Tracing\\s+session\\s+(.*)\\:\\s+\\[(active|inactive)\\].*"); //$NON-NLS-1$
238 * Pattern to match for session path information (lttng list <session>)
240 public static final Pattern TRACE_SESSION_PATH_PATTERN
= Pattern
.compile("\\s*Trace\\s+path\\:\\s+(.*)"); //$NON-NLS-1$
242 * Pattern to match session path for network tracing (lttng list <session>)
243 * Note: file for protocol is not considered as network trace since local consumer will be used.
245 public static final Pattern TRACE_NETWORK_PATH_PATTERN
= Pattern
.compile("\\s*Trace\\s+path\\:\\s+(net|net6|tcp|tcp6)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$
247 * Sub-pattern to pattern TRACE_NETWORK_PATH_PATTERN to match file protocol
249 public static final Pattern TRACE_FILE_PROTOCOL_PATTERN
= Pattern
.compile("(file)\\:\\/\\/(.*)"); //$NON-NLS-1$
251 * Pattern to match for kernel domain information (lttng list <session>)
253 public static final Pattern DOMAIN_KERNEL_PATTERN
= Pattern
.compile("=== Domain: Kernel ==="); //$NON-NLS-1$
255 * Pattern to match for ust domain information (lttng list <session>)
257 public static final Pattern DOMAIN_UST_GLOBAL_PATTERN
= Pattern
.compile("=== Domain: UST global ==="); //$NON-NLS-1$
259 * Pattern to match for matching warning about no kernel channel
261 public static final Pattern DOMAIN_NO_KERNEL_CHANNEL_PATTERN
= Pattern
.compile("\\s*Warning\\:\\s+No kernel\\s+channel.*"); //$NON-NLS-1$
263 * Pattern to match for matching warning about no UST channel
265 public static final Pattern DOMAIN_NO_UST_CHANNEL_PATTERN
= Pattern
.compile("\\s*Error\\:\\s+UST\\s+channel\\s+not\\s+found.*"); //$NON-NLS-1$
267 * Pattern to match for channels section (lttng list <session>)
269 public static final Pattern CHANNELS_SECTION_PATTERN
= Pattern
.compile("\\s*Channels\\:"); //$NON-NLS-1$
271 * Pattern to match for channel information (lttng list <session>)
273 public static final Pattern CHANNEL_PATTERN
= Pattern
.compile("\\s*-\\s+(.*)\\:\\s+\\[(enabled|disabled)\\]"); //$NON-NLS-1$
275 * Pattern to match for events section information (lttng list <session>)
277 public static final Pattern EVENT_SECTION_PATTERN
= Pattern
.compile("\\s*Events\\:"); //$NON-NLS-1$
279 * Pattern to match for event information (lttng list <session>)
281 public static final Pattern EVENT_PATTERN
= Pattern
.compile("\\s+(.*)\\s+\\(loglevel:\\s+(.*)\\s+\\(\\d*\\)\\)\\s+\\(type:\\s+(.*)\\)\\s+\\[(enabled|disabled)\\]\\s*(\\[.*\\]){0,1}.*"); //$NON-NLS-1$
283 * Pattern to match a wildcarded event information (lttng list <session>)
285 public static final Pattern WILDCARD_EVENT_PATTERN
= Pattern
.compile("\\s+(.*)\\s+\\(type:\\s+(.*)\\)\\s+\\[(enabled|disabled)\\]\\s*(\\[.*\\]){0,1}.*"); //$NON-NLS-1$
287 * Pattern to match a probe address information (lttng list <session>)
289 public static final Pattern PROBE_ADDRESS_PATTERN
= Pattern
.compile("\\s+(addr)\\:\\s+(0x[0-9a-fA-F]{1,8})"); //$NON-NLS-1$
291 * Pattern to match a probe OFFSET information (lttng list <session>)
293 public static final Pattern PROBE_OFFSET_PATTERN
= Pattern
.compile("\\s+(offset)\\:\\s+(0x[0-9a-fA-F]{1,8})"); //$NON-NLS-1$
295 * Pattern to match a probe SYMBOL information (lttng list <session>)
297 public static final Pattern PROBE_SYMBOL_PATTERN
= Pattern
.compile("\\s+(symbol)\\:\\s+(.+)"); //$NON-NLS-1$
299 * Pattern to match for channel (overwite mode) information (lttng list <session>)
301 public static final Pattern OVERWRITE_MODE_ATTRIBUTE
= Pattern
.compile("\\s+overwrite\\s+mode\\:.*"); //$NON-NLS-1$
303 * Pattern to match indicating false for overwrite mode
305 public static final String OVERWRITE_MODE_ATTRIBUTE_FALSE
= "0"; //$NON-NLS-1$
307 * Pattern to match for channel (sub-buffer size) information (lttng list <session>)
309 public static final Pattern SUBBUFFER_SIZE_ATTRIBUTE
= Pattern
.compile("\\s+subbufers\\s+size\\:.*"); //$NON-NLS-1$
311 * Pattern to match for channel (number of sub-buffers) information (lttng list <session>)
313 public static final Pattern NUM_SUBBUFFERS_ATTRIBUTE
= Pattern
.compile("\\s+number\\s+of\\s+subbufers\\:.*"); //$NON-NLS-1$
315 * Pattern to match for channel (switch timer) information (lttng list <session>)
317 public static final Pattern SWITCH_TIMER_ATTRIBUTE
= Pattern
.compile("\\s+switch\\s+timer\\s+interval\\:.*"); //$NON-NLS-1$
319 * Pattern to match for channel (read timer) information (lttng list <session>)
321 public static final Pattern READ_TIMER_ATTRIBUTE
= Pattern
.compile("\\s+read\\s+timer\\s+interval\\:.*"); //$NON-NLS-1$
323 * Pattern to match for channel (output type) information (lttng list <session>)
325 public static final Pattern OUTPUT_ATTRIBUTE
= Pattern
.compile("\\s+output\\:.*"); //$NON-NLS-1$
327 * Pattern to match for provider information (lttng list -k/-u)
329 public static final Pattern PROVIDER_EVENT_PATTERN
= Pattern
.compile("\\s*(.*)\\s+\\(loglevel:\\s+(.*)\\s+\\(\\d*\\)\\)\\s+\\(type:\\s+(.*)\\)"); //$NON-NLS-1$
331 * Pattern to match event fields
333 public static final Pattern EVENT_FIELD_PATTERN
= Pattern
.compile("\\s*(field:)\\s+(.*)\\s+\\((.*)\\)"); //$NON-NLS-1$
335 * Pattern to match for UST provider information (lttng list -u)
337 public static final Pattern UST_PROVIDER_PATTERN
= Pattern
.compile("\\s*PID\\:\\s+(\\d+)\\s+-\\s+Name\\:\\s+(.*)"); //$NON-NLS-1$
339 * Pattern to match for session information (lttng create <session name>)
341 public static final Pattern CREATE_SESSION_NAME_PATTERN
= Pattern
.compile(".*Session\\s+(.*)\\s+created\\."); //$NON-NLS-1$
343 * Pattern to match for session path information (lttng create <session name>)
345 public static final Pattern CREATE_SESSION_PATH_PATTERN
= Pattern
.compile("\\s*Traces\\s+will\\s+be\\s+written\\s+in\\s+(.*).*"); //$NON-NLS-1$
347 * Pattern to match for session command output for "session name not found".
349 public static final Pattern SESSION_NOT_FOUND_ERROR_PATTERN
= Pattern
.compile("\\s*Error:\\s+Session\\s+name\\s+not\\s+found"); //$NON-NLS-1$
351 * Pattern to match introduction line of context list.
353 public 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$
355 * Pattern to match introduction line of context list.
357 public static final Pattern ADD_CONTEXT_HELP_CONTEXTS_END_LINE
= Pattern
.compile("\\s*Example.*"); //$NON-NLS-1$
359 * Pattern to match error line if no kernel tracer is available or installed.
361 public 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$;
363 * Pattern to match error line if no ust tracer is available or installed.
365 public static final Pattern LIST_UST_NO_UST_PROVIDER_PATTERN
= Pattern
.compile(".*Unable\\s*to\\s*list\\s*UST\\s*event.*"); //$NON-NLS-1$;