| 1 | /********************************************************************** |
| 2 | * Copyright (c) 2012, 2013 Ericsson |
| 3 | * |
| 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 |
| 8 | * |
| 9 | * Contributors: |
| 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; |
| 14 | |
| 15 | import java.util.List; |
| 16 | |
| 17 | import org.eclipse.core.commands.ExecutionException; |
| 18 | import org.eclipse.core.runtime.IProgressMonitor; |
| 19 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo; |
| 20 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.IChannelInfo; |
| 21 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo; |
| 22 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISnapshotInfo; |
| 23 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.IUstProviderInfo; |
| 24 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType; |
| 25 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel; |
| 26 | |
| 27 | |
| 28 | /** |
| 29 | * <p> |
| 30 | * Interface for LTTng trace control command service. |
| 31 | * </p> |
| 32 | * |
| 33 | * @author Bernd Hufmann |
| 34 | */ |
| 35 | public interface ILttngControlService { |
| 36 | |
| 37 | /** |
| 38 | * @return the version string. |
| 39 | */ |
| 40 | String getVersion(); |
| 41 | |
| 42 | /** |
| 43 | * Checks if given version is supported by this ILTTngControlService implementation. |
| 44 | * |
| 45 | * @param version The version to check |
| 46 | * @return <code>true</code> if version is supported else <code>false</code> |
| 47 | */ |
| 48 | boolean isVersionSupported(String version); |
| 49 | |
| 50 | /** |
| 51 | * Retrieves the existing sessions names from the node. |
| 52 | * |
| 53 | * @param monitor |
| 54 | * - a progress monitor |
| 55 | * @return an array with session names. |
| 56 | * @throws ExecutionException |
| 57 | * If the command fails |
| 58 | */ |
| 59 | String[] getSessionNames(IProgressMonitor monitor) |
| 60 | throws ExecutionException; |
| 61 | |
| 62 | /** |
| 63 | * Retrieves the session information with the given name the node. |
| 64 | * |
| 65 | * @param sessionName |
| 66 | * - the session name |
| 67 | * @param monitor |
| 68 | * - a progress monitor |
| 69 | * @return session information |
| 70 | * @throws ExecutionException |
| 71 | * If the command fails |
| 72 | */ |
| 73 | ISessionInfo getSession(String sessionName, IProgressMonitor monitor) |
| 74 | throws ExecutionException; |
| 75 | |
| 76 | /** |
| 77 | * Retrieves the snapshot output information from the node |
| 78 | * @param sessionName |
| 79 | * - the session name |
| 80 | * @param monitor |
| 81 | * - a progress monitor |
| 82 | * @return snapshot output information |
| 83 | * @throws ExecutionException |
| 84 | * if command fails |
| 85 | */ |
| 86 | ISnapshotInfo getSnapshotInfo(String sessionName, IProgressMonitor monitor) |
| 87 | throws ExecutionException; |
| 88 | |
| 89 | /** |
| 90 | * Retrieves the kernel provider information (i.e. the kernel events) |
| 91 | * |
| 92 | * @param monitor |
| 93 | * - a progress monitor |
| 94 | * @return the list of existing kernel events. |
| 95 | * @throws ExecutionException |
| 96 | * If the command fails |
| 97 | */ |
| 98 | List<IBaseEventInfo> getKernelProvider(IProgressMonitor monitor) |
| 99 | throws ExecutionException; |
| 100 | |
| 101 | /** |
| 102 | * Retrieves the UST provider information from the node. |
| 103 | * |
| 104 | * @return - the UST provider information. |
| 105 | * @throws ExecutionException |
| 106 | * If the command fails |
| 107 | */ |
| 108 | public List<IUstProviderInfo> getUstProvider() throws ExecutionException; |
| 109 | |
| 110 | /** |
| 111 | * Retrieves the UST provider information from the node. |
| 112 | * |
| 113 | * @param monitor |
| 114 | * - a progress monitor |
| 115 | * @return the UST provider information. |
| 116 | * @throws ExecutionException |
| 117 | * If the command fails |
| 118 | */ |
| 119 | List<IUstProviderInfo> getUstProvider(IProgressMonitor monitor) |
| 120 | throws ExecutionException; |
| 121 | |
| 122 | /** |
| 123 | * Creates a session with given session name and location. |
| 124 | * |
| 125 | * @param sessionName |
| 126 | * - a session name to create |
| 127 | * @param sessionPath |
| 128 | * - a path for storing the traces (use null for default) |
| 129 | * @param isSnapshot |
| 130 | * - true for snapshot session else false |
| 131 | * @param monitor |
| 132 | * - a progress monitor |
| 133 | * @return the session information |
| 134 | * @throws ExecutionException |
| 135 | * If the command fails |
| 136 | */ |
| 137 | ISessionInfo createSession(String sessionName, String sessionPath, boolean isSnapshot, IProgressMonitor monitor) throws ExecutionException; |
| 138 | |
| 139 | /** |
| 140 | * Creates a session with given session name and location. |
| 141 | * |
| 142 | * @param sessionName |
| 143 | * - a session name to create |
| 144 | * @param networkUrl |
| 145 | * - a network URL for common definition of data and control channel |
| 146 | * or null if separate definition of data and control channel |
| 147 | * @param controlUrl |
| 148 | * - a URL for control channel (networkUrl has to be null, dataUrl has to be set) |
| 149 | * @param dataUrl |
| 150 | * - a URL for data channel (networkUrl has to be null, controlUrl has to be set) |
| 151 | * @param isSnapshot |
| 152 | * - true for snapshot session else false |
| 153 | * @param monitor |
| 154 | * - a progress monitor |
| 155 | * @return the session information |
| 156 | * @throws ExecutionException |
| 157 | * If the command fails |
| 158 | */ |
| 159 | ISessionInfo createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, boolean isSnapshot, IProgressMonitor monitor) throws ExecutionException; |
| 160 | |
| 161 | /** |
| 162 | * Destroys a session with given session name. |
| 163 | * |
| 164 | * @param sessionName |
| 165 | * - a session name to destroy |
| 166 | * @param monitor |
| 167 | * - a progress monitor |
| 168 | * @throws ExecutionException |
| 169 | * If the command fails |
| 170 | */ |
| 171 | void destroySession(String sessionName, IProgressMonitor monitor) |
| 172 | throws ExecutionException; |
| 173 | |
| 174 | /** |
| 175 | * Starts a session with given session name. |
| 176 | * |
| 177 | * @param sessionName |
| 178 | * - a session name to start |
| 179 | * @param monitor |
| 180 | * - a progress monitor |
| 181 | * @throws ExecutionException |
| 182 | * If the command fails |
| 183 | */ |
| 184 | void startSession(String sessionName, IProgressMonitor monitor) |
| 185 | throws ExecutionException; |
| 186 | |
| 187 | /** |
| 188 | * Stops a session with given session name. |
| 189 | * |
| 190 | * @param sessionName |
| 191 | * - a session name to stop |
| 192 | * @param monitor |
| 193 | * - a progress monitor |
| 194 | * @throws ExecutionException |
| 195 | * If the command fails |
| 196 | */ |
| 197 | void stopSession(String sessionName, IProgressMonitor monitor) |
| 198 | throws ExecutionException; |
| 199 | |
| 200 | /** |
| 201 | * Enables a list of channels for given session and given channel |
| 202 | * information (configuration). |
| 203 | * |
| 204 | * @param sessionName |
| 205 | * - a session name to create |
| 206 | * @param channelNames |
| 207 | * - a list of channel names to be enabled |
| 208 | * @param isKernel |
| 209 | * - a flag to indicate Kernel or UST (true for Kernel, false for |
| 210 | * UST) |
| 211 | * @param info |
| 212 | * - channel information used for creation of a channel (or null |
| 213 | * for default) |
| 214 | * @param monitor |
| 215 | * - a progress monitor |
| 216 | * @throws ExecutionException |
| 217 | * If the command fails |
| 218 | */ |
| 219 | void enableChannels(String sessionName, List<String> channelNames, |
| 220 | boolean isKernel, IChannelInfo info, IProgressMonitor monitor) |
| 221 | throws ExecutionException; |
| 222 | |
| 223 | /** |
| 224 | * Disables a list of channels for given session and given channel |
| 225 | * information (configuration). |
| 226 | * |
| 227 | * @param sessionName |
| 228 | * - a session name to create |
| 229 | * @param channelNames |
| 230 | * - a list of channel names to be enabled |
| 231 | * @param isKernel |
| 232 | * - a flag to indicate Kernel or UST (true for Kernel, false for |
| 233 | * UST) |
| 234 | * @param monitor |
| 235 | * - a progress monitor |
| 236 | * @throws ExecutionException |
| 237 | * If the command fails |
| 238 | */ |
| 239 | void disableChannels(String sessionName, List<String> channelNames, |
| 240 | boolean isKernel, IProgressMonitor monitor) |
| 241 | throws ExecutionException; |
| 242 | |
| 243 | /** |
| 244 | * Enables a list of events with no additional parameters. |
| 245 | * |
| 246 | * @param sessionName |
| 247 | * - a session name |
| 248 | * @param channelName |
| 249 | * - a channel name or null for default channel |
| 250 | * @param eventNames |
| 251 | * - a list of event names to be enabled, or null (list of size = |
| 252 | * 0)for all events . |
| 253 | * @param isKernel |
| 254 | * - a flag for indicating kernel or UST. |
| 255 | * @param filterExpression |
| 256 | * - a filter expression |
| 257 | * @param monitor |
| 258 | * - a progress monitor |
| 259 | * @throws ExecutionException |
| 260 | * If the command fails |
| 261 | */ |
| 262 | void enableEvents(String sessionName, String channelName, |
| 263 | List<String> eventNames, boolean isKernel, String filterExpression, |
| 264 | IProgressMonitor monitor) |
| 265 | throws ExecutionException; |
| 266 | |
| 267 | |
| 268 | /** |
| 269 | * Enables all syscall events. |
| 270 | * |
| 271 | * @param sessionName |
| 272 | * - a session name |
| 273 | * @param channelName |
| 274 | * - a channel name or null for default channel |
| 275 | * @param monitor |
| 276 | * - a progress monitor |
| 277 | * @throws ExecutionException |
| 278 | * If the command fails |
| 279 | */ |
| 280 | void enableSyscalls(String sessionName, String channelName, |
| 281 | IProgressMonitor monitor) throws ExecutionException; |
| 282 | |
| 283 | /** |
| 284 | * Enables a dynamic probe or dynamic function entry/return probe. |
| 285 | * |
| 286 | * @param sessionName |
| 287 | * - a session name |
| 288 | * @param channelName |
| 289 | * - a channel name or null for default channel |
| 290 | * @param eventName |
| 291 | * - a event name |
| 292 | * @param isFunction |
| 293 | * - true for dynamic function entry/return probe else false |
| 294 | * @param probe |
| 295 | * - a dynamic probe information |
| 296 | * @param monitor |
| 297 | * - a progress monitor |
| 298 | * @throws ExecutionException |
| 299 | * If the command fails |
| 300 | */ |
| 301 | void enableProbe(String sessionName, String channelName, |
| 302 | String eventName, boolean isFunction, String probe, |
| 303 | IProgressMonitor monitor) throws ExecutionException; |
| 304 | |
| 305 | /** |
| 306 | * Enables events using log level |
| 307 | * |
| 308 | * @param sessionName |
| 309 | * - a session name |
| 310 | * @param channelName |
| 311 | * - a channel name (null for default channel) |
| 312 | * @param eventName |
| 313 | * - a event name |
| 314 | * @param logLevelType |
| 315 | * - a log level type |
| 316 | * @param level |
| 317 | * - a log level |
| 318 | * @param filterExpression |
| 319 | * - a filter expression |
| 320 | * @param monitor |
| 321 | * - a progress monitor |
| 322 | * @throws ExecutionException |
| 323 | * If the command fails |
| 324 | */ |
| 325 | void enableLogLevel(String sessionName, String channelName, |
| 326 | String eventName, LogLevelType logLevelType, TraceLogLevel level, |
| 327 | String filterExpression, |
| 328 | IProgressMonitor monitor) throws ExecutionException; |
| 329 | |
| 330 | /** |
| 331 | * Disables a list of events with no additional parameters. |
| 332 | * |
| 333 | * @param sessionName |
| 334 | * - a session name |
| 335 | * @param channelName |
| 336 | * - a channel name (null for default channel) |
| 337 | * @param eventNames |
| 338 | * - a list of event names to enabled. |
| 339 | * @param isKernel |
| 340 | * - a flag for indicating kernel or UST. |
| 341 | * @param monitor |
| 342 | * - a progress monitor |
| 343 | * @throws ExecutionException |
| 344 | * If the command fails |
| 345 | */ |
| 346 | void disableEvent(String sessionName, String channelName, |
| 347 | List<String> eventNames, boolean isKernel, IProgressMonitor monitor) |
| 348 | throws ExecutionException; |
| 349 | |
| 350 | /** |
| 351 | * Gets all available context names to be added to channels/events. |
| 352 | * |
| 353 | * @param monitor |
| 354 | * The progress monitor |
| 355 | * @return the list of available contexts |
| 356 | * @throws ExecutionException |
| 357 | * If the command fails |
| 358 | */ |
| 359 | List<String> getContextList(IProgressMonitor monitor) |
| 360 | throws ExecutionException; |
| 361 | |
| 362 | /** |
| 363 | * Add contexts to given channels and or events |
| 364 | * |
| 365 | * @param sessionName |
| 366 | * - a session name |
| 367 | * @param channelName |
| 368 | * - a channel name (null for all channels) |
| 369 | * @param eventName |
| 370 | * - a event name (null for all events) |
| 371 | * @param isKernel |
| 372 | * - a flag for indicating kernel or UST. |
| 373 | * @param contexts |
| 374 | * - a list of name of contexts to add |
| 375 | * @param monitor |
| 376 | * - a progress monitor |
| 377 | * @throws ExecutionException |
| 378 | * If the command fails |
| 379 | */ |
| 380 | void addContexts(String sessionName, String channelName, |
| 381 | String eventName, boolean isKernel, List<String> contexts, |
| 382 | IProgressMonitor monitor) throws ExecutionException; |
| 383 | |
| 384 | /** |
| 385 | * Executes calibrate command to quantify LTTng overhead. |
| 386 | * |
| 387 | * @param isKernel |
| 388 | * - a flag for indicating kernel or UST. |
| 389 | * @param monitor |
| 390 | * - a progress monitor |
| 391 | * @throws ExecutionException |
| 392 | * If the command fails |
| 393 | */ |
| 394 | void calibrate(boolean isKernel, IProgressMonitor monitor) |
| 395 | throws ExecutionException; |
| 396 | |
| 397 | /** |
| 398 | * Records a snapshot. |
| 399 | * |
| 400 | * @param sessionName |
| 401 | * - a session name |
| 402 | * @param monitor |
| 403 | * - a progress monitor |
| 404 | * @throws ExecutionException |
| 405 | * If the command fails |
| 406 | */ |
| 407 | void recordSnapshot(String sessionName, IProgressMonitor monitor) |
| 408 | throws ExecutionException; |
| 409 | } |