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