To create a session with advanced options, fill in the relevant parameters and press '''Ok'''. Upon successful operation a new session will be created and added under the tree node '''Sessions'''.
+==== Creating a Snapshot Tracing Session ====
+LTTng Tools version v2.3.0 introduces the possibility to create snapshot tracing sessions. After starting tracing the trace events are not stored on disk or over the network. They are only transfered to disk or over the network when the user records a snapshot. To create such a snapshot session, open the trace session dialog as described in chapter [[#Creating a Tracing Session | Creating a Tracing Session]].
+
+[[Image:images/LTTng2CreateSessionDialog_Snapshot.png]]
+
+Fill in all necessary information, select checkbox for '''Snapshot Mode''' and press '''Ok'''. By default, the location for the snapshot output will be on the host where the host is located.
+
+Refer to chapter [[#Recording a Snapshot | Recording a Snapshot]] for how to create a snapshot.
+
==== Enabling Channels - General ====
Enabling channels can be done using a session tree node when the domain hasn't be created in the session or, alternatively on a domain tree node of a session in case the domain is already available.
Upon successful operation, the tracing session will be '''ACTIVE''' and the icon of the session will be updated.
+==== Recording a Snapshot ====
+
+LTTng Tools version v2.3.0 introduces the possibility to create snapshot tracing sessions. After creating a snapshot session (see [[#Creating a Snapshot Tracing Session | Creating a Snapshot Tracing Session]]) and starting tracing (see [[#Start Tracing | Start Tracing]]) it possible to record snapshots. To record a snapshot select one or more sessions and press the '''Record Snapshot''' button. Alternatively, press the right mouse button on the session tree nodes. A context-sensitive menu will show. Then select the '''Recored Snapshot''' menu item.
+
+[[Image:images/LTTng2RecordSnapshotAction.png]]
+
+This action can be executed many times. It is possible to import the recorded snpshots to a tracing project. The trace session might be '''ACTIVE''' or '''INACTIVE''' for that. Refer to section [[#Importing Session Traces to a Tracing Project | Importing Session Traces to a Tracing Project]] on how to import a trace to a tracing project.
+
==== Stop Tracing ====
-To stop tracing, select one or more sessions to stop in the Control View and press the '''Stop''' button. Alternatively, click the right mouse button on the session tree nodes. A context-sensitive menu will show. Then select the '''Stop''' menu item.
+To stop tracing, select one or more sessions to stop in the Control View and press the '''Stop''' button. Alternatively, click the right mouse button on the session tree node. A context-sensitive menu will show. Then select the '''Stop''' menu item.
[[Image:images/LTTng2StopTracingAction.png]]
** '''Log Level''': The log level of the event.
* '''Session''' Properties
** '''Session Name''': The name of the Session.
-** '''Session Path''': The path on the remote host where the traces will be stored.
+** '''Session Path''': The path on the remote host where the traces will be stored. (Not shown for snapshot sessions).
** '''State''': The state of the session ('''ACTIVE''' or '''INACTIVE''')
+** '''Snapshot ID''': The snapshot ID. (Only shown for snapshot sessions).
+** '''Snapshot Name''': The name of the snapshot output configuration. (Only shown for snapshot sessions).
+** '''Snapshot Path''': The path where the snapshot session is located. (Only shown for snapshot sessions).
* '''Domain''' Properties
** '''Domain Name''': The name of the domain.
** '''Buffer Type''': The buffer type of the domain.
ProbeEventInfoTest.class,
SessionInfoTest.class,
TraceInfoTest.class,
- UstProviderInfoTest.class
+ UstProviderInfoTest.class,
+ SnapshotInfoTest.class
})
public class AllTests {
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IFieldInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IProbeEventInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISnapshotInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IUstProviderInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEnablement;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEventType;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.FieldInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.ProbeEventInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.SessionInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.SnapshotInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.UstProviderInfo;
/**
private IUstProviderInfo fUstProviderInfo2 = null;
private IProbeEventInfo fProbeEventInfo1 = null;
private IProbeEventInfo fProbeEventInfo2 = null;
+ private ISnapshotInfo fSnapshotInfo1 = null;
+ private ISnapshotInfo fSnapshotInfo2 = null;
public ModelImplFactory() {
fProbeEventInfo2.setState(TraceEnablement.DISABLED);
fProbeEventInfo2.setOffset("0x100");
fProbeEventInfo2.setSymbol("init_post");
+
+ fSnapshotInfo1 = new SnapshotInfo("snapshot-1");
+ fSnapshotInfo1.setId(1);
+ fSnapshotInfo1.setSnapshotPath("/home/user/lttng-trace/mysession/");
+ fSnapshotInfo2 = new SnapshotInfo("other-snapshot");
+ fSnapshotInfo2.setId(1);
+ fSnapshotInfo2.setSnapshotPath("net4://172.0.0.1:1234/");
+ fSnapshotInfo2.setStreamedSnapshot(true);
+
+ fSessionInfo1.setSnapshotInfo(fSnapshotInfo1);
}
public ISessionInfo getSessionInfo1() {
public IFieldInfo getFieldInfo2() {
return fFieldInfo2;
}
+
+ public ISnapshotInfo getSnapshotInfo1() {
+ return fSnapshotInfo1;
+ }
+
+ public ISnapshotInfo getSnapshotInfo2() {
+ return fSnapshotInfo2;
+ }
}
String result = fixture.toString();
// add additional test code here
- assertEquals("[SessionInfo([TraceInfo(Name=sessionName)],State=INACTIVE,isStreamedTrace=false,Domains=)]", result);
+ assertEquals("[SessionInfo([TraceInfo(Name=sessionName)],Path=,State=INACTIVE,isStreamedTrace=false,Domains=)]", result);
}
/**
String result = fSessionInfo1.toString();
// add additional test code here
- assertEquals("[SessionInfo([TraceInfo(Name=session1)],State=ACTIVE,isStreamedTrace=false,Domains=[DomainInfo([TraceInfo(Name=test1)],Channels=[ChannelInfo([TraceInfo(Name=channel1)],State=DISABLED,OverwriteMode=true,SubBuffersSize=13,NumberOfSubBuffers=12,SwitchTimer=10,ReadTimer=11,output=splice(),Events=[EventInfo([BaseEventInfo([TraceInfo(Name=event1)],type=TRACEPOINT,level=TRACE_DEBUG)],State=ENABLED)])],isKernel=false)])]", result);
+ assertEquals("[SessionInfo([TraceInfo(Name=session1)],Path=/home/user/lttng-trace/mysession/,State=ACTIVE,isStreamedTrace=false,snapshotInfo="
+ + "[SnapshotInfo([TraceInfo(Name=snapshot-1)],snapshotPath=/home/user/lttng-trace/mysession/,ID=1,isStreamedSnapshot=false)],"
+ + "Domains=[DomainInfo([TraceInfo(Name=test1)],"
+ + "Channels=[ChannelInfo([TraceInfo(Name=channel1)],State=DISABLED,OverwriteMode=true,SubBuffersSize=13,NumberOfSubBuffers=12,SwitchTimer=10,ReadTimer=11,output=splice(),"
+ + "Events=[EventInfo([BaseEventInfo([TraceInfo(Name=event1)],type=TRACEPOINT,level=TRACE_DEBUG)],State=ENABLED)])],"
+ + "isKernel=false)])]", result);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString_3() {
+ SessionInfo info = new SessionInfo((SessionInfo)fSessionInfo1);
+ info.setSnapshotInfo(null);
+ info.setSessionPath("/home/user/lttng-trace/mysession/");
+
+ String result = info.toString();
+
+ // add additional test code here
+ assertEquals("[SessionInfo([TraceInfo(Name=session1)],Path=/home/user/lttng-trace/mysession/,State=ACTIVE,isStreamedTrace=false,"
+ + "Domains=[DomainInfo([TraceInfo(Name=test1)],"
+ + "Channels=[ChannelInfo([TraceInfo(Name=channel1)],State=DISABLED,OverwriteMode=true,SubBuffersSize=13,NumberOfSubBuffers=12,SwitchTimer=10,ReadTimer=11,output=splice(),"
+ + "Events=[EventInfo([BaseEventInfo([TraceInfo(Name=event1)],type=TRACEPOINT,level=TRACE_DEBUG)],State=ENABLED)])],"
+ + "isKernel=false)])]", result);
}
// ------------------------------------------------------------------------
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2013 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.linuxtools.lttng2.core.tests.control.model.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISnapshotInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.SnapshotInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.TraceInfo;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>SnapshotInfoTest</code> contains test for the class
+ * <code>{@link SnapshotInfo}</code>.
+ */
+public class SnapshotInfoTest {
+
+ // ------------------------------------------------------------------------
+ // Test data
+ // ------------------------------------------------------------------------
+
+ private ISnapshotInfo fSnapshotInfo1 = null;
+ private ISnapshotInfo fSnapshotInfo2 = null;
+
+
+ // ------------------------------------------------------------------------
+ // Housekeeping
+ // ------------------------------------------------------------------------
+
+ /**
+ * Perform pre-test initialization.
+ */
+ @Before
+ public void setUp() {
+ ModelImplFactory factory = new ModelImplFactory();
+ fSnapshotInfo1 = factory.getSnapshotInfo1();
+ fSnapshotInfo2 = factory.getSnapshotInfo2();
+ }
+
+ // ------------------------------------------------------------------------
+ // Tests
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor test.
+ */
+ @Test
+ public void testSnapshotInfo() {
+ SnapshotInfo fixture = new SnapshotInfo("event");
+ assertNotNull(fixture);
+ assertEquals("event", fixture.getName());
+ }
+
+ /**
+ * Test Copy Constructor
+ */
+ @Test
+ public void testSnapshotInfo2() {
+ try {
+ String name = null;
+ new SnapshotInfo(name);
+ fail("null name in custructor");
+ }
+ catch (IllegalArgumentException e) {
+ // Success
+ }
+ }
+
+ /**
+ * Test Copy Constructor
+ */
+ @Test
+ public void testSnapshotCopy() {
+ SnapshotInfo info = new SnapshotInfo((SnapshotInfo)fSnapshotInfo1);
+
+ assertEquals(fSnapshotInfo1.getName(), info.getName());
+ }
+
+ /**
+ * Test Copy Constructor
+ */
+ @Test
+ public void testTraceCopy2() {
+ try {
+ SnapshotInfo info = null;
+ new SnapshotInfo(info);
+ fail("null copy");
+ }
+ catch (IllegalArgumentException e) {
+ // Success
+ }
+ }
+
+ /**
+ * Run the void setEventType(String) method test.
+ */
+ @Test
+ public void testSetName() {
+ SnapshotInfo fixture = new SnapshotInfo("event");
+ fixture.setName("newName");
+ assertEquals("newName", fixture.getName());
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString_1() {
+ String result = fSnapshotInfo1.toString();
+
+ // add additional test code here
+ assertEquals("[SnapshotInfo([TraceInfo(Name=snapshot-1)],snapshotPath=/home/user/lttng-trace/mysession/,ID=1,isStreamedSnapshot=false)]", result);
+ }
+
+ // ------------------------------------------------------------------------
+ // equals
+ // ------------------------------------------------------------------------
+
+ /**
+ * Run the equals() method test.
+ */
+ @Test
+ public void testEqualsReflexivity() {
+ assertTrue("equals", fSnapshotInfo1.equals(fSnapshotInfo1));
+ assertTrue("equals", fSnapshotInfo2.equals(fSnapshotInfo2));
+
+ assertTrue("equals", !fSnapshotInfo1.equals(fSnapshotInfo2));
+ assertTrue("equals", !fSnapshotInfo2.equals(fSnapshotInfo1));
+ }
+
+ /**
+ * Run the equals() method test.
+ */
+ @Test
+ public void testEqualsSymmetry() {
+ SnapshotInfo info1 = new SnapshotInfo((SnapshotInfo)fSnapshotInfo1);
+ SnapshotInfo info2 = new SnapshotInfo((SnapshotInfo)fSnapshotInfo2);
+
+ assertTrue("equals", info1.equals(fSnapshotInfo1));
+ assertTrue("equals", fSnapshotInfo1.equals(info1));
+
+ assertTrue("equals", info2.equals(fSnapshotInfo2));
+ assertTrue("equals", fSnapshotInfo2.equals(info2));
+ }
+ /**
+ * Run the equals() method test.
+ */
+ @Test
+ public void testEqualsTransivity() {
+ SnapshotInfo info1 = new SnapshotInfo((SnapshotInfo)fSnapshotInfo1);
+ SnapshotInfo info2 = new SnapshotInfo((SnapshotInfo)fSnapshotInfo1);
+ SnapshotInfo info3 = new SnapshotInfo((SnapshotInfo)fSnapshotInfo1);
+
+ assertTrue("equals", info1.equals(info2));
+ assertTrue("equals", info2.equals(info3));
+ assertTrue("equals", info1.equals(info3));
+ }
+ /**
+ * Run the equals() method test.
+ */
+ @Test
+ public void testEqualsNull() {
+ assertTrue("equals", !fSnapshotInfo1.equals(null));
+ assertTrue("equals", !fSnapshotInfo2.equals(null));
+
+ SnapshotInfo info = new SnapshotInfo("snapshot-1");
+ assertTrue("equals", !fSnapshotInfo1.equals(info));
+
+ info.setSnapshotPath(null);
+ assertTrue("equals", !fSnapshotInfo1.equals(info));
+
+ info.setId(fSnapshotInfo1.getId());
+ assertTrue("equals", !info.equals(fSnapshotInfo1));
+
+ info.setSnapshotPath("/home/user/lttng-trace/mysession/");
+ assertTrue("equals", fSnapshotInfo1.equals(info));
+ info.setId(2);
+ assertTrue("equals", !fSnapshotInfo1.equals(info));
+
+ info.setId(fSnapshotInfo1.getId());
+ info.setStreamedSnapshot(true);
+ assertTrue("equals", !fSnapshotInfo1.equals(info));
+
+ assertTrue("equals", !fSnapshotInfo1.equals(new TraceInfo(fSnapshotInfo1.getName())));
+ }
+
+ // ------------------------------------------------------------------------
+ // hashCode
+ // ------------------------------------------------------------------------
+
+ /**
+ * Run the hashCode() method test.
+ */
+ @Test
+ public void testHashCode() {
+ SnapshotInfo info1 = new SnapshotInfo((SnapshotInfo)fSnapshotInfo1);
+ SnapshotInfo info2 = new SnapshotInfo((SnapshotInfo)fSnapshotInfo2);
+
+ assertTrue("hashCode", fSnapshotInfo1.hashCode() == info1.hashCode());
+ assertTrue("hashCode", fSnapshotInfo2.hashCode() == info2.hashCode());
+
+ assertTrue("hashCode", fSnapshotInfo1.hashCode() != info2.hashCode());
+ assertTrue("hashCode", fSnapshotInfo2.hashCode() != info1.hashCode());
+
+ // null values
+ SnapshotInfo info3 = new SnapshotInfo("snapshot-1");
+ assertTrue("hashCode", fSnapshotInfo1.hashCode() != info3.hashCode());
+
+ info3.setSnapshotPath(null);
+ assertTrue("hashCode", fSnapshotInfo1.hashCode() != info3.hashCode());
+
+ info3.setSnapshotPath("/home/user/lttng-trace/mysession/");
+ assertTrue("hashCode", fSnapshotInfo1.hashCode() != info3.hashCode());
+ }
+}
\ No newline at end of file
* @param isStreamedTrace <code>true</code> if streamed over network else <code>false</code>
*/
void setStreamedTrace(boolean isStreamedTrace);
+
+ /**
+ * Returns whether the session is snapshot session or not
+ * @return <code>true</code> if it is snapshot session else <code>false</code>
+ */
+ boolean isSnapshotSession();
+
+ /**
+ * Gets the snapshot information the session or null if it is not a
+ * snapshot session.
+ * @return snapshot information
+ */
+ ISnapshotInfo getSnapshotInfo();
+
+ /**
+ * Sets the snapshot information of the session
+ * @param setSnapshotInfo - the snapshot data to set.
+ */
+ void setSnapshotInfo(ISnapshotInfo setSnapshotInfo);
}
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2013 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.linuxtools.internal.lttng2.core.control.model;
+
+
+/**
+ * <p>
+ * Interface for retrieval of snapshot information of a session.
+ * </p>
+ *
+ * @author Bernd Hufmann
+ */
+public interface ISnapshotInfo extends ITraceInfo {
+
+ /**
+ * @return path string where snapshot is located.
+ */
+ String getSnapshotPath();
+
+ /**
+ * Sets the path string (where snapshot is located) to the given value.
+ * @param path - session path to set.
+ */
+ void setSnapshotPath(String path);
+
+ /**
+ * @return the snapshot ID.
+ */
+ int getId();
+
+ /**
+ * Sets the snapshot ID.
+ * @param id - the ID to set.
+ */
+ void setId(int id);
+
+ /**
+ * Sets whether snapshot is streamed over the network or stored locally
+ * at the tracers host.
+ *
+ * @param isStreamed - <code>true</code> if streamed else <code>false</code>
+ */
+ void setStreamedSnapshot(boolean isStreamed);
+
+ /**
+ * Gets whether snapshot is streamed over the network or stored locally
+ * at the tracers host.
+ *
+ * @return <code>true</code> if streamed else <code>false</code>
+ */
+ boolean isStreamedSnapshot();
+
+}
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IDomainInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISnapshotInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceSessionState;
/**
* Flag to indicate whether trace is streamed over network or not.
*/
private boolean fIsStreamedTrace = false;
+ /**
+ * Flag to indicate whether the session is a snapshot session or not.
+ */
+ private ISnapshotInfo fSnapshotInfo = null;
+
// ------------------------------------------------------------------------
// Constructors
fState = other.fState;
fSessionPath = other.fSessionPath;
fIsStreamedTrace = other.fIsStreamedTrace;
+ fSnapshotInfo = other.fSnapshotInfo;
for (Iterator<IDomainInfo> iterator = other.fDomains.iterator(); iterator.hasNext();) {
IDomainInfo domain = iterator.next();
@Override
public String getSessionPath() {
+ if(isSnapshotSession()) {
+ return fSnapshotInfo.getSnapshotPath();
+ }
return fSessionPath;
}
@Override
public boolean isStreamedTrace() {
+ if (isSnapshotSession()) {
+ return fSnapshotInfo.isStreamedSnapshot();
+ }
return fIsStreamedTrace;
}
fIsStreamedTrace = isStreamedTrace;
}
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
+ @Override
+ public boolean isSnapshotSession() {
+ return fSnapshotInfo != null;
+ }
@Override
- public void addDomain(IDomainInfo domainInfo) {
- fDomains.add(domainInfo);
+ public ISnapshotInfo getSnapshotInfo() {
+ return fSnapshotInfo;
}
@Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + fDomains.hashCode();
- result = prime * result + (fIsStreamedTrace ? 1231 : 1237);
- result = prime * result + ((fSessionPath == null) ? 0 : fSessionPath.hashCode());
- result = prime * result + ((fState == null) ? 0 : fState.hashCode());
- return result;
+ public void setSnapshotInfo(ISnapshotInfo info) {
+ fSnapshotInfo = info;
}
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
@Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!super.equals(obj)) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- SessionInfo other = (SessionInfo) obj;
- if (!fDomains.equals(other.fDomains)) {
- return false;
- }
- if (fIsStreamedTrace != other.fIsStreamedTrace) {
- return false;
- }
- if (fSessionPath == null) {
- if (other.fSessionPath != null) {
- return false;
- }
- } else if (!fSessionPath.equals(other.fSessionPath)) {
- return false;
- }
- if (fState != other.fState) {
- return false;
- }
- return true;
+ public void addDomain(IDomainInfo domainInfo) {
+ fDomains.add(domainInfo);
}
+
@SuppressWarnings("nls")
@Override
public String toString() {
StringBuffer output = new StringBuffer();
output.append("[SessionInfo(");
output.append(super.toString());
+ output.append(",Path=");
+ output.append(getSessionPath());
output.append(",State=");
output.append(fState);
output.append(",isStreamedTrace=");
output.append(fIsStreamedTrace);
+ if (fSnapshotInfo != null) {
+ output.append(",snapshotInfo=");
+ output.append(fSnapshotInfo.toString());
+ }
output.append(",Domains=");
for (Iterator<IDomainInfo> iterator = fDomains.iterator(); iterator.hasNext();) {
IDomainInfo domain = iterator.next();
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2013 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.linuxtools.internal.lttng2.core.control.model.impl;
+
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISnapshotInfo;
+
+/**
+ * <p>
+ * Implementation of the snapshot interface (ISnapshotInfo) to store snapshot
+ * related data.
+ * </p>
+ *
+ * @author Bernd Hufmann
+ */
+public class SnapshotInfo extends TraceInfo implements ISnapshotInfo {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+ /** The snapshot path for storing traces. */
+ private String fPath = ""; //$NON-NLS-1$
+ /** The snapshot ID */
+ private int fId = -1;
+ /** Flag whether snapshot is stored over the network or locally */
+ private boolean fIsStreamed = false;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+ /**
+ * Constructor
+ * @param name - name of base event
+ */
+ public SnapshotInfo(String name) {
+ super(name);
+ }
+
+ /**
+ * Copy constructor
+ * @param other - the instance to copy
+ */
+ public SnapshotInfo(SnapshotInfo other) {
+ super(other);
+ fPath = other.fPath;
+ fId = other.fId;
+ fIsStreamed = other.fIsStreamed;
+ }
+
+ // ------------------------------------------------------------------------
+ // Accessors
+ // ------------------------------------------------------------------------
+
+ @Override
+ public String getSnapshotPath() {
+ return fPath;
+ }
+
+ @Override
+ public void setSnapshotPath(String path) {
+ fPath = path;
+ }
+
+ @Override
+ public int getId() {
+ return fId;
+ }
+
+ @Override
+ public void setId(int id) {
+ fId = id;
+ }
+
+ @Override
+ public void setStreamedSnapshot(boolean isStreamed) {
+ fIsStreamed = isStreamed;
+ }
+
+ @Override
+ public boolean isStreamedSnapshot() {
+ return fIsStreamed;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + fId;
+ result = prime * result + (fIsStreamed ? 1231 : 1237);
+ result = prime * result + ((fPath == null) ? 0 : fPath.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ SnapshotInfo other = (SnapshotInfo) obj;
+ if (fId != other.fId) {
+ return false;
+ }
+ if (fIsStreamed != other.fIsStreamed) {
+ return false;
+ }
+ if (fPath == null) {
+ if (other.fPath != null) {
+ return false;
+ }
+ } else if (!fPath.equals(other.fPath)) {
+ return false;
+ }
+ return true;
+ }
+
+ @SuppressWarnings("nls")
+ @Override
+ public String toString() {
+ StringBuffer output = new StringBuffer();
+ output.append("[SnapshotInfo(");
+ output.append(super.toString());
+ output.append(",snapshotPath=");
+ output.append(fPath);
+ output.append(",ID=");
+ output.append(fId);
+ output.append(",isStreamedSnapshot=");
+ output.append(fIsStreamed);
+ output.append(")]");
+ return output.toString();
+ }
+
+}
TraceControlTreeModelTest.class,
TraceControlUstProviderTests.class,
TraceControlUstSessionTests.class,
- TraceControlUstSessionTests2.class
+ TraceControlUstSessionTests2.class,
+ TraceControlSnapshotSessionTests.class
})
public class AllTests {
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2013 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.linuxtools.lttng2.ui.tests.control.model.component;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceSessionState;
+import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.CreateSessionDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.DestroyConfirmDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.GetEventInfoDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.stubs.service.TestRemoteSystemProxy;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.TraceControlDialogFactory;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TargetNodeComponent;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.TraceSessionPropertySource;
+import org.eclipse.rse.core.RSECorePlugin;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.model.ISystemProfile;
+import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.FrameworkUtil;
+
+/**
+ * The class <code>TraceControlSnapshotSessionTests</code> contains Snapshot
+ * session test cases for support of LTTng Tools 2.3.
+ */
+public class TraceControlSnapshotSessionTests {
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+
+ private static final String TEST_STREAM = "CreateSessionTest2.cfg";
+ private static final String SCEN_CREATE_SESSION = "ScenCreateSession";
+
+ // ------------------------------------------------------------------------
+ // Test data
+ // ------------------------------------------------------------------------
+
+ private TraceControlTestFacility fFacility;
+ private TestRemoteSystemProxy fProxy;
+ private String fTestFile;
+
+ // ------------------------------------------------------------------------
+ // Housekeeping
+ // ------------------------------------------------------------------------
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception
+ * if the initialization fails for some reason
+ */
+ @Before
+ public void setUp() throws Exception {
+ fFacility = TraceControlTestFacility.getInstance();
+ fFacility.init();
+ fProxy = new TestRemoteSystemProxy();
+ URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path(TraceControlTestFacility.DIRECTORY + File.separator + TEST_STREAM), null);
+ File testfile = new File(FileLocator.toFileURL(location).toURI());
+ fTestFile = testfile.getAbsolutePath();
+ }
+
+ /**
+ * Perform post-test clean-up.
+ */
+ @After
+ public void tearDown() {
+ fFacility.waitForJobs();
+ fFacility.dispose();
+ }
+
+ /**
+ * Run the TraceControlComponent.
+ *
+ * @throws Exception
+ * This will fail the test
+ */
+ @Test
+ public void testTraceSessionTree() throws Exception {
+
+ fProxy.setTestFile(fTestFile);
+ fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST);
+
+ ITraceControlComponent root = fFacility.getControlView().getTraceControlRoot();
+
+ ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+ ISystemProfile profile = registry.createSystemProfile("myProfile", true);
+ IHost host = registry.createLocalHost(profile, "myProfile", "user");
+
+ TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
+
+ root.addChild(node);
+ fFacility.waitForJobs();
+
+ fFacility.executeCommand(node, "connect");
+ int i = 0;
+ while ((i < 10) && (node.getTargetNodeState() != TargetNodeState.CONNECTED)) {
+ i++;
+ fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
+ }
+
+ // Get provider groups
+ ITraceControlComponent[] groups = node.getChildren();
+ assertNotNull(groups);
+ assertEquals(2, groups.length);
+
+ // Initialize dialog implementations for command execution
+ // --- snapshot session ---
+ CreateSessionDialogStub sessionDialog = new CreateSessionDialogStub();
+ sessionDialog.setSnapshot(true);
+
+ TraceControlDialogFactory.getInstance().setCreateSessionDialog(sessionDialog);
+ TraceControlDialogFactory.getInstance().setGetEventInfoDialog(new GetEventInfoDialogStub());
+ TraceControlDialogFactory.getInstance().setConfirmDialog(new DestroyConfirmDialogStub());
+
+ // Initialize scenario
+ fProxy.setScenario(SCEN_CREATE_SESSION);
+
+ // ------------------------------------------------------------------------
+ // Create session
+ // ------------------------------------------------------------------------
+ TraceSessionComponent session = fFacility.createSession(groups[1]);
+
+ // Verify that session was created
+ assertNotNull(session);
+ assertEquals("mysession", session.getName());
+ assertTrue(session.isSnapshotSession());
+ assertNotNull(session.getSnapshotInfo());
+ assertEquals("snapshot-1", session.getSnapshotInfo().getName());
+ assertEquals("/home/user/lttng-traces/mysession-20130913-141651", session.getSnapshotInfo().getSnapshotPath());
+ assertEquals(1, session.getSnapshotInfo().getId());
+
+ // ------------------------------------------------------------------------
+ // Start session
+ // ------------------------------------------------------------------------
+ fFacility.startSession(session);
+ assertEquals(TraceSessionState.ACTIVE, session.getSessionState());
+
+ // verify properties
+ Object adapter = session.getAdapter(IPropertySource.class);
+ assertNotNull(adapter);
+ assertTrue(adapter instanceof TraceSessionPropertySource);
+
+ TraceSessionPropertySource sessionSource = (TraceSessionPropertySource)adapter;
+ IPropertyDescriptor[] descriptors = sessionSource.getPropertyDescriptors();
+ assertNotNull(descriptors);
+
+ Map<String,String> map = new HashMap<String,String>();
+ map.put(TraceSessionPropertySource.TRACE_SESSION_NAME_PROPERTY_ID, "mysession");
+ map.put(TraceSessionPropertySource.TRACE_SNAPSHOT_NAME_PROPERTY_ID, "snapshot-1");
+ map.put(TraceSessionPropertySource.TRACE_SNAPSHOT_PATH_PROPERTY_ID, "/home/user/lttng-traces/mysession-20130913-141651");
+ map.put(TraceSessionPropertySource.TRACE_SNAPSHOT_ID_PROPERTY_ID, "1");
+ map.put(TraceSessionPropertySource.TRACE_SESSION_STATE_PROPERTY_ID, TraceSessionState.ACTIVE.name());
+
+ for (int j = 0; j < descriptors.length; j++) {
+ String expected = map.get(descriptors[j].getId());
+ assertNotNull(expected);
+ assertEquals(expected, sessionSource.getPropertyValue(descriptors[j].getId()).toString());
+ }
+
+ // ------------------------------------------------------------------------
+ // Record snapshot
+ // ------------------------------------------------------------------------
+ fFacility.executeCommand(session, "snapshot");
+
+ // ------------------------------------------------------------------------
+ // Stop snapshot
+ // ------------------------------------------------------------------------
+ fFacility.stopSession(session);
+ assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
+
+ // ------------------------------------------------------------------------
+ // Destroy session
+ // ------------------------------------------------------------------------
+ fFacility.destroySession(session);
+
+ // Verify that no more session components exist
+ assertEquals(0, groups[1].getChildren().length);
+
+ //-------------------------------------------------------------------------
+ // Disconnect node
+ //-------------------------------------------------------------------------
+ fFacility.executeCommand(node, "disconnect");
+ assertEquals(TargetNodeState.DISCONNECTED, node.getTargetNodeState());
+
+ //-------------------------------------------------------------------------
+ // Delete node
+ //-------------------------------------------------------------------------
+
+ fFacility.executeCommand(node, "delete");
+
+ assertEquals(0,fFacility.getControlView().getTraceControlRoot().getChildren().length);
+ }
+}
\ No newline at end of file
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IEventInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IFieldInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISnapshotInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IUstProviderInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEnablement;
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";
+ private static final String SCEN_CREATE_STREAMED_SNAPSHOT_SESSION = "CreateSessionStreamedSnapshot";
+ private static final String SCEN_CREATE_SNAPSHOT_SESSION_ERRORS = "CreateSessionSnapshotErrors";
// ------------------------------------------------------------------------
// Test data
try {
fShell.setScenario(SCEN_CREATE_SESSION1);
- ISessionInfo info = fService.createSession("mysession2", null, new NullProgressMonitor());
+ ISessionInfo info = fService.createSession("mysession2", null, false, new NullProgressMonitor());
assertNotNull(info);
assertEquals("mysession2", info.getName());
assertNotNull(info.getSessionPath());
fShell.setScenario(SCEN_CREATE_SESSION_WITH_PROMPT);
// First line has no shell prompt before the output
- ISessionInfo info = fService.createSession("mysession2", null, new NullProgressMonitor());
+ ISessionInfo info = fService.createSession("mysession2", null, false, new NullProgressMonitor());
assertNotNull(info);
assertEquals("mysession2", info.getName());
assertNotNull(info.getSessionPath());
fShell.setScenario(SCEN_CREATE_SESSION_VARIANTS);
try {
- fService.createSession("alreadyExist", null, new NullProgressMonitor());
+ fService.createSession("alreadyExist", null, false, new NullProgressMonitor());
fail("No exeption thrown");
} catch (ExecutionException e) {
// success
}
try {
- fService.createSession("wrongName", null, new NullProgressMonitor());
+ fService.createSession("wrongName", null, false, new NullProgressMonitor());
fail("No exeption thrown");
} catch (ExecutionException e) {
// success
}
try {
- fService.createSession("withPath", "/home/user/hallo", new NullProgressMonitor());
+ fService.createSession("withPath", "/home/user/hallo", false, new NullProgressMonitor());
fail("No exeption thrown");
} catch (ExecutionException e) {
// success
}
try {
- ISessionInfo info = fService.createSession("session with spaces", null, new NullProgressMonitor());
+ ISessionInfo info = fService.createSession("session with spaces", null, false, new NullProgressMonitor());
assertNotNull(info);
assertEquals("session with spaces", info.getName());
assertNotNull(info.getSessionPath());
}
try {
- ISessionInfo info = fService.createSession("pathWithSpaces", "/home/user/hallo user/here", new NullProgressMonitor());
+ ISessionInfo info = fService.createSession("pathWithSpaces", "/home/user/hallo user/here", false, new NullProgressMonitor());
assertNotNull(info);
assertEquals("pathWithSpaces", info.getName());
assertNotNull(info.getSessionPath());
try {
fShell.setScenario(SCEN_CREATE_SESSION_2_1);
- ISessionInfo info = fService.createSession("mysession", "net://172.0.0.1", null, null, new NullProgressMonitor());
+ ISessionInfo info = fService.createSession("mysession", "net://172.0.0.1", null, null, false, new NullProgressMonitor());
assertNotNull(info);
assertEquals("mysession", info.getName());
assertEquals("net://172.0.0.1", info.getSessionPath());
assertTrue(info.isStreamedTrace());
fService.destroySession("mysession", new NullProgressMonitor());
- info = fService.createSession("mysession", "file:///tmp", null, null, new NullProgressMonitor());
+ info = fService.createSession("mysession", "file:///tmp", null, null, false, new NullProgressMonitor());
assertNotNull(info);
assertEquals("mysession", info.getName());
assertEquals("file:///tmp", info.getSessionPath());
assertTrue(!info.isStreamedTrace());
fService.destroySession("mysession", new NullProgressMonitor());
- info = fService.createSession("mysession", "file:///tmp", null, null, new NullProgressMonitor());
+ info = fService.createSession("mysession", "file:///tmp", null, null, false, new NullProgressMonitor());
assertNotNull(info);
assertEquals("mysession", info.getName());
assertEquals("file:///tmp", info.getSessionPath());
assertTrue(!info.isStreamedTrace());
fService.destroySession("mysession", new NullProgressMonitor());
- info = fService.createSession("mysession", null, "tcp://172.0.0.1", "tcp://172.0.0.1:5343", new NullProgressMonitor());
+ info = fService.createSession("mysession", null, "tcp://172.0.0.1", "tcp://172.0.0.1:5343", false, new NullProgressMonitor());
assertNotNull(info);
assertEquals("mysession", info.getName());
assertEquals("", info.getSessionPath()); // the complete network path is not available at this point
assertTrue(info.isStreamedTrace());
fService.destroySession("mysession", new NullProgressMonitor());
- info = fService.createSession("mysession", "net://172.0.0.1:1234:2345", null, null, new NullProgressMonitor());
+ info = fService.createSession("mysession", "net://172.0.0.1:1234:2345", null, null, false, new NullProgressMonitor());
assertNotNull(info);
assertEquals("mysession", info.getName());
assertEquals("net://172.0.0.1:1234:2345", info.getSessionPath());
// verbose
enableVerbose();
- info = fService.createSession("mysession", "net://172.0.0.1", null, null, new NullProgressMonitor());
+ info = fService.createSession("mysession", "net://172.0.0.1", null, null, false, new NullProgressMonitor());
assertNotNull(info);
assertEquals("mysession", info.getName());
assertEquals("net://172.0.0.1", info.getSessionPath());
fShell.setScenario(SCEN_CREATE_SESSION_VERBOSE_2_1);
enableVerbose();
- ISessionInfo info = fService.createSession("mysession", "net://172.0.0.1", null, null, new NullProgressMonitor());
+ ISessionInfo info = fService.createSession("mysession", "net://172.0.0.1", null, null, false, new NullProgressMonitor());
assertNotNull(info);
assertEquals("mysession", info.getName());
assertEquals("net://172.0.0.1", info.getSessionPath());
}
}
+ @Test
+ public void testCreateSnapshotSession() {
+ try {
+ fShell.setScenario(SCEN_CREATE_SNAPSHOT_SESSION);
+
+ ISessionInfo sessionInfo = fService.createSession("mysession", null, true, new NullProgressMonitor());
+ assertNotNull(sessionInfo);
+ assertEquals("mysession", sessionInfo.getName());
+ assertTrue(sessionInfo.isSnapshotSession());
+ assertEquals("", sessionInfo.getSessionPath());
+ assertTrue(!sessionInfo.isStreamedTrace());
+
+ assertEquals(TraceSessionState.INACTIVE, sessionInfo.getSessionState());
+
+ String[] names = fService.getSessionNames(new NullProgressMonitor());
+ assertEquals(names[0], "mysession");
+
+ ISnapshotInfo snapshotInfo = fService.getSnapshotInfo("mysession", new NullProgressMonitor());
+ assertNotNull(snapshotInfo);
+ assertEquals("snapshot-1", snapshotInfo.getName());
+ assertEquals("/home/user/lttng-traces/mysession-20130913-141651", snapshotInfo.getSnapshotPath());
+ assertEquals(1, snapshotInfo.getId());
+ assertTrue(!snapshotInfo.isStreamedSnapshot());
+
+ // we need to set the snapshotInfo to so that the session path is set correctly
+ sessionInfo.setSnapshotInfo(snapshotInfo);
+ assertEquals("/home/user/lttng-traces/mysession-20130913-141651", sessionInfo.getSessionPath());
+
+ fService.recordSnapshot("mysession", new NullProgressMonitor());
+
+ fService.destroySession("mysession", new NullProgressMonitor());
+
+ } catch (ExecutionException e) {
+ fail(e.toString());
+ }
+ }
+
+ public void testCreateStreamedSnapshotSession() {
+ try {
+ fShell.setScenario(SCEN_CREATE_STREAMED_SNAPSHOT_SESSION);
+
+ ISessionInfo sessionInfo = fService.createSession("mysession", "net://172.0.0.1", null, null, false, new NullProgressMonitor());
+ assertNotNull(sessionInfo);
+ assertEquals("mysession", sessionInfo.getName());
+ assertTrue(sessionInfo.isSnapshotSession());
+
+ assertEquals(TraceSessionState.INACTIVE, sessionInfo.getSessionState());
+ assertTrue(sessionInfo.isStreamedTrace());
+
+ String[] names = fService.getSessionNames(new NullProgressMonitor());
+ assertEquals(names[0], "mysession");
+
+
+ ISnapshotInfo snapshotInfo = sessionInfo.getSnapshotInfo();
+ assertNotNull(sessionInfo);
+ assertEquals("snapshot-2", snapshotInfo.getName());
+ assertEquals("net4://172.0.0.1:5342/", snapshotInfo.getSnapshotPath());
+ assertEquals(2, snapshotInfo.getId());
+ assertTrue(snapshotInfo.isStreamedSnapshot());
+
+ // we need to set the snapshotInfo to so that the session path is set correctly
+ sessionInfo.setSnapshotInfo(snapshotInfo);
+ assertEquals("net4://172.0.0.1:5342/", sessionInfo.getSessionPath());
+
+ fService.recordSnapshot("mysession", new NullProgressMonitor());
+
+ fService.destroySession("mysession", new NullProgressMonitor());
+
+ } catch (ExecutionException e) {
+ fail(e.toString());
+ }
+ }
+
+
+ @Test
+ public void testCreateSnapshotSessionErrors() {
+ try {
+ fShell.setScenario(SCEN_CREATE_SNAPSHOT_SESSION_ERRORS);
+
+ String[] names = fService.getSessionNames(new NullProgressMonitor());
+ assertEquals(names[0], "mysession");
+ } catch (ExecutionException e) {
+ fail(e.toString());
+ }
+
+ try {
+ fService.getSnapshotInfo("blabla", new NullProgressMonitor());
+ fail("getSnapshoInfo() didn't fail");
+ } catch (ExecutionException e) {
+ // successful
+ }
+
+ try {
+ fService.recordSnapshot("blabla", new NullProgressMonitor());
+ fail("getSnapshoInfo() didn't fail");
+ } catch (ExecutionException e) {
+ // successful
+ }
+
+ try {
+ fService.recordSnapshot("mysession", new NullProgressMonitor());
+ fail("getSnapshoInfo() didn't fail");
+ } catch (ExecutionException e) {
+ // successful
+ }
+ }
+
private static void enableVerbose() {
// verbose
ControlCommandLogger.init(ControlPreferences.getInstance().getLogfilePath(), false);
private String fNetworkUrl = null;
private String fControlUrl = null;
private String fDataUrl = null;
+ private boolean fIsSnapshot;
@Override
public String getSessionName() {
this.fDataUrl = fDataUrl;
}
+ @Override
+ public boolean isSnapshot() {
+ return fIsSnapshot;
+ }
+
+ public void setSnapshot(boolean isSnapshot) {
+ fIsSnapshot = isSnapshot;
+ }
}
--- /dev/null
+####################################################################
+# Copyright (c) 2013 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
+####################################################################
+####################################################################
+# Scenario: Initialize
+####################################################################
+<SCENARIO>
+Initialize
+<COMMAND_INPUT>
+lttng version
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+lttng version 2.3.0 - Dominus Vobiscum
+
+A very succulent line-up of beers brewed at Microbrasserie Charlevoix. Elaborated starting from special malts and fermented with a Belgian yeast. These beers are refermented in bottle and will make you discover the richness of wheat, amber and triple styles.
+
+Web site: http://lttng.org
+
+lttng is free software and under the GPL license and part LGPL
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Currently no available tracing session
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list -k
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Kernel events
+-------------
+ sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+ sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+ sched_wakeup_new (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list -u -f
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST events:
+-------------
+
+PID: 9379 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
+ ust_tests_hello:tptest_sighandler (loglevel: TRACE_WARNING (4)) (type: tracepoint)
+ ust_tests_hello:tptest (loglevel: TRACE_DEBUG_FUNCTION (12)) (type: tracepoint)
+
+PID: 4852 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
+ ust_tests_hello:tptest_sighandler (loglevel: TRACE_WARNING (4)) (type: tracepoint)
+ ust_tests_hello:tptest (loglevel: TRACE_DEBUG_FUNCTION (12)) (type: tracepoint)
+
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Test "lttng create <session> --snapshot" LTTng 2.3
+####################################################################
+<SCENARIO>
+ScenCreateSession
+<COMMAND_INPUT>
+lttng create mysession --snapshot
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Default snapshot output set to: /home/user/lttng-traces/mysession-20130913-141651
+Snapshot mode set. Every channel enabled for that session will be set in overwrite mode and mmap output.
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+<COMMAND_INPUT>
+lttng list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession: [inactive snapshot]
+ Trace path:
+
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+<COMMAND_INPUT>
+lttng snapshot list-output -s mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Snapshot output list for session mysession
+ [1] snapshot-1: /home/user/lttng-traces/mysession-20130913-141651
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+<COMMAND_INPUT>
+lttng start mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing started for session mysession.
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+<COMMAND_INPUT>
+lttng snapshot record -s mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+ Snapshot recorded successfully for session mysession
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+<COMMAND_INPUT>
+lttng stop mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing stopped for session mysession.
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+<COMMAND_INPUT>
+lttng destroy mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession destroyed.
+</COMMAND_OUTPUT>
+</SCENARIO>
<COMMAND_OUTPUT>
Session mysession destroyed.
</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Test "lttng create <session> --snapshot (LTTng 2.3)
+####################################################################
+<SCENARIO>
+CreateSessionSnapshot
+<COMMAND_INPUT>
+lttng create mysession --snapshot
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Default snapshot output set to: /home/user/lttng-traces/mysession-20130913-141651
+Snapshot mode set. Every channel enabled for that session will be set in overwrite mode and mmap output.
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+<COMMAND_INPUT>
+lttng snapshot list-output -s mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Snapshot output list for session mysession
+ [1] snapshot-1: /home/user/lttng-traces/mysession-20130913-141651
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+<COMMAND_INPUT>
+lttng list
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+ 1) mysession () [inactive snapshot]
+
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+<COMMAND_INPUT>
+lttng snapshot record -s mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+ Snapshot recorded successfully for session mysession
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+<COMMAND_INPUT>
+lttng destroy mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession destroyed.
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Test "lttng create <session> --snapshot -U <URL> (LTTng 2.3)
+####################################################################
+<SCENARIO>
+CreateSessionStreamedSnapshot
+<COMMAND_INPUT>
+lttng create mysession --snapshot -U net://172.0.0.1
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Default snapshot output set to: net://172.0.0.1
+Snapshot mode set. Every channel enabled for that session will be set in overwrite mode and mmap output.
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+<COMMAND_INPUT>
+lttng snapshot list-output -s mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Snapshot output list for session mysession
+ [2] snapshot-2: net4://172.0.0.1:5342/
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+<COMMAND_INPUT>
+lttng list
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+ 1) mysession () [inactive snapshot]
+
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+<COMMAND_INPUT>
+lttng snapshot record -s mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+ Snapshot recorded successfully for session mysession
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+<COMMAND_INPUT>
+lttng destroy mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession destroyed.
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+
+
+
+####################################################################
+# Scenario: Test "lttng create <session> --snapshot (LTTng 2.3)
+####################################################################
+<SCENARIO>
+CreateSessionSnapshotErrors
+<COMMAND_INPUT>
+lttng snapshot list-output -s blabla
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+1
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Error: Session name not found
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+#next is not an error case but good to be tested
+<COMMAND_INPUT>
+lttng list
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+ 1) mysession () [active snapshot]
+
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+<COMMAND_INPUT>
+lttng snapshot record -s blabla
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+1
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+ Error: Session name not found
+</COMMAND_OUTPUT>
+#------------------------------------------------------------------------------
+<COMMAND_INPUT>
+lttng snapshot record -s mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+1
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+ Error: Session needs to be started once
+</COMMAND_OUTPUT>
</SCENARIO>
\ No newline at end of file
commands.control.calibrate=Calibrate
commands.control.calibrate.description=Quantify LTTng overhead
+commands.control.snapshot=Record Snapshot
+commands.control.snapshot.description=Record a snapshot
+
preference.page.control.name=LTTng Tracer Control Preferences
\ No newline at end of file
name="%commands.control.calibrate">
</command>
+ <command
+ categoryId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.category"
+ description="%commands.control.snapshot.description"
+ id="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.snapshot"
+ name="%commands.control.snapshot">
+ </command>
+
</extension>
<extension
point="org.eclipse.ui.menus">
name="org.eclipse.linuxtools.internal.lttng2.ui.views.control.toolbar.separator2"
visible="true">
</separator>
+ <command
+ commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.snapshot"
+ icon="icons/elcl16/snapshot.gif"
+ label="%commands.control.snapshot"
+ style="push">
+ </command>
+ <separator
+ name="org.eclipse.linuxtools.internal.lttng2.ui.views.control.toolbar.separator3"
+ visible="true">
+ </separator>
<command
commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.import"
icon="icons/elcl16/import_trace.gif"
</visibleWhen>
</command>
+ <command
+ commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.snapshot"
+ icon="icons/elcl16/snapshot.gif"
+ label="%commands.control.snapshot"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="activeMenuSelection">
+ <and>
+ <iterate
+ operator="or">
+ <instanceof
+ value="org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent">
+ </instanceof>
+ </iterate>
+ <count
+ value="1">
+ </count>
+ </and>
+ </with>
+ </visibleWhen>
+ </command>
+
</menuContribution>
</extension>
</activeWhen>
</handler>
+ <handler
+ class="org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.SnaphshotHandler"
+ commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.snapshot">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate
+ operator="or">
+ <instanceof
+ value="org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent">
+ </instanceof>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
+
+
<handler
class="org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.AssignEventHandler"
commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.assign.event">
* The text widget for the session path.
*/
private Text fSessionPathText = null;
+ /**
+ * The button widget to select a snapshot session
+ */
+ private Button fSnapshotButton = null;
/**
* The Group for stream configuration.
*/
* The session path string.
*/
private String fSessionPath = null;
+ /**
+ * The session path string.
+ */
+ private boolean fIsSnapshot = false;
/**
* Flag whether default location (path) shall be used or not
*/
fStreamingComposite = null;
fSessionName = null;
fSessionPath = null;
+ fIsSnapshot = false;
fIsDefaultPath = true;
fIsStreamedTrace = false;
fNetworkUrl = null;
public String getDataUrl() {
return fDataUrl;
}
-
+ @Override
+ public boolean isSnapshot() {
+ return fIsSnapshot;
+ }
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
fSessionPathText = new Text(sessionGroup, SWT.NONE);
fSessionPathText.setToolTipText(Messages.TraceControl_CreateSessionPathTooltip);
+ if (fParent.isSnapshotSupported()) {
+ fSnapshotButton = new Button(sessionGroup, SWT.CHECK);
+ fSnapshotButton.setText(Messages.TraceControl_CreateSessionSnapshotLabel);
+ fSnapshotButton.setToolTipText(Messages.TraceControl_CreateSessionSnapshotTooltip);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 4;
+ fSnapshotButton.setData(data);
+ }
+
// layout widgets
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 3;
fIsDefaultPath = false;
}
+ if(fParent.isSnapshotSupported()) {
+ fIsSnapshot = fSnapshotButton.getSelection();
+ }
+
fNetworkUrl = null;
fControlUrl = null;
fDataUrl = null;
*/
String getDataUrl();
+ /**
+ * @return <code>true</code> if is a snapshot session else <code>false</code>
+ */
+ boolean isSnapshot();
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
traceName.append(trace.getName());
traceName.insert(0, '-');
- while (!parent.getAbsolutePath().equals(fSession.getSessionPath())) {
+ String path = fSession.isSnapshotSession() ? fSession.getSnapshotInfo().getSnapshotPath() : fSession.getSessionPath();
+
+ while (!parent.getAbsolutePath().equals(path)) {
traceName.insert(0, parent.getName());
traceName.insert(0, '-');
parent = parent.getParentRemoteFile();
IFileServiceSubSystem fsss = proxy.getFileServiceSubSystem();
- final IRemoteFile remoteFolder = fsss.getRemoteFileObject(fSession.getSessionPath(), new NullProgressMonitor());
+ final String path = fSession.isSnapshotSession() ? fSession.getSnapshotInfo().getSnapshotPath() : fSession.getSessionPath();
+ final IRemoteFile remoteFolder = fsss.getRemoteFileObject(path, new NullProgressMonitor());
+ // make sure that remote directory is read and not cached
+ remoteFolder.markStale(true, true);
fFolderViewer = new CheckboxTreeViewer(contextGroup, SWT.BORDER);
GridData data = new GridData(GridData.FILL_BOTH);
});
fFolderViewer.setInput(remoteFolder);
- // Select all traces by default
Object[] children = remoteFolder.getContents(RemoteChildrenContentsType.getInstance());
- for (int i = 0; i < children.length; i++) {
- fFolderViewer.setSubtreeChecked(children[i], true);
+ // children can be null if there the path doesn't exist. This happens when a trace
+ // session hadn't been started and no output was created.
+ if (children != null) {
+ // Select all traces by default
+ for (int i = 0; i < children.length; i++) {
+ fFolderViewer.setSubtreeChecked(children[i], true);
+ }
}
Group projectGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
try {
if (dialog.isStreamedTrace()) {
sessionGroup.createSession(dialog.getSessionName(), dialog.getNetworkUrl(), dialog.getControlUrl(),
- dialog.getDataUrl(), monitor);
+ dialog.getDataUrl(), dialog.isSnapshot(), monitor);
} else {
String sessionPath = dialog.isDefaultSessionPath() ? null : dialog.getSessionPath();
- sessionGroup.createSession(dialog.getSessionName(), sessionPath, monitor);
+ sessionGroup.createSession(dialog.getSessionName(), sessionPath, dialog.isSnapshot(), monitor);
}
} catch (ExecutionException e) {
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateSessionFailure, e);
if (element instanceof TraceSessionComponent) {
// Add only TraceSessionComponents that are inactive and not destroyed
TraceSessionComponent tmpSession = (TraceSessionComponent) element;
- if ((tmpSession.getSessionState() == TraceSessionState.INACTIVE) && (!tmpSession.isDestroyed())) {
+ if (((tmpSession.isSnapshotSession()) || (tmpSession.getSessionState() == TraceSessionState.INACTIVE)) && (!tmpSession.isDestroyed())) {
session = tmpSession;
}
}
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2013 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.linuxtools.internal.lttng2.ui.views.control.handlers;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+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.MultiStatus;
+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.linuxtools.internal.lttng2.core.control.model.TraceSessionState;
+import org.eclipse.linuxtools.internal.lttng2.ui.Activator;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.ControlView;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * <p>
+ * Command handler implementation to record a snapshot.
+ * </p>
+ *
+ * @author Bernd Hufmann
+ */
+public class SnaphshotHandler extends BaseControlViewHandler {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+ /**
+ * The list of session components the command is to be executed on.
+ */
+ protected List<TraceSessionComponent> fSessions = new ArrayList<TraceSessionComponent>();
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ fLock.lock();
+ try {
+ // Make a copy for thread safety
+ final List<TraceSessionComponent> sessions = new ArrayList<TraceSessionComponent>();
+ sessions.addAll(fSessions);
+
+ Job job = new Job(Messages.TraceControl_RecordSnapshotJob) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, IStatus.OK, null, null);
+ for (Iterator<TraceSessionComponent> iterator = sessions.iterator(); iterator.hasNext();) {
+ try {
+ // record snapshot for all selected sessions sequentially
+ TraceSessionComponent session = iterator.next();
+ session.recordSnapshot(monitor);
+ if (monitor.isCanceled()) {
+ status.add(Status.CANCEL_STATUS);
+ break;
+ }
+ } catch (ExecutionException e) {
+ status.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_RecordSnapshotFailure, e));
+ }
+ }
+ return status;
+ }
+ };
+ job.setUser(true);
+ job.schedule();
+ } finally {
+ fLock.unlock();
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ // Get workbench page for the Control View
+ IWorkbenchPage page = getWorkbenchPage();
+ if (page == null) {
+ return false;
+ }
+
+ List<TraceSessionComponent> sessions = new ArrayList<TraceSessionComponent>(0);
+
+ // Check if one session 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 TraceSessionComponent) {
+ // Add only if corresponding TraceSessionComponent is an active snapshot session and not destroyed
+ TraceSessionComponent session = (TraceSessionComponent) element;
+ if(session.isSnapshotSession() &&
+ session.getSessionState() == TraceSessionState.ACTIVE &&
+ !session.isDestroyed()) {
+ sessions.add(session);
+ }
+ }
+ }
+ }
+ boolean isEnabled = !sessions.isEmpty();
+ fLock.lock();
+ try {
+ fSessions = null;
+ if (isEnabled) {
+ fSessions = sessions;
+ }
+ } finally {
+ fLock.unlock();
+ }
+ return isEnabled;
+ }
+}
\ No newline at end of file
public static String TraceControl_AddCalibrateJob;
public static String TraceControl_AddCalibrateFailure;
+ public static String TraceControl_RecordSnapshotJob;
+ public static String TraceControl_RecordSnapshotFailure;
+
// Dialogs
public static String TraceControl_NewDialogTitle;
public static String TraceControl_NewNodeExistingConnectionGroupName;
public static String TraceControl_CreateSessionNameTooltip;
public static String TraceControl_CreateSessionPathLabel;
public static String TraceControl_CreateSessionPathTooltip;
+ public static String TraceControl_CreateSessionSnapshotLabel;
+ public static String TraceControl_CreateSessionSnapshotTooltip;
public static String TraceControl_CreateSessionConfigureStreamingButtonText;
public static String TraceControl_CreateSessionConfigureStreamingButtonTooltip;
public static String TraceControl_HostNamePropertyName;
public static String TraceControl_HostAddressPropertyName;
public static String TraceControl_SessionPathPropertyName;
+ public static String TraceControl_SnapshotPathPropertyName;
+ public static String TraceControl_SnapshotNamePropertyName;
+ public static String TraceControl_SnapshotIdPropertyName;
public static String TraceControl_ProviderNamePropertyName;
public static String TraceControl_ProcessIdPropertyName;
public static String TraceControl_ProbeAddressPropertyName;
TraceControl_AddCalibrateJob=Calibrating...
TraceControl_AddCalibrateFailure=Command to calibrate failed
+TraceControl_RecordSnapshotJob=Record snapshot...
+TraceControl_RecordSnapshotFailure=Command to snapshot record failed
+
# Dialogs
TraceControl_NewDialogTitle=New Connection
TraceControl_NewNodeExistingConnectionGroupName=Existing Connections
TraceControl_CreateSessionNameTooltip=The name of the session to be created.
TraceControl_CreateSessionPathLabel=Session Path
TraceControl_CreateSessionPathTooltip=The session path (keep empty for default location)
+TraceControl_CreateSessionSnapshotLabel=Snapshot Mode
+TraceControl_CreateSessionSnapshotTooltip=Configure session in snapshot mode
+
TraceControl_CreateSessionConfigureStreamingButtonText=Advanced
TraceControl_CreateSessionConfigureStreamingButtonTooltip=Configure advanced options
TraceControl_HostNamePropertyName=Connection Name
TraceControl_HostAddressPropertyName=Host Name
TraceControl_SessionPathPropertyName=Session Path
+TraceControl_SnapshotPathPropertyName=Snapshot Path
+TraceControl_SnapshotNamePropertyName=Snapshot Name
+TraceControl_SnapshotIdPropertyName=Snapshot ID
TraceControl_ProviderNamePropertyName=Provider Name
TraceControl_ProcessIdPropertyName=Process ID
TraceControl_ProbeAddressPropertyName=Address
public boolean isPeriodicalMetadataFlushSupported() {
return getControlService().isVersionSupported("2.2.0"); //$NON-NLS-1$
}
+ /**
+ * Returns if node supports snapshots or not
+ * @return <code>true</code> if it supports snapshots else <code>false</code>
+ *
+ */
+ public boolean isSnapshotSupported() {
+ return getControlService().isVersionSupported("2.3.0"); //$NON-NLS-1$
+ }
// ------------------------------------------------------------------------
// Operations
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IChannelInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IDomainInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISnapshotInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceSessionState;
fSessionInfo.setStreamedTrace(isStreamedTrace);
}
+ /**
+ * Returns whether the session is snapshot session or not
+ * @return <code>true</code> if it is snapshot session else <code>false</code>
+ */
+ public boolean isSnapshotSession() {
+ return fSessionInfo.isSnapshotSession();
+ }
+
+ /**
+ * Gets the snapshot information if available whether the session is a snapshot session or not
+ * @return the snapshot information or null if it is not a snapshot session
+ */
+ public ISnapshotInfo getSnapshotInfo() {
+ return fSessionInfo.getSnapshotInfo();
+ }
+
@Override
public Object getAdapter(Class adapter) {
if (adapter == IPropertySource.class) {
return ((TargetNodeComponent)getParent().getParent()).isEventFilteringSupported();
}
+ /**
+ * Returns if node supports snapshots or not
+ * @return <code>true</code> if it supports snapshots else <code>false</code>
+ *
+ */
+ public boolean isSnapshotSupported() {
+ return ((TargetNodeComponent)getParent().getParent()).isSnapshotSupported();
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
throws ExecutionException {
removeAllChildren();
fSessionInfo = getControlService().getSession(getName(), monitor);
+
IDomainInfo[] domains = fSessionInfo.getDomains();
for (int i = 0; i < domains.length; i++) {
TraceDomainComponent domainComponent = new TraceDomainComponent(
throws ExecutionException {
return getControlService().getContextList(monitor);
}
+
+ /**
+ * Records a snapshot.
+ *
+ * @param monitor
+ * - a progress monitor
+ * @throws ExecutionException
+ * If the command fails
+ */
+ public void recordSnapshot(IProgressMonitor monitor) throws ExecutionException {
+ getControlService().recordSnapshot(getName(), monitor);
+ }
}
public boolean isNetworkStreamingSupported() {
return getTargetNode().isNetworkStreamingSupported();
}
+ /**
+ * Returns if node supports snapshots or not
+ * @return <code>true</code> if it supports snapshots else <code>false</code>
+ *
+ */ public boolean isSnapshotSupported() {
+ return getTargetNode().isSnapshotSupported();
+ }
// ------------------------------------------------------------------------
// Operations
* - a session name to create
* @param sessionPath
* - a path for storing the traces (use null for default)
+ * @param isSnapshot
+ * - true for snapshot session else false
* @param monitor
* - a progress monitor
* @throws ExecutionException
* If the command fails
*/
- public void createSession(String sessionName, String sessionPath, IProgressMonitor monitor) throws ExecutionException {
- ISessionInfo sessionInfo = getControlService().createSession(sessionName, sessionPath, monitor);
+ public void createSession(String sessionName, String sessionPath, boolean isSnapshot, IProgressMonitor monitor) throws ExecutionException {
+ ISessionInfo sessionInfo = getControlService().createSession(sessionName, sessionPath, isSnapshot, monitor);
if (sessionInfo != null) {
TraceSessionComponent session = new TraceSessionComponent(
* - a URL for control channel (networkUrl has to be null, dataUrl has to be set)
* @param dataUrl
* - a URL for data channel (networkUrl has to be null, controlUrl has to be set)
+ * @param isSnapshot
+ * - true for snapshot session else false
* @param monitor
* - a progress monitor
* @throws ExecutionException
* If the command fails
*/
- public void createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, IProgressMonitor monitor) throws ExecutionException {
- ISessionInfo sessionInfo = getControlService().createSession(sessionName, networkUrl, controlUrl, dataUrl, monitor);
+ public void createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, boolean isSnapshot, IProgressMonitor monitor) throws ExecutionException {
+ ISessionInfo sessionInfo = getControlService().createSession(sessionName, networkUrl, controlUrl, dataUrl, isSnapshot, monitor);
if (sessionInfo != null) {
TraceSessionComponent session = new TraceSessionComponent(sessionInfo.getName(), TraceSessionGroup.this);
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.ui.views.control.property;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
import org.eclipse.linuxtools.tmf.ui.properties.ReadOnlyTextPropertyDescriptor;
* The trace session state ID.
*/
public static final String TRACE_SESSION_STATE_PROPERTY_ID = "trace.session.state"; //$NON-NLS-1$
+ /**
+ * The trace snapshot path property ID.
+ */
+ public static final String TRACE_SNAPSHOT_PATH_PROPERTY_ID = "trace.snapshot.path"; //$NON-NLS-1$
+ /**
+ * The snapshot name property.
+ */
+ public static final String TRACE_SNAPSHOT_NAME_PROPERTY_ID = "trace.snapshot.name"; //$NON-NLS-1$
+ /**
+ * The snapshot ID property.
+ */
+ public static final String TRACE_SNAPSHOT_ID_PROPERTY_ID = "trace.snapshot.id"; //$NON-NLS-1$
+
/**
* The trace session name property name.
*/
* The trace session state property name.
*/
public static final String TRACE_SESSION_STATE_PROPERTY_NAME = Messages.TraceControl_StatePropertyName;
+ /**
+ * The snapshot path property name.
+ */
+ public static final String TRACE_SNAPSHOT_PATH_PROPERTY_NAME = Messages.TraceControl_SnapshotPathPropertyName;
+ /**
+ * The trace snapshot name property name.
+ */
+ public static final String TRACE_SNAPSHOT_NAME_PROPERTY_NAME = Messages.TraceControl_SnapshotNamePropertyName;
+ /**
+ * The trace snapshot ID property name.
+ */
+ public static final String TRACE_SNAPSHOT_ID_PROPERTY_NAME = Messages.TraceControl_SnapshotIdPropertyName;
+
// ------------------------------------------------------------------------
// Attributes
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
- return new IPropertyDescriptor[] {
- new ReadOnlyTextPropertyDescriptor(TRACE_SESSION_NAME_PROPERTY_ID, TRACE_SESSION_NAME_PROPERTY_NAME),
- new ReadOnlyTextPropertyDescriptor(TRACE_SESSION_PATH_PROPERTY_ID, TRACE_SESSION_PATH_PROPERTY_NAME),
- new ReadOnlyTextPropertyDescriptor(TRACE_SESSION_STATE_PROPERTY_ID, TRACE_SESSION_STATE_PROPERTY_NAME)};
+ List<IPropertyDescriptor> list = new ArrayList<IPropertyDescriptor> ();
+ list.add(new ReadOnlyTextPropertyDescriptor(TRACE_SESSION_NAME_PROPERTY_ID, TRACE_SESSION_NAME_PROPERTY_NAME));
+ list.add(new ReadOnlyTextPropertyDescriptor(TRACE_SESSION_STATE_PROPERTY_ID, TRACE_SESSION_STATE_PROPERTY_NAME));
+ if (fSession.isSnapshotSession()) {
+ list.add(new ReadOnlyTextPropertyDescriptor(TRACE_SNAPSHOT_NAME_PROPERTY_ID, TRACE_SNAPSHOT_NAME_PROPERTY_NAME));
+ list.add(new ReadOnlyTextPropertyDescriptor(TRACE_SNAPSHOT_PATH_PROPERTY_ID, TRACE_SNAPSHOT_PATH_PROPERTY_NAME));
+ list.add(new ReadOnlyTextPropertyDescriptor(TRACE_SNAPSHOT_ID_PROPERTY_ID, TRACE_SNAPSHOT_ID_PROPERTY_NAME));
+ } else {
+ list.add(new ReadOnlyTextPropertyDescriptor(TRACE_SESSION_PATH_PROPERTY_ID, TRACE_SESSION_PATH_PROPERTY_NAME));
+ }
+ return(list.toArray(new IPropertyDescriptor[list.size()]));
}
@Override
if (TRACE_SESSION_STATE_PROPERTY_ID.equals(id)) {
return fSession.getSessionState().name();
}
+ if (TRACE_SNAPSHOT_PATH_PROPERTY_ID.equals(id)) {
+ return (fSession.isSnapshotSession() ? fSession.getSnapshotInfo().getSnapshotPath() : ""); //$NON-NLS-1$
+ }
+ if (TRACE_SNAPSHOT_NAME_PROPERTY_ID.equals(id)) {
+ return (fSession.isSnapshotSession() ? fSession.getSnapshotInfo().getName() : ""); //$NON-NLS-1$
+ }
+ if (TRACE_SNAPSHOT_ID_PROPERTY_ID.equals(id)) {
+ return (fSession.isSnapshotSession() ? fSession.getSnapshotInfo().getId() : ""); //$NON-NLS-1$
+ }
return null;
}
}
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IChannelInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISnapshotInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IUstProviderInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel;
ISessionInfo getSession(String sessionName, IProgressMonitor monitor)
throws ExecutionException;
+ /**
+ * Retrieves the snapshot output information from the node
+ * @param sessionName
+ * - the session name
+ * @param monitor
+ * - a progress monitor
+ * @return snapshot output information
+ * @throws ExecutionException
+ * if command fails
+ */
+ ISnapshotInfo getSnapshotInfo(String sessionName, IProgressMonitor monitor)
+ throws ExecutionException;
+
/**
* Retrieves the kernel provider information (i.e. the kernel events)
*
* - a session name to create
* @param sessionPath
* - a path for storing the traces (use null for default)
+ * @param isSnapshot
+ * - true for snapshot session else false
* @param monitor
* - a progress monitor
* @return the session information
* @throws ExecutionException
* If the command fails
*/
- ISessionInfo createSession(String sessionName, String sessionPath, IProgressMonitor monitor) throws ExecutionException;
+ ISessionInfo createSession(String sessionName, String sessionPath, boolean isSnapshot, IProgressMonitor monitor) throws ExecutionException;
/**
* Creates a session with given session name and location.
* - a URL for control channel (networkUrl has to be null, dataUrl has to be set)
* @param dataUrl
* - a URL for data channel (networkUrl has to be null, controlUrl has to be set)
+ * @param isSnapshot
+ * - true for snapshot session else false
* @param monitor
* - a progress monitor
* @return the session information
* @throws ExecutionException
* If the command fails
*/
- ISessionInfo createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, IProgressMonitor monitor) throws ExecutionException;
+ ISessionInfo createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, boolean isSnapshot, IProgressMonitor monitor) throws ExecutionException;
/**
* Destroys a session with given session name.
*/
void calibrate(boolean isKernel, IProgressMonitor monitor)
throws ExecutionException;
+
+ /**
+ * Records a snapshot.
+ *
+ * @param sessionName
+ * - a session name
+ * @param monitor
+ * - a progress monitor
+ * @throws ExecutionException
+ * If the command fails
+ */
+ void recordSnapshot(String sessionName, IProgressMonitor monitor)
+ throws ExecutionException;
}
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IFieldInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IProbeEventInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISnapshotInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IUstProviderInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEventType;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.FieldInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.ProbeEventInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.SessionInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.SnapshotInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.UstProviderInfo;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.logging.ControlCommandLogger;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
continue;
}
- matcher = LTTngControlServiceConstants.TRACE_NETWORK_PATH_PATTERN.matcher(line);
+ matcher = LTTngControlServiceConstants.TRACE_SNAPSHOT_SESSION_PATTERN.matcher(line);
if (matcher.matches()) {
- sessionInfo.setStreamedTrace(true);
- }
-
- matcher = LTTngControlServiceConstants.TRACE_SESSION_PATH_PATTERN.matcher(line);
- if (matcher.matches()) {
- sessionInfo.setSessionPath(matcher.group(1).trim());
+ sessionInfo.setSessionState(matcher.group(2));
+ // real name will be set later
+ ISnapshotInfo snapshotInfo = new SnapshotInfo(""); //$NON-NLS-1$
+ sessionInfo.setSnapshotInfo(snapshotInfo);
index++;
continue;
}
+ if (!sessionInfo.isSnapshotSession()) {
+ matcher = LTTngControlServiceConstants.TRACE_NETWORK_PATH_PATTERN.matcher(line);
+ if (matcher.matches()) {
+ sessionInfo.setStreamedTrace(true);
+ }
+
+ matcher = LTTngControlServiceConstants.TRACE_SESSION_PATH_PATTERN.matcher(line);
+ if (matcher.matches()) {
+ sessionInfo.setSessionPath(matcher.group(1).trim());
+ index++;
+ continue;
+ }
+ }
+
matcher = LTTngControlServiceConstants.DOMAIN_KERNEL_PATTERN.matcher(line);
if (matcher.matches()) {
// Create Domain
}
index++;
}
+
+ if (sessionInfo.isSnapshotSession()) {
+ ISnapshotInfo snapshot = getSnapshotInfo(sessionName, monitor);
+ sessionInfo.setSnapshotInfo(snapshot);
+ }
+
return sessionInfo;
}
+ @Override
+ public ISnapshotInfo getSnapshotInfo(String sessionName, IProgressMonitor monitor) throws ExecutionException {
+ StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_LIST_SNAPSHOT_OUTPUT, LTTngControlServiceConstants.OPTION_SESSION, sessionName);
+ ICommandResult result = executeCommand(command.toString(), monitor);
+
+ int index = 0;
+
+ // Output:
+ // [1] snapshot-1: /home/user/lttng-traces/my-20130909-114431
+ // or
+ // [3] snapshot-3: net4://172.0.0.1/
+ ISnapshotInfo snapshotInfo = new SnapshotInfo(""); //$NON-NLS-1$
+
+ while (index < result.getOutput().length) {
+ String line = result.getOutput()[index];
+ Matcher matcher = LTTngControlServiceConstants.LIST_SNAPSHOT_OUTPUT_PATTERN.matcher(line);
+ if (matcher.matches()) {
+ snapshotInfo.setId(Integer.valueOf(matcher.group(1)));
+ snapshotInfo.setName(matcher.group(2));
+ snapshotInfo.setSnapshotPath(matcher.group(3));
+
+ Matcher matcher2 = LTTngControlServiceConstants.SNAPSHOT_NETWORK_PATH_PATTERN.matcher(snapshotInfo.getSnapshotPath());
+ if (matcher2.matches()) {
+ snapshotInfo.setStreamedSnapshot(true);
+ }
+
+ index++;
+ break;
+ }
+ index++;
+ }
+
+ return snapshotInfo;
+ }
+
@Override
public List<IBaseEventInfo> getKernelProvider(IProgressMonitor monitor) throws ExecutionException {
StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_LIST_KERNEL);
}
@Override
- public ISessionInfo createSession(String sessionName, String sessionPath, IProgressMonitor monitor) throws ExecutionException {
+ public ISessionInfo createSession(String sessionName, String sessionPath, boolean isSnapshot, IProgressMonitor monitor) throws ExecutionException {
String newName = formatParameter(sessionName);
String newPath = formatParameter(sessionPath);
command.append(newPath);
}
+ if (isSnapshot) {
+ command.append(LTTngControlServiceConstants.OPTION_SNAPSHOT);
+ }
+
ICommandResult result = executeCommand(command.toString(), monitor);
//Session myssession2 created.
SessionInfo sessionInfo = new SessionInfo(name);
// Verify session path
- if ((path == null) || ((sessionPath != null) && (!path.contains(sessionPath)))) {
+ if (!isSnapshot &&
+ ((path == null) || ((sessionPath != null) && (!path.contains(sessionPath))))) {
// Unexpected path
throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$
Messages.TraceControl_UnexpectedPathError + ": " + name); //$NON-NLS-1$
}
- sessionInfo.setSessionPath(path);
+ if (isSnapshot) {
+ // Make it a snapshot session - content of snapshot info need to
+ // set afterwards using getSession() or getSnapshotInfo()
+ sessionInfo.setSnapshotInfo(new SnapshotInfo("")); //$NON-NLS-1$
+ } else {
+ sessionInfo.setSessionPath(path);
+ }
return sessionInfo;
}
@Override
- public ISessionInfo createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, IProgressMonitor monitor) throws ExecutionException {
+ public ISessionInfo createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, boolean isSnapshot, IProgressMonitor monitor) throws ExecutionException {
String newName = formatParameter(sessionName);
StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_CREATE_SESSION, newName);
+ if (isSnapshot) {
+ command.append(LTTngControlServiceConstants.OPTION_SNAPSHOT);
+ }
+
if (networkUrl != null) {
command.append(LTTngControlServiceConstants.OPTION_NETWORK_URL);
command.append(networkUrl);
// Verify session path
if (networkUrl != null) {
- if (path == null) {
+ if (!isSnapshot && (path == null)) {
// Unexpected path
throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$
Messages.TraceControl_UnexpectedPathError + ": " + name); //$NON-NLS-1$
}
- sessionInfo.setSessionPath(path);
-
- // Check file protocol
- Matcher matcher = LTTngControlServiceConstants.TRACE_FILE_PROTOCOL_PATTERN.matcher(path);
- if (matcher.matches()) {
+ if (isSnapshot) {
sessionInfo.setStreamedTrace(false);
+ } else {
+ sessionInfo.setSessionPath(path);
+ // Check file protocol
+ Matcher matcher = LTTngControlServiceConstants.TRACE_FILE_PROTOCOL_PATTERN.matcher(path);
+ if (matcher.matches()) {
+ sessionInfo.setStreamedTrace(false);
+ }
}
}
+
// When using controlUrl and dataUrl the full session path is not known yet
// and will be set later on when listing the session
executeCommand(command.toString(), monitor);
}
+ @Override
+ public void recordSnapshot(String sessionName, IProgressMonitor monitor)
+ throws ExecutionException {
+ StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_RECORD_SNAPSHOT);
+
+ String newSessionName = formatParameter(sessionName);
+ command.append(LTTngControlServiceConstants.OPTION_SESSION);
+ command.append(newSessionName);
+
+ executeCommand(command.toString(), monitor);
+ }
+
// ------------------------------------------------------------------------
// Helper methods
// ------------------------------------------------------------------------
* Command to execute calibrate command to quantify LTTng overhead
*/
static final String COMMAND_CALIBRATE = " calibrate "; //$NON-NLS-1$
+ /**
+ * Command to execute calibrate command to quantify LTTng overhead
+ */
+ static final String COMMAND_LIST_SNAPSHOT_OUTPUT = " snapshot list-output "; //$NON-NLS-1$
+ /**
+ * Command to execute calibrate command to quantify LTTng overhead
+ */
+ static final String COMMAND_RECORD_SNAPSHOT = " snapshot record "; //$NON-NLS-1$
// ------------------------------------------------------------------------
// Command line options constants
* Command line option for output path.
*/
static final String OPTION_OUTPUT_PATH = " -o "; //$NON-NLS-1$
+ /**
+ * Command line option for output path.
+ */
+ static final String OPTION_SNAPSHOT = " --snapshot "; //$NON-NLS-1$
/**
* Command line option for kernel tracer.
*/
/**
* Pattern to match for session information (lttng list)
*/
- static final Pattern SESSION_PATTERN = Pattern.compile("\\s+(\\d+)\\)\\s+(.*)\\s+\\((.*)\\)\\s+\\[(active|inactive)\\].*"); //$NON-NLS-1$
+ static final Pattern SESSION_PATTERN = Pattern.compile("\\s+(\\d+)\\)\\s+(.*)\\s+\\((.*)\\)\\s+\\[(active|inactive).*\\].*"); //$NON-NLS-1$
/**
* Pattern to match for session information (lttng list <session>)
*/
static final Pattern TRACE_SESSION_PATTERN = Pattern.compile("\\s*Tracing\\s+session\\s+(.*)\\:\\s+\\[(active|inactive)\\].*"); //$NON-NLS-1$
+ /**
+ * Pattern to match for snapshot session information (lttng list <session>)
+ */
+ static final Pattern TRACE_SNAPSHOT_SESSION_PATTERN = Pattern.compile("\\s*Tracing\\s+session\\s+(.*)\\:\\s+\\[(active|inactive)\\s*snapshot\\].*"); //$NON-NLS-1$
/**
* Pattern to match for session path information (lttng list <session>)
*/
* Pattern to match session path for network tracing (lttng list <session>)
* Note: file for protocol is not considered as network trace since local consumer will be used.
*/
- static final Pattern TRACE_NETWORK_PATH_PATTERN = Pattern.compile("\\s*Trace\\s+path\\:\\s+(net|net6|tcp|tcp6)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$
+ static final Pattern TRACE_NETWORK_PATH_PATTERN = Pattern.compile("\\s*Trace\\s+path\\:\\s+(net|net4|net6|tcp|tcp6)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$
/**
* Sub-pattern to pattern TRACE_NETWORK_PATH_PATTERN to match file protocol
*/
* Pattern to match error line if no ust tracer is available or installed.
*/
static final Pattern LIST_UST_NO_UST_PROVIDER_PATTERN = Pattern.compile(".*Unable\\s*to\\s*list\\s*UST\\s*event.*"); //$NON-NLS-1$;
+ /**
+ * Pattern to match for list snapshot information (lttng snapshot list-output)
+ */
+ static final Pattern LIST_SNAPSHOT_OUTPUT_PATTERN = Pattern.compile("\\s+\\[(\\d+)\\]\\s+(.*)\\:\\s+(.*)"); //$NON-NLS-1$
+ /**
+ * Pattern to match snapshot path for network tracing (lttng list <session>)
+ * Note: file for protocol is not considered as network trace since local consumer will be used.
+ */
+ static final Pattern SNAPSHOT_NETWORK_PATH_PATTERN = Pattern.compile("(net|net4|net6|tcp|tcp6)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$
+
}