Upon successful operation, the tree in the Control View will be refreshed with the remote host configuration.
-=== Quantifing LTTng overhead (Calibrate) ===
-
-The LTTng calibrate command can be used to find out the combined average overhead of the LTTng tracer and the instrumentation mechanisms used. For now, the only calibration implemented is that of the kernel function
-instrumentation (kretprobes). To run the calibrate command, select the a domain (e.g. '''Kernel'''), click the right mouse button on the domain tree node. A context-sensitive menu will show. Select the '''Calibrate''' menu item.
-
-[[Image:images/LTTng2CalibrateAction.png]]
-
-Upon successful operation, the calibrate command is executed and relevant information is stored in the trace. Note: that the trace has to be active so that to command as any effect.
-
=== Importing Session Traces to a Tracing Project ===
To import traces from a tracing session, select the relevant session and click on the '''Import''' Button. Alternatively, click the right mouse button on the session tree node and select the menu item '''Import...''' from the context-sensitive menu.
// Currently there is nothing to verify because the list commands don't show any context information
// However, the execution of the command make sure that the correct service command line is build and executed.
- // ------------------------------------------------------------------------
- // Calibrate
- // ------------------------------------------------------------------------
- // Get Kernel domain component instance
- domains = session.getChildren();
- assertNotNull(domains);
- assertEquals(1, domains.length);
-
- fFacility.executeCommand(domains[0], "calibrate");
- // There is nothing to verify here.
- // However, the execution of the command make sure that the correct service command line is build and executed.
-
// ------------------------------------------------------------------------
// refresh
// ------------------------------------------------------------------------
private static final String SCEN_EVENT_HANDLING = "EventHandling";
private static final String SCEN_CONTEXT_HANDLING = "ContextHandling";
private static final String SCEN_CONTEXT_ERROR_HANDLING = "ContextErrorHandling";
- private static final String SCEN_CALIBRATE_HANDLING = "CalibrateHandling";
private static final String SCEN_CREATE_SESSION_2_1 = "CreateSessionLttng2.1";
private static final String SCEN_CREATE_SESSION_VERBOSE_2_1 = "CreateSessionLttngVerbose2.1";
private static final String SCEN_CREATE_SNAPSHOT_SESSION = "CreateSessionSnapshot";
}
}
- @Test
- public void testCalibrate() {
- try {
- fShell.setScenario(SCEN_CALIBRATE_HANDLING);
- fService.calibrate(true, new NullProgressMonitor());
-
- } catch (ExecutionException e) {
- fail(e.toString());
- }
- }
-
- @Test
- public void testCalibrateFailure() {
- try {
- fShell.setScenario(SCEN_CALIBRATE_HANDLING);
- fService.calibrate(false, new NullProgressMonitor());
- fail("No exeption generated");
- } catch (ExecutionException e) {
- // success
- }
- }
-
@Test
public void testCreateSession2_1() {
lttng is free software and under the GPL license and part LGPL
</COMMAND_OUTPUT>
-
<COMMAND_INPUT>
lttng list
</COMMAND_INPUT>
</COMMAND_OUTPUT>
-<COMMAND_INPUT>
-lttng calibrate -k --function
-</COMMAND_INPUT>
-<COMMAND_RESULT>
-0
-</COMMAND_RESULT>
-<COMMAND_OUTPUT>
-Kernel calibration done
-</COMMAND_OUTPUT>
-
</SCENARIO>
<SCENARIO>
</SCENARIO>
-<SCENARIO>
-CalibrateHandling
-<COMMAND_INPUT>
-lttng --mi xml calibrate -k --function
-</COMMAND_INPUT>
-<COMMAND_RESULT>
-0
-</COMMAND_RESULT>
-<COMMAND_OUTPUT>
-<?xml version="1.0" encoding="UTF-8"?>
-<command>
- <name>calibrate</name>
- <output>
- <calibrate>
- <type>FUNCTION</type>
- </calibrate>
- </output>
- <success>true</success>
-</command>
-</COMMAND_OUTPUT>
-
-<COMMAND_INPUT>
-lttng --mi xml calibrate -u --function
-</COMMAND_INPUT>
-<COMMAND_RESULT>
-1
-</COMMAND_RESULT>
-<COMMAND_OUTPUT>
-<?xml version="1.0" encoding="UTF-8"?>
-<command>
- <name>calibrate</name>
- <output>
- <calibrate>
- <type>FUNCTION</type>
- </calibrate>
- </output>
- <success>true</success>
-</command>
-</COMMAND_OUTPUT>
-
-</SCENARIO>
-
####################################################################
# Scenario: Test "lttng create <session> with LTTng 2.1 options
####################################################################
</SCENARIO>
-<SCENARIO>
-CalibrateHandling
-<COMMAND_INPUT>
-lttng calibrate -k --function
-</COMMAND_INPUT>
-<COMMAND_RESULT>
-0
-</COMMAND_RESULT>
-<COMMAND_OUTPUT>
-Kernel calibration done
-</COMMAND_OUTPUT>
-
-<COMMAND_INPUT>
-lttng calibrate -u --function
-</COMMAND_INPUT>
-<COMMAND_RESULT>
-1
-</COMMAND_RESULT>
-<COMMAND_OUTPUT>
-Kernel calibration done
-</COMMAND_OUTPUT>
-
-</SCENARIO>
-
####################################################################
# Scenario: Test "lttng create <session> with LTTng 2.1 options
####################################################################
commands.control.record=Record...
commands.control.record.description=Record a tracing session with basic options
-commands.control.calibrate=Calibrate
-commands.control.calibrate.description=Quantify LTTng overhead
-
commands.control.snapshot=Record Snapshot
commands.control.snapshot.description=Record a snapshot
name="%commands.control.import">
</command>
- <command
- categoryId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.category"
- description="%commands.control.calibrate.description"
- id="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.calibrate"
- name="%commands.control.calibrate">
- </command>
-
<command
categoryId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.category"
description="%commands.control.snapshot.description"
</with>
</visibleWhen>
</command>
- <command
- commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.calibrate"
- icon="icons/elcl16/calibrate.gif"
- label="%commands.control.calibrate"
- style="push">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeMenuSelection">
- <and>
- <iterate
- operator="or">
- <instanceof
- value="org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceDomainComponent">
- </instanceof>
- </iterate>
- <count
- value="1">
- </count>
- </and>
- </with>
- </visibleWhen>
- </command>
<command
commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.snapshot"
</activeWhen>
</handler>
- <handler
- class="org.eclipse.tracecompass.internal.lttng2.control.ui.views.handlers.CalibrateHandler"
- commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.calibrate">
- <activeWhen>
- <with
- variable="selection">
- <iterate
- operator="or">
- <instanceof
- value="org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceDomainComponent">
- </instanceof>
- </iterate>
- </with>
- </activeWhen>
- </handler>
-
<handler
class="org.eclipse.tracecompass.internal.lttng2.control.ui.views.handlers.AddContextOnChannelHandler"
commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.addContextOnChannel">
+++ /dev/null
-/**********************************************************************
- * Copyright (c) 2012, 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Bernd Hufmann - Initial API and implementation
- **********************************************************************/
-package org.eclipse.tracecompass.internal.lttng2.control.ui.views.handlers;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
-import java.util.Iterator;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.tracecompass.internal.lttng2.control.ui.Activator;
-import org.eclipse.tracecompass.internal.lttng2.control.ui.views.ControlView;
-import org.eclipse.tracecompass.internal.lttng2.control.ui.views.messages.Messages;
-import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceDomainComponent;
-import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * <p>
- * Command handler implementation to execute command calibrate to quantify LTTng overhead.
- * </p>
- *
- * @author Bernd Hufmann
- */
-public class CalibrateHandler extends BaseControlViewHandler {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
- /**
- * The command execution parameter.
- */
- protected DomainCommandParameter fParam = null;
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-
- if (window == null) {
- return false;
- }
- fLock.lock();
- try {
-
- DomainCommandParameter tmpParam = fParam;
- if (tmpParam == null) {
- return null;
- }
-
- // Make a copy for thread safety
- final DomainCommandParameter param = tmpParam.clone();
-
- Job addJob = new Job(Messages.TraceControl_AddCalibrateJob) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- param.getDomain().calibrate(monitor);
- } catch (ExecutionException e) {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_AddCalibrateFailure, e);
- }
-
- return Status.OK_STATUS;
- }
- };
- addJob.setUser(true);
- addJob.schedule();
-
- } finally {
- fLock.unlock();
- }
- return Status.OK_STATUS;
- }
-
- @Override
- public boolean isEnabled() {
-
- // Get workbench page for the Control View
- IWorkbenchPage page = getWorkbenchPage();
- if (page == null) {
- return false;
- }
-
- TraceDomainComponent domain = null;
- TraceSessionComponent session = null;
-
- // Check if one domain is selected
- ISelection selection = page.getSelection(ControlView.ID);
- if (selection instanceof StructuredSelection) {
- StructuredSelection structered = ((StructuredSelection) selection);
- for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = iterator.next();
- if (element instanceof TraceDomainComponent) {
- TraceDomainComponent tmpDomain = (TraceDomainComponent) element;
- session = (TraceSessionComponent) tmpDomain.getParent();
-
- // Add only TraceDomainComponent whose TraceSessionComponent parent is not destroyed
- if ((!session.isDestroyed())) {
- domain = tmpDomain;
- }
- }
- }
- }
-
- boolean isEnabled = domain != null;
-
- fLock.lock();
- try {
- fParam = null;
- if (isEnabled) {
- fParam = new DomainCommandParameter(checkNotNull(session), checkNotNull(domain));
- }
- } finally {
- fLock.unlock();
- }
-
- return isEnabled;
- }
-}
public static String TraceControl_AddContextJob;
public static String TraceControl_AddContextFailure;
- public static String TraceControl_AddCalibrateJob;
- public static String TraceControl_AddCalibrateFailure;
-
public static String TraceControl_RecordSnapshotJob;
public static String TraceControl_RecordSnapshotFailure;
TraceControl_AddContextJob=Adding Contexts...
TraceControl_AddContextFailure=Command to add contexts failed
-TraceControl_AddCalibrateJob=Calibrating...
-TraceControl_AddCalibrateFailure=Command to calibrate failed
-
TraceControl_RecordSnapshotJob=Record snapshot...
TraceControl_RecordSnapshotFailure=Command to snapshot record failed
public void addContexts(String sessionName, String channelName, String eventName, boolean isKernel, List<String> contexts, IProgressMonitor monitor) throws ExecutionException {
}
- @Override
- public void calibrate(boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
- }
-
@Override
public void recordSnapshot(String sessionName, IProgressMonitor monitor) throws ExecutionException {
}
isKernel(), contexts, monitor);
}
- /**
- * Executes calibrate command to quantify LTTng overhead.
- *
- * @param monitor
- * - a progress monitor
- * @throws ExecutionException
- * If the command fails
- */
- public void calibrate(IProgressMonitor monitor) throws ExecutionException {
- getControlService().calibrate(isKernel(), monitor);
- }
}
String eventName, boolean isKernel, List<String> contexts,
IProgressMonitor monitor) throws ExecutionException;
- /**
- * Executes calibrate command to quantify LTTng overhead.
- *
- * @param isKernel
- * - a flag for indicating kernel or UST.
- * @param monitor
- * - a progress monitor
- * @throws ExecutionException
- * If the command fails
- */
- void calibrate(boolean isKernel, IProgressMonitor monitor)
- throws ExecutionException;
-
/**
* Records a snapshot.
*
}
- @Override
- public void calibrate(boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
- ICommandInput command = createCommand(LTTngControlServiceConstants.COMMAND_CALIBRATE);
-
- if (isKernel) {
- command.add(LTTngControlServiceConstants.OPTION_KERNEL);
- } else {
- command.add(LTTngControlServiceConstants.OPTION_UST);
- }
-
- command.add(LTTngControlServiceConstants.OPTION_FUNCTION_PROBE);
-
- executeCommand(command, monitor);
- }
-
@Override
public void recordSnapshot(String sessionName, IProgressMonitor monitor)
throws ExecutionException {
* Command to add a context to channels and/or events
*/
String COMMAND_ADD_CONTEXT = "add-context"; //$NON-NLS-1$
- /**
- * Command to execute calibrate command to quantify LTTng overhead
- */
- String COMMAND_CALIBRATE = "calibrate"; //$NON-NLS-1$
/**
* Command to execute sub-command snapshot
*/