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