| 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 sessionInfo |
| 126 | * the session information used to create the session |
| 127 | * @param monitor |
| 128 | * - a progress monitor |
| 129 | * |
| 130 | * @return the session information |
| 131 | * @throws ExecutionException |
| 132 | * If the command fails |
| 133 | */ |
| 134 | ISessionInfo createSession(ISessionInfo sessionInfo, IProgressMonitor monitor) throws ExecutionException; |
| 135 | |
| 136 | /** |
| 137 | * Destroys a session with given session name. |
| 138 | * |
| 139 | * @param sessionName |
| 140 | * - a session name to destroy |
| 141 | * @param monitor |
| 142 | * - a progress monitor |
| 143 | * @throws ExecutionException |
| 144 | * If the command fails |
| 145 | */ |
| 146 | void destroySession(String sessionName, IProgressMonitor monitor) |
| 147 | throws ExecutionException; |
| 148 | |
| 149 | /** |
| 150 | * Starts a session with given session name. |
| 151 | * |
| 152 | * @param sessionName |
| 153 | * - a session name to start |
| 154 | * @param monitor |
| 155 | * - a progress monitor |
| 156 | * @throws ExecutionException |
| 157 | * If the command fails |
| 158 | */ |
| 159 | void startSession(String sessionName, IProgressMonitor monitor) |
| 160 | throws ExecutionException; |
| 161 | |
| 162 | /** |
| 163 | * Stops a session with given session name. |
| 164 | * |
| 165 | * @param sessionName |
| 166 | * - a session name to stop |
| 167 | * @param monitor |
| 168 | * - a progress monitor |
| 169 | * @throws ExecutionException |
| 170 | * If the command fails |
| 171 | */ |
| 172 | void stopSession(String sessionName, IProgressMonitor monitor) |
| 173 | throws ExecutionException; |
| 174 | |
| 175 | /** |
| 176 | * Enables a list of channels for given session and given channel |
| 177 | * information (configuration). |
| 178 | * |
| 179 | * @param sessionName |
| 180 | * - a session name to create |
| 181 | * @param channelNames |
| 182 | * - a list of channel names to be enabled |
| 183 | * @param isKernel |
| 184 | * - a flag to indicate Kernel or UST (true for Kernel, false for |
| 185 | * UST) |
| 186 | * @param info |
| 187 | * - channel information used for creation of a channel (or null |
| 188 | * for default) |
| 189 | * @param monitor |
| 190 | * - a progress monitor |
| 191 | * @throws ExecutionException |
| 192 | * If the command fails |
| 193 | */ |
| 194 | void enableChannels(String sessionName, List<String> channelNames, |
| 195 | boolean isKernel, IChannelInfo info, IProgressMonitor monitor) |
| 196 | throws ExecutionException; |
| 197 | |
| 198 | /** |
| 199 | * Disables a list of channels for given session and given channel |
| 200 | * information (configuration). |
| 201 | * |
| 202 | * @param sessionName |
| 203 | * - a session name to create |
| 204 | * @param channelNames |
| 205 | * - a list of channel names to be enabled |
| 206 | * @param isKernel |
| 207 | * - a flag to indicate Kernel or UST (true for Kernel, false for |
| 208 | * UST) |
| 209 | * @param monitor |
| 210 | * - a progress monitor |
| 211 | * @throws ExecutionException |
| 212 | * If the command fails |
| 213 | */ |
| 214 | void disableChannels(String sessionName, List<String> channelNames, |
| 215 | boolean isKernel, IProgressMonitor monitor) |
| 216 | throws ExecutionException; |
| 217 | |
| 218 | /** |
| 219 | * Enables a list of events with no additional parameters. |
| 220 | * |
| 221 | * @param sessionName |
| 222 | * - a session name |
| 223 | * @param channelName |
| 224 | * - a channel name or null for default channel |
| 225 | * @param eventNames |
| 226 | * - a list of event names to be enabled, or null (list of size = |
| 227 | * 0)for all events . |
| 228 | * @param isKernel |
| 229 | * - a flag for indicating kernel or UST. |
| 230 | * @param filterExpression |
| 231 | * - a filter expression |
| 232 | * @param monitor |
| 233 | * - a progress monitor |
| 234 | * @throws ExecutionException |
| 235 | * If the command fails |
| 236 | */ |
| 237 | void enableEvents(String sessionName, String channelName, |
| 238 | List<String> eventNames, boolean isKernel, String filterExpression, |
| 239 | IProgressMonitor monitor) |
| 240 | throws ExecutionException; |
| 241 | |
| 242 | |
| 243 | /** |
| 244 | * Enables all syscall events. |
| 245 | * |
| 246 | * @param sessionName |
| 247 | * - a session name |
| 248 | * @param channelName |
| 249 | * - a channel name or null for default channel |
| 250 | * @param monitor |
| 251 | * - a progress monitor |
| 252 | * @throws ExecutionException |
| 253 | * If the command fails |
| 254 | */ |
| 255 | void enableSyscalls(String sessionName, String channelName, |
| 256 | IProgressMonitor monitor) throws ExecutionException; |
| 257 | |
| 258 | /** |
| 259 | * Enables a dynamic probe or dynamic function entry/return probe. |
| 260 | * |
| 261 | * @param sessionName |
| 262 | * - a session name |
| 263 | * @param channelName |
| 264 | * - a channel name or null for default channel |
| 265 | * @param eventName |
| 266 | * - a event name |
| 267 | * @param isFunction |
| 268 | * - true for dynamic function entry/return probe else false |
| 269 | * @param probe |
| 270 | * - a dynamic probe information |
| 271 | * @param monitor |
| 272 | * - a progress monitor |
| 273 | * @throws ExecutionException |
| 274 | * If the command fails |
| 275 | */ |
| 276 | void enableProbe(String sessionName, String channelName, |
| 277 | String eventName, boolean isFunction, String probe, |
| 278 | IProgressMonitor monitor) throws ExecutionException; |
| 279 | |
| 280 | /** |
| 281 | * Enables events using log level |
| 282 | * |
| 283 | * @param sessionName |
| 284 | * - a session name |
| 285 | * @param channelName |
| 286 | * - a channel name (null for default channel) |
| 287 | * @param eventName |
| 288 | * - a event name |
| 289 | * @param logLevelType |
| 290 | * - a log level type |
| 291 | * @param level |
| 292 | * - a log level |
| 293 | * @param filterExpression |
| 294 | * - a filter expression |
| 295 | * @param monitor |
| 296 | * - a progress monitor |
| 297 | * @throws ExecutionException |
| 298 | * If the command fails |
| 299 | */ |
| 300 | void enableLogLevel(String sessionName, String channelName, |
| 301 | String eventName, LogLevelType logLevelType, TraceLogLevel level, |
| 302 | String filterExpression, |
| 303 | IProgressMonitor monitor) throws ExecutionException; |
| 304 | |
| 305 | /** |
| 306 | * Disables a list of events with no additional parameters. |
| 307 | * |
| 308 | * @param sessionName |
| 309 | * - a session name |
| 310 | * @param channelName |
| 311 | * - a channel name (null for default channel) |
| 312 | * @param eventNames |
| 313 | * - a list of event names to enabled. |
| 314 | * @param isKernel |
| 315 | * - a flag for indicating kernel or UST. |
| 316 | * @param monitor |
| 317 | * - a progress monitor |
| 318 | * @throws ExecutionException |
| 319 | * If the command fails |
| 320 | */ |
| 321 | void disableEvent(String sessionName, String channelName, |
| 322 | List<String> eventNames, boolean isKernel, IProgressMonitor monitor) |
| 323 | throws ExecutionException; |
| 324 | |
| 325 | /** |
| 326 | * Gets all available context names to be added to channels/events. |
| 327 | * |
| 328 | * @param monitor |
| 329 | * The progress monitor |
| 330 | * @return the list of available contexts |
| 331 | * @throws ExecutionException |
| 332 | * If the command fails |
| 333 | */ |
| 334 | List<String> getContextList(IProgressMonitor monitor) |
| 335 | throws ExecutionException; |
| 336 | |
| 337 | /** |
| 338 | * Add contexts to given channels and or events |
| 339 | * |
| 340 | * @param sessionName |
| 341 | * - a session name |
| 342 | * @param channelName |
| 343 | * - a channel name (null for all channels) |
| 344 | * @param eventName |
| 345 | * - a event name (null for all events) |
| 346 | * @param isKernel |
| 347 | * - a flag for indicating kernel or UST. |
| 348 | * @param contexts |
| 349 | * - a list of name of contexts to add |
| 350 | * @param monitor |
| 351 | * - a progress monitor |
| 352 | * @throws ExecutionException |
| 353 | * If the command fails |
| 354 | */ |
| 355 | void addContexts(String sessionName, String channelName, |
| 356 | String eventName, boolean isKernel, List<String> contexts, |
| 357 | IProgressMonitor monitor) throws ExecutionException; |
| 358 | |
| 359 | /** |
| 360 | * Executes calibrate command to quantify LTTng overhead. |
| 361 | * |
| 362 | * @param isKernel |
| 363 | * - a flag for indicating kernel or UST. |
| 364 | * @param monitor |
| 365 | * - a progress monitor |
| 366 | * @throws ExecutionException |
| 367 | * If the command fails |
| 368 | */ |
| 369 | void calibrate(boolean isKernel, IProgressMonitor monitor) |
| 370 | throws ExecutionException; |
| 371 | |
| 372 | /** |
| 373 | * Records a snapshot. |
| 374 | * |
| 375 | * @param sessionName |
| 376 | * - a session name |
| 377 | * @param monitor |
| 378 | * - a progress monitor |
| 379 | * @throws ExecutionException |
| 380 | * If the command fails |
| 381 | */ |
| 382 | void recordSnapshot(String sessionName, IProgressMonitor monitor) |
| 383 | throws ExecutionException; |
| 384 | } |