summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorBernd Hufmann2012-12-21 13:45:28 (EST)
committer Matthew Khouzam2013-01-11 11:29:45 (EST)
commit09fe925ee71224e064cf49a2181fee13bd5ce46b (patch)
tree4cb7decb1bb85f654f79f6ae4e0603aac138d106
parentc1708e076ab0dcdbf6fadec101ed59ebebf8c549 (diff)
downloadorg.eclipse.linuxtools-09fe925ee71224e064cf49a2181fee13bd5ce46b.zip
org.eclipse.linuxtools-09fe925ee71224e064cf49a2181fee13bd5ce46b.tar.gz
org.eclipse.linuxtools-09fe925ee71224e064cf49a2181fee13bd5ce46b.tar.bz2
Add support for filter feature of LTTng Tools 2.1refs/changes/62/9362/2
- Retrieve filter information from target - Display filter information in Properties View - Add support for filter configuration for enable-events (UST) - Display UST event fields in Properties View - Update JUnit tests Change-Id: Ibd341bb51059d60027ff9f2722ff15e4d275e9cf Signed-off-by: Bernd Hufmann <bhufmann@gmail.com> Reviewed-on: https://git.eclipse.org/r/9362 Tested-by: Hudson CI IP-Clean: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/AllTests.java1
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/BaseEventInfoTest.java72
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/FieldInfoTest.java170
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ModelImplFactory.java21
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/UstProviderInfoTest.java5
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/IBaseEventInfo.java54
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/IFieldInfo.java34
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/BaseEventInfo.java132
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/FieldInfo.java129
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java19
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java101
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableEventsDialogStub.java11
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/GetEventInfoDialogStub.java23
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg43
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/ListInfoTest.cfg12
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableEventsDialog.java12
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableUstEventsComposite.java49
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/GetEventInfoDialog.java52
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableUstEvents.java25
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IGetEventInfoDialog.java20
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AssignEventHandler.java4
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableEventHandler.java18
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnChannelHandler.java12
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnDomainHandler.java10
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnSessionHandler.java13
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java4
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties4
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/BaseEventComponent.java21
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java8
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceChannelComponent.java30
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceDomainComponent.java14
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceEventComponent.java16
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceProviderGroup.java8
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java32
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/BaseEventPropertySource.java14
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceEventPropertySource.java16
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java17
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java113
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java18
39 files changed, 1218 insertions, 139 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/AllTests.java b/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/AllTests.java
index 6fa43af..e502b82 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/AllTests.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/AllTests.java
@@ -21,6 +21,7 @@ public class AllTests {
TestSuite suite = new TestSuite(AllTests.class.getName());
//$JUnit-BEGIN$
+ suite.addTestSuite(FieldInfoTest.class);
suite.addTestSuite(BaseEventInfoTest.class);
suite.addTestSuite(DomainInfoTest.class);
suite.addTestSuite(EventInfoTest.class);
diff --git a/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/BaseEventInfoTest.java b/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/BaseEventInfoTest.java
index b8520ae..352a8ff 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/BaseEventInfoTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/BaseEventInfoTest.java
@@ -11,12 +11,17 @@
**********************************************************************/
package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
+import java.util.LinkedList;
+import java.util.List;
+
import junit.framework.TestCase;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.IFieldInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEventType;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.BaseEventInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.FieldInfo;
/**
* The class <code>BaseEventInfoTest</code> contains test for the class <code>{@link BaseEventInfo}</code>.
@@ -93,6 +98,15 @@ public class BaseEventInfoTest extends TestCase {
assertEquals(fEventInfo1.getName(), info.getName());
assertEquals(fEventInfo1.getEventType(), info.getEventType());
assertEquals(fEventInfo1.getLogLevel(), info.getLogLevel());
+ assertEquals(fEventInfo1.getFilterExpression(), info.getFilterExpression());
+
+ IFieldInfo[] orignalFields = fEventInfo1.getFields();
+ IFieldInfo[] copiedFields = info.getFields();
+ assertEquals(orignalFields.length, copiedFields.length);
+
+ for (int i = 0; i < copiedFields.length; i++) {
+ assertEquals(orignalFields[i], copiedFields[i]);
+ }
}
/**
@@ -391,6 +405,64 @@ public class BaseEventInfoTest extends TestCase {
assertEquals(14, result.ordinal());
}
+ /**
+ * test filter expression
+ */
+ public void testSetFields() {
+ BaseEventInfo info = new BaseEventInfo((BaseEventInfo)fEventInfo2);
+ info.setFilterExpression("stringfield==test");
+ assertEquals("stringfield==test", info.getFilterExpression());
+ }
+
+
+ /**
+ * test add field
+ */
+ public void testAddField() {
+ BaseEventInfo info = new BaseEventInfo((BaseEventInfo)fEventInfo2);
+
+ IFieldInfo field = new FieldInfo("intfield");
+ field.setFieldType("int");
+
+ info.addField(field);
+
+ // Verify the stored events
+ IFieldInfo[] result = info.getFields();
+
+ assertNotNull(result);
+ assertEquals(1, result.length);
+ assertNotNull(result[0]);
+ assertTrue(field.equals(result[0]));
+ }
+
+ /**
+ * test set fields
+ */
+ public void testFields() {
+ BaseEventInfo info = new BaseEventInfo((BaseEventInfo)fEventInfo2);
+
+ IFieldInfo field1 = new FieldInfo("intfield");
+ field1.setFieldType("int");
+
+ IFieldInfo field2 = new FieldInfo("stringfield");
+ field2.setFieldType("string");
+
+ List<IFieldInfo> fields = new LinkedList<IFieldInfo>();
+ fields.add(field1);
+ fields.add(field2);
+ info.setFields(fields);
+
+ // Verify the stored events
+ IFieldInfo[] result = info.getFields();
+
+ assertNotNull(result);
+ assertEquals(2, result.length);
+
+ for (int i = 0; i < result.length; i++) {
+ assertNotNull(result[i]);
+ assertTrue(fields.get(i).equals(result[i]));
+ }
+ }
/**
* Run the String toString() method test.
diff --git a/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/FieldInfoTest.java b/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/FieldInfoTest.java
new file mode 100644
index 0000000..9e391b2
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/FieldInfoTest.java
@@ -0,0 +1,170 @@
+/**********************************************************************
+ * Copyright (c) 2012 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 junit.framework.TestCase;
+
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.IFieldInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.FieldInfo;
+
+/**
+ * The class <code>FieldInfoTest</code> contains test for the class <code>{@link FieldInfo}</code>.
+ */
+@SuppressWarnings({"nls", "javadoc"})
+public class FieldInfoTest extends TestCase {
+
+ // ------------------------------------------------------------------------
+ // Test data
+ // ------------------------------------------------------------------------
+ private IFieldInfo fFieldInfo1 = null;
+ private IFieldInfo fFieldInfo2 = null;
+
+ // ------------------------------------------------------------------------
+ // Housekeeping
+ // ------------------------------------------------------------------------
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ */
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ ModelImplFactory factory = new ModelImplFactory();
+ fFieldInfo1 = factory.getFieldInfo1();
+ fFieldInfo2 = factory.getFieldInfo2();
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ */
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ // ------------------------------------------------------------------------
+ // Tests
+ // ------------------------------------------------------------------------
+
+ /**
+ * Run the BaseEventInfo() constructor test.
+ *
+ */
+ public void testFiledInfo() {
+ FieldInfo fixture = new FieldInfo("field");
+ assertNotNull(fixture);
+
+ assertEquals("field", fixture.getName());
+ assertNull(fixture.getFieldType());
+ }
+
+ /**
+ * Test Copy Constructor
+ */
+ public void testEventInfoCopy() {
+ FieldInfo info = new FieldInfo((FieldInfo)fFieldInfo1);
+
+ assertEquals(fFieldInfo1.getName(), info.getName());
+ assertEquals(fFieldInfo1.getFieldType(), info.getFieldType());
+ }
+
+ /**
+ * Test Copy Constructor
+ */
+ public void testEventCopy2() {
+ try {
+ FieldInfo info = null;
+ new FieldInfo(info);
+ fail("null copy");
+ }
+ catch (IllegalArgumentException e) {
+ // Success
+ }
+ }
+
+ /**
+ * Run the TraceEventType getEventType() method test.
+ *
+ * @throws Exception
+ *
+ */
+ public void testSetFieldType() {
+ FieldInfo info = new FieldInfo((FieldInfo)fFieldInfo1);
+
+ info.setFieldType("string");
+ assertEquals("string", info.getFieldType());
+ }
+
+ public void testToString() {
+ String result = fFieldInfo1.toString();
+
+ // add additional test code here
+ assertEquals("[FieldInfo([TraceInfo(Name=intfield)],type=int", result);
+ }
+
+ // ------------------------------------------------------------------------
+ // equals
+ // ------------------------------------------------------------------------
+
+ public void testEqualsReflexivity() {
+ assertTrue("equals", fFieldInfo1.equals(fFieldInfo1));
+ assertTrue("equals", fFieldInfo2.equals(fFieldInfo2));
+
+ assertTrue("equals", !fFieldInfo1.equals(fFieldInfo2));
+ assertTrue("equals", !fFieldInfo2.equals(fFieldInfo1));
+ }
+
+ public void testEqualsSymmetry() {
+ FieldInfo info1 = new FieldInfo((FieldInfo)fFieldInfo1);
+ FieldInfo info2 = new FieldInfo((FieldInfo)fFieldInfo2);
+
+ assertTrue("equals", info1.equals(fFieldInfo1));
+ assertTrue("equals", fFieldInfo1.equals(info1));
+
+ assertTrue("equals", info2.equals(fFieldInfo2));
+ assertTrue("equals", fFieldInfo2.equals(info2));
+ }
+
+ public void testEqualsTransivity() {
+ FieldInfo info1 = new FieldInfo((FieldInfo)fFieldInfo1);
+ FieldInfo info2 = new FieldInfo((FieldInfo)fFieldInfo1);
+ FieldInfo info3 = new FieldInfo((FieldInfo)fFieldInfo1);
+
+ assertTrue("equals", info1.equals(info2));
+ assertTrue("equals", info2.equals(info3));
+ assertTrue("equals", info1.equals(info3));
+ }
+
+ public void testEqualsNull() {
+ assertTrue("equals", !fFieldInfo1.equals(null));
+ assertTrue("equals", !fFieldInfo2.equals(null));
+ }
+
+ // ------------------------------------------------------------------------
+ // hashCode
+ // ------------------------------------------------------------------------
+
+ public void testHashCode() {
+ FieldInfo info1 = new FieldInfo((FieldInfo)fFieldInfo1);
+ FieldInfo info2 = new FieldInfo((FieldInfo)fFieldInfo2);
+
+ assertTrue("hashCode", fFieldInfo1.hashCode() == info1.hashCode());
+ assertTrue("hashCode", fFieldInfo2.hashCode() == info2.hashCode());
+
+ assertTrue("hashCode", fFieldInfo1.hashCode() != info2.hashCode());
+ assertTrue("hashCode", fFieldInfo2.hashCode() != info1.hashCode());
+ }
+} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ModelImplFactory.java b/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ModelImplFactory.java
index fa92c7c..5f8babb 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ModelImplFactory.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ModelImplFactory.java
@@ -15,6 +15,7 @@ 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.IDomainInfo;
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.IProbeEventInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IUstProviderInfo;
@@ -26,6 +27,7 @@ import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.BaseEventI
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.ChannelInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.DomainInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.EventInfo;
+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.UstProviderInfo;
@@ -45,6 +47,8 @@ public class ModelImplFactory {
private IEventInfo fEventInfo1 = null;
private IEventInfo fEventInfo2 = null;
private IEventInfo fEventInfo3 = null;
+ private IFieldInfo fFieldInfo1 = null;
+ private IFieldInfo fFieldInfo2 = null;
private IBaseEventInfo fBaseEventInfo1 = null;
private IBaseEventInfo fBaseEventInfo2 = null;
private IUstProviderInfo fUstProviderInfo1 = null;
@@ -53,9 +57,19 @@ public class ModelImplFactory {
private IProbeEventInfo fProbeEventInfo2 = null;
public ModelImplFactory() {
+
+ fFieldInfo1 = new FieldInfo("intfield");
+ fFieldInfo1.setFieldType("int");
+ fFieldInfo2 = new FieldInfo("stringfield");
+ fFieldInfo2.setFieldType("string");
+
fBaseEventInfo1 = new BaseEventInfo("event1");
fBaseEventInfo1.setEventType(TraceEventType.UNKNOWN);
fBaseEventInfo1.setLogLevel(TraceLogLevel.TRACE_ERR);
+ fBaseEventInfo1.addField(fFieldInfo1);
+ fBaseEventInfo1.addField(fFieldInfo2);
+ fBaseEventInfo1.setFilterExpression("intField==10");
+
fBaseEventInfo2 = new BaseEventInfo("event2");
fBaseEventInfo2.setEventType(TraceEventType.TRACEPOINT);
fBaseEventInfo1.setLogLevel(TraceLogLevel.TRACE_DEBUG);
@@ -192,4 +206,11 @@ public class ModelImplFactory {
return fProbeEventInfo2;
}
+ public IFieldInfo getFieldInfo1() {
+ return fFieldInfo1;
+ }
+
+ public IFieldInfo getFieldInfo2() {
+ return fFieldInfo2;
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/UstProviderInfoTest.java b/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/UstProviderInfoTest.java
index 9cec2bf..de0facf 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/UstProviderInfoTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/UstProviderInfoTest.java
@@ -171,7 +171,10 @@ public class UstProviderInfoTest extends TestCase {
*/
public void testToString_2() {
String result = fUstProviderInfo2.toString();
- assertEquals("[EventInfo([TraceInfo(Name=myUST2)],PID=2345,Events=[BaseEventInfo([TraceInfo(Name=event1)],type=UNKNOWN,level=TRACE_DEBUG)][BaseEventInfo([TraceInfo(Name=event2)],type=TRACEPOINT,level=TRACE_DEBUG)])]", result);
+ assertEquals("[EventInfo([TraceInfo(Name=myUST2)],PID=2345,Events=[BaseEventInfo([TraceInfo(Name=event1)]," +
+ "type=UNKNOWN,level=TRACE_DEBUG,Fields=[FieldInfo([TraceInfo(Name=intfield)],type=int[FieldInfo" +
+ "([TraceInfo(Name=stringfield)],type=string,Filter=intField==10)][BaseEventInfo([TraceInfo(Name=event2)]," +
+ "type=TRACEPOINT,level=TRACE_DEBUG)])]", result);
}
// ------------------------------------------------------------------------
diff --git a/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/IBaseEventInfo.java b/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/IBaseEventInfo.java
index d7aac5a..cfca86a 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/IBaseEventInfo.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/IBaseEventInfo.java
@@ -1,21 +1,23 @@
/**********************************************************************
* Copyright (c) 2012 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:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.core.control.model;
+import java.util.List;
+
/**
* <p>
* Interface for retrieval of basic trace event information.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public interface IBaseEventInfo extends ITraceInfo {
@@ -24,35 +26,63 @@ public interface IBaseEventInfo extends ITraceInfo {
* @return the trace event type
*/
public TraceEventType getEventType();
-
+
/**
- * Sets the trace event type to the given type
+ * Sets the trace event type to the given type
* @param type - type to set
*/
public void setEventType(TraceEventType type);
-
+
/**
* Sets the trace event type to the type specified by the given name.
* @param typeName - event type name
*/
public void setEventType(String typeName);
-
+
/**
* @return the trace event log level
*/
public TraceLogLevel getLogLevel();
-
+
/**
- * Sets the trace event log level to the given level
+ * Sets the trace event log level to the given level
* @param level - event log level to set
*/
public void setLogLevel(TraceLogLevel level);
-
+
/**
* Sets the trace event log level to the level specified by the given name.
* @param levelName - event log level name
*/
public void setLogLevel(String levelName);
-
+ /**
+ * Returns the field information (if exists)
+ * @return the field information or null
+ */
+ public IFieldInfo[] getFields();
+
+ /**
+ * @param field The field to add
+ */
+ public void addField(IFieldInfo field);
+
+ /**
+ * Sets the fields
+ * @param fields The fields
+ */
+ public void setFields(List<IFieldInfo> fields);
+
+ /**
+ * Returns filter expression.
+ * @return filter expression
+ */
+ public String getFilterExpression();
+
+ /**
+ * Sets the filter expression.
+ * @param filter The filter expression to set
+ */
+ public void setFilterExpression(String filter);
+
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/IFieldInfo.java b/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/IFieldInfo.java
new file mode 100644
index 0000000..f4a13e9
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/IFieldInfo.java
@@ -0,0 +1,34 @@
+/**********************************************************************
+ * Copyright (c) 2012 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 event field information.
+ * </p>
+ *
+ * @author Bernd Hufmann
+ */
+public interface IFieldInfo extends ITraceInfo {
+
+ /**
+ * @return the event field type
+ */
+ public String getFieldType();
+
+ /**
+ * Sets field type string
+ *
+ * @param fieldType - sting of event field type
+ */
+ public void setFieldType(String fieldType);
+}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/BaseEventInfo.java b/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/BaseEventInfo.java
index 642cce6..9ad619b 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/BaseEventInfo.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/BaseEventInfo.java
@@ -1,26 +1,31 @@
/**********************************************************************
* Copyright (c) 2012 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:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.core.control.model.impl;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.IFieldInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEventType;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel;
/**
* <p>
* Implementation of the basic trace event interface (IEventInfo) to store event
-* related data.
+* related data.
* </p>
-*
+*
* @author Bernd Hufmann
*/
public class BaseEventInfo extends TraceInfo implements IBaseEventInfo {
@@ -36,7 +41,15 @@ public class BaseEventInfo extends TraceInfo implements IBaseEventInfo {
* The trace log level.
*/
private TraceLogLevel fLogLevel = TraceLogLevel.TRACE_DEBUG;
-
+ /**
+ * The Event fields
+ */
+ private final List<IFieldInfo> fFields = new ArrayList<IFieldInfo>();
+ /**
+ * The filter expression.
+ */
+ private String fFilterExpression;
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
@@ -55,6 +68,17 @@ public class BaseEventInfo extends TraceInfo implements IBaseEventInfo {
public BaseEventInfo(BaseEventInfo other) {
super(other);
fEventType = other.fEventType;
+ if(other.fFields != null) {
+ for (Iterator<IFieldInfo> iterator = other.fFields.iterator(); iterator.hasNext();) {
+ IFieldInfo field = iterator.next();
+ if (field instanceof FieldInfo) {
+ fFields.add(new FieldInfo((FieldInfo)field));
+ } else {
+ fFields.add(field);
+ }
+ }
+ }
+ fFilterExpression = other.fFilterExpression;
}
// ------------------------------------------------------------------------
@@ -89,7 +113,7 @@ public class BaseEventInfo extends TraceInfo implements IBaseEventInfo {
} else if(TraceEventType.SYSCALL.getInName().equals(typeName)) {
fEventType = TraceEventType.SYSCALL;
} else if (TraceEventType.PROBE.getInName().equals(typeName)) {
- fEventType = TraceEventType.PROBE;
+ fEventType = TraceEventType.PROBE;
} else {
fEventType = TraceEventType.UNKNOWN;
}
@@ -155,23 +179,74 @@ public class BaseEventInfo extends TraceInfo implements IBaseEventInfo {
fLogLevel = TraceLogLevel.TRACE_DEBUG;
}
}
-
+
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#hashCode()
+ * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo#getFields()
+ */
+ @Override
+ public IFieldInfo[] getFields() {
+ return fFields.toArray(new IFieldInfo[fFields.size()]);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo#addField(org.eclipse.linuxtools.internal.lttng2.core.control.model.IFieldInfo)
+ */
+ @Override
+ public void addField(IFieldInfo field) {
+ fFields.add(field);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo#setFields(java.util.List)
+ */
+ @Override
+ public void setFields(List<IFieldInfo> fields) {
+ for (Iterator<IFieldInfo> iterator = fields.iterator(); iterator.hasNext();) {
+ IFieldInfo fieldInfo = iterator.next();
+ fFields.add(fieldInfo);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo#getFilterExpression()
+ */
+ @Override
+ public String getFilterExpression() {
+ return fFilterExpression;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo#setFilterExpression(java.lang.String)
+ */
+ @Override
+ public void setFilterExpression(String filter) {
+ fFilterExpression = filter;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.TraceInfo#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
- result = prime * result + ((fEventType == null) ? 0 : (fEventType.ordinal() + 1));
- result = prime * result + ((fLogLevel == null) ? 0 : (fLogLevel.ordinal() + 1));
+ result = prime * result + ((fEventType == null) ? 0 : fEventType.hashCode());
+ result = prime * result + ((fFields == null) ? 0 : fFields.hashCode());
+ result = prime * result + ((fFilterExpression == null) ? 0 : fFilterExpression.hashCode());
+ result = prime * result + ((fLogLevel == null) ? 0 : fLogLevel.hashCode());
return result;
- }
+ }
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#equals(java.lang.Object)
+ * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.TraceInfo#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
@@ -188,11 +263,25 @@ public class BaseEventInfo extends TraceInfo implements IBaseEventInfo {
if (fEventType != other.fEventType) {
return false;
}
+ if (fFields == null) {
+ if (other.fFields != null) {
+ return false;
+ }
+ } else if (!fFields.equals(other.fFields)) {
+ return false;
+ }
+ if (fFilterExpression == null) {
+ if (other.fFilterExpression != null) {
+ return false;
+ }
+ } else if (!fFilterExpression.equals(other.fFilterExpression)) {
+ return false;
+ }
if (fLogLevel != other.fLogLevel) {
return false;
}
return true;
- }
+ }
/*
* (non-Javadoc)
@@ -208,11 +297,18 @@ public class BaseEventInfo extends TraceInfo implements IBaseEventInfo {
output.append(fEventType);
output.append(",level=");
output.append(fLogLevel);
+ if ((fFields != null) && (!fFields.isEmpty())) {
+ output.append(",Fields=");
+ for (Iterator<IFieldInfo> iterator = fFields.iterator(); iterator.hasNext();) {
+ IFieldInfo field = iterator.next();
+ output.append(field.toString());
+ }
+ }
+ if (fFilterExpression != null) {
+ output.append(",Filter=");
+ output.append(fFilterExpression);
+ }
output.append(")]");
return output.toString();
}
-
-
-
-
} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/FieldInfo.java b/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/FieldInfo.java
new file mode 100644
index 0000000..c9b031c
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/FieldInfo.java
@@ -0,0 +1,129 @@
+/**********************************************************************
+ * Copyright (c) 2012 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.IFieldInfo;
+
+/**
+* <p>
+* Implementation of the basic trace event interface (IEventInfo) to store event
+* related data.
+* </p>
+*
+* @author Bernd Hufmann
+*/
+public class FieldInfo extends TraceInfo implements IFieldInfo {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+ /**
+ * The trace event type.
+ */
+ private String fFieldType;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+ /**
+ * Constructor
+ * @param name - name of base event
+ */
+ public FieldInfo(String name) {
+ super(name);
+ }
+
+ /**
+ * Copy constructor
+ * @param other - the instance to copy
+ */
+ public FieldInfo(FieldInfo other) {
+ super(other);
+ fFieldType = other.fFieldType;
+ }
+
+ // ------------------------------------------------------------------------
+ // Accessors
+ // ------------------------------------------------------------------------
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.IFieldInfo#getFieldType()
+ */
+ @Override
+ public String getFieldType() {
+ return fFieldType;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.IFieldInfo#setFieldType(java.lang.String)
+ */
+ @Override
+ public void setFieldType(String fieldType) {
+ fFieldType = fieldType;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.TraceInfo#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result
+ + ((fFieldType == null) ? 0 : fFieldType.hashCode());
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.TraceInfo#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ FieldInfo other = (FieldInfo) obj;
+ if (fFieldType == null) {
+ if (other.fFieldType != null) {
+ return false;
+ }
+ } else if (!fFieldType.equals(other.fFieldType)) {
+ return false;
+ }
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#toString()
+ */
+ @SuppressWarnings("nls")
+ @Override
+ public String toString() {
+ StringBuffer output = new StringBuffer();
+ output.append("[FieldInfo(");
+ output.append(super.toString());
+ output.append(",type=");
+ output.append(fFieldType);
+ return output.toString();
+ }
+} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java
index 3b9f876..4d2dc7a 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java
@@ -160,7 +160,7 @@ public class TraceControlPropertiesTest extends TestCase {
assertEquals("myNode", source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_NAME_PROPERTY_ID));
assertEquals("LOCALHOST", source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_ADDRESS_PROPERTY_ID));
assertEquals(TargetNodeState.CONNECTED.name(), source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_STATE_PROPERTY_ID));
- assertEquals("2.0.0", source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_VERSION_PROPERTY_ID));
+ assertEquals("2.1.0", source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_VERSION_PROPERTY_ID));
assertNull(source.getPropertyValue("test"));
adapter = node.getAdapter(IChannelInfo.class);
@@ -225,6 +225,16 @@ public class TraceControlPropertiesTest extends TestCase {
assertEquals(TraceEventType.TRACEPOINT.name(), baseSource.getPropertyValue(BaseEventPropertySource.BASE_EVENT_TYPE_PROPERTY_ID));
assertEquals(TraceLogLevel.TRACE_DEBUG_MODULE.name(), baseSource.getPropertyValue(BaseEventPropertySource.BASE_EVENT_LOGLEVEL_PROPERTY_ID));
+ baseEventInfo = (BaseEventComponent) events[1];
+ assertNotNull(baseEventInfo);
+
+ adapter = baseEventInfo.getAdapter(IPropertySource.class);
+ assertNotNull(adapter);
+ assertTrue(adapter instanceof BaseEventPropertySource);
+ baseSource = (BaseEventPropertySource)adapter;
+ assertNotNull(baseSource.getPropertyDescriptors());
+ assertEquals("doublefield=float;floatfield=float;stringfield=string", baseSource.getPropertyValue(BaseEventPropertySource.BASE_EVENT_FIELDS_PROPERTY_ID));
+
// ------------------------------------------------------------------------
// Verify Session Properties (adapter)
// ------------------------------------------------------------------------
@@ -349,6 +359,13 @@ public class TraceControlPropertiesTest extends TestCase {
assertEquals("init_post", probeEventSource.getPropertyValue(TraceProbeEventPropertySource.TRACE_EVENT_PROBE_SYMBOL_PROPERTY_ID));
//-------------------------------------------------------------------------
+ // Verify Filter of UST event
+ //-------------------------------------------------------------------------
+ event = (TraceEventComponent) domains[1].getChildren()[1].getChildren()[0];
+ adapter = event.getAdapter(IPropertySource.class);
+ assertEquals("with filter", event.getFilterExpression());
+
+ //-------------------------------------------------------------------------
// Delete node
//-------------------------------------------------------------------------
node.disconnect();
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java
index 4bce2d1..167dd7e 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java
@@ -28,6 +28,7 @@ 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.IDomainInfo;
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.IUstProviderInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType;
@@ -66,6 +67,7 @@ public class LTTngControlServiceTest extends TestCase {
private static final String SCEN_LIST_WITH_NO_KERNEL2 = "ListWithNoKernel2";
private static final String SCEN_GET_UST_PROVIDER1 = "GetUstProvider1";
private static final String SCEN_GET_UST_PROVIDER2 = "GetUstProvider2";
+ private static final String SCEN_GET_UST_PROVIDER3 = "GetUstProvider3";
private static final String SCEN_CREATE_SESSION1 = "CreateSession1";
private static final String SCEN_CREATE_SESSION_WITH_PROMPT = "CreateSessionWithPrompt";
private static final String SCEN_CREATE_SESSION_VARIANTS = "CreateSessionVariants";
@@ -473,6 +475,82 @@ public class LTTngControlServiceTest extends TestCase {
}
}
+ public void testGetUstProvider3() {
+ try {
+ fShell.setScenario(SCEN_GET_UST_PROVIDER3);
+ // Set version
+ ((LTTngControlService)fService).setVersion("2.1.0");
+ List<IUstProviderInfo> providers = fService.getUstProvider();
+
+ // Check all providers
+ assertNotNull(providers);
+ assertEquals(2, providers.size());
+
+ //Verify first provider
+ assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", providers.get(0).getName());
+ assertEquals(9379, providers.get(0).getPid());
+
+ // Verify event info
+ IBaseEventInfo[] events = providers.get(0).getEvents();
+ assertNotNull(events);
+ assertEquals(2, events.length);
+
+ IBaseEventInfo baseEventInfo = events[0];
+ assertNotNull(baseEventInfo);
+ IFieldInfo[] fields = baseEventInfo.getFields();
+ assertNotNull(fields);
+ assertEquals(0, fields.length);
+
+ baseEventInfo = events[1];
+ fields = baseEventInfo.getFields();
+ assertNotNull(fields);
+ assertEquals(3, fields.length);
+ assertEquals("doublefield", fields[0].getName());
+ assertEquals("float", fields[0].getFieldType());
+
+ assertEquals("floatfield", fields[1].getName());
+ assertEquals("float", fields[1].getFieldType());
+
+ assertEquals("stringfield", fields[2].getName());
+ assertEquals("string", fields[2].getFieldType());
+
+ //Verify second provider
+ assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", providers.get(1).getName());
+ assertEquals(4852, providers.get(1).getPid());
+
+ // Verify event info
+ events = providers.get(1).getEvents();
+ assertNotNull(events);
+ assertEquals(2, events.length);
+
+ baseEventInfo = events[0];
+ assertNotNull(baseEventInfo);
+ fields = baseEventInfo.getFields();
+ assertNotNull(fields);
+ assertEquals(0, fields.length);
+
+ baseEventInfo = events[1];
+ fields = baseEventInfo.getFields();
+ assertNotNull(fields);
+ assertEquals(3, fields.length);
+
+ assertEquals("doublefield", fields[0].getName());
+ assertEquals("float", fields[0].getFieldType());
+
+ assertEquals("floatfield", fields[1].getName());
+ assertEquals("float", fields[1].getFieldType());
+
+ assertEquals("stringfield", fields[2].getName());
+ assertEquals("string", fields[2].getFieldType());
+
+ // Reset version
+ ((LTTngControlService)fService).setVersion("2.0.0");
+
+ } catch (ExecutionException e) {
+ fail(e.toString());
+ }
+ }
+
public void testCreateSession() {
try {
fShell.setScenario(SCEN_CREATE_SESSION1);
@@ -673,21 +751,26 @@ public class LTTngControlServiceTest extends TestCase {
list.add(eventName1);
list.add(eventName2);
fShell.setScenario(SCEN_EVENT_HANDLING);
- fService.enableEvents(sessionName, null, list, true, new NullProgressMonitor());
+ fService.enableEvents(sessionName, null, list, true, null, new NullProgressMonitor());
// 2) session name, channel=mychannel, event name= null, kernel
String channelName = "mychannel";
- fService.enableEvents(sessionName, channelName, null, true, new NullProgressMonitor());
+ fService.enableEvents(sessionName, channelName, null, true, null, new NullProgressMonitor());
- // 3) session name, channel=mychannel, 1 event name, ust
+ // 3) session name, channel=mychannel, 1 event name, ust, no filter
String ustEventName = "ust_tests_hello:tptest_sighandler";
list.clear();
list.add(ustEventName);
- fService.enableEvents(sessionName, channelName, list, false, new NullProgressMonitor());
+ fService.enableEvents(sessionName, channelName, list, false, null, new NullProgressMonitor());
- // 4) session name, channel = mychannel, no event name, ust
+ // 4) session name, channel = mychannel, no event name, ust, with filter
+ fService.enableEvents(sessionName, channelName, list, false, "intfield==10", new NullProgressMonitor());
+
+ // 5) session name, channel = mychannel, no event name, ust, no filter
list.clear();
- fService.enableEvents(sessionName, channelName, list, false, new NullProgressMonitor());
+ fService.enableEvents(sessionName, channelName, list, false, null, new NullProgressMonitor());
+
+ // TODO add test with filters
} catch (ExecutionException e) {
fail(e.toString());
@@ -747,10 +830,12 @@ public class LTTngControlServiceTest extends TestCase {
fShell.setScenario(SCEN_EVENT_HANDLING);
// 1) session name, channel = null, event name, loglevel-only, TRACE_DEBUG
- fService.enableLogLevel(sessionName, null, eventName4, LogLevelType.LOGLEVEL_ONLY, TraceLogLevel.TRACE_DEBUG, new NullProgressMonitor());
+ fService.enableLogLevel(sessionName, null, eventName4, LogLevelType.LOGLEVEL_ONLY, TraceLogLevel.TRACE_DEBUG, null, new NullProgressMonitor());
// 2) session name, channel = mychannel, null, loglevel, TRACE_DEBUG_FUNCTION
- fService.enableLogLevel(sessionName, channelName, eventName5, LogLevelType.LOGLEVEL, TraceLogLevel.TRACE_DEBUG_FUNCTION, new NullProgressMonitor());
+ fService.enableLogLevel(sessionName, channelName, eventName5, LogLevelType.LOGLEVEL, TraceLogLevel.TRACE_DEBUG_FUNCTION, null, new NullProgressMonitor());
+
+ // TODO add test with filters
} catch (ExecutionException e) {
fail(e.toString());
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableEventsDialogStub.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableEventsDialogStub.java
index eadadfb..05e1e53 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableEventsDialogStub.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableEventsDialogStub.java
@@ -45,6 +45,7 @@ public class EnableEventsDialogStub implements IEnableEventsDialog {
private String fLogLevelEventName;
private TraceLogLevel fLogLevel;
private LogLevelType fLogLevelType;
+ private String fFilter;
List<String> fNames = new ArrayList<String>();
// ------------------------------------------------------------------------
@@ -118,6 +119,10 @@ public class EnableEventsDialogStub implements IEnableEventsDialog {
fNames = names;
}
+ public void setFilterExpression(String filter) {
+ fFilter = filter;
+ }
+
@Override
public boolean isTracepoints() {
return fIsTracePoints;
@@ -220,4 +225,10 @@ public class EnableEventsDialogStub implements IEnableEventsDialog {
public int open() {
return 0;
}
+
+ @Override
+ public String getFilterExpression() {
+ return fFilter;
+ }
+
} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/GetEventInfoDialogStub.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/GetEventInfoDialogStub.java
index ff4d8c0..1a65d75 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/GetEventInfoDialogStub.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/GetEventInfoDialogStub.java
@@ -1,12 +1,12 @@
/**********************************************************************
* Copyright (c) 2012 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:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.stubs.dialogs;
@@ -18,12 +18,13 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceC
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
/**
- * Get event information dialog stub implementation.
+ * Get event information dialog stub implementation.
*/
public class GetEventInfoDialogStub implements IGetEventInfoDialog {
private TraceSessionComponent[] fSessions;
-
+ private String fFilterExpression;
+
@Override
public TraceSessionComponent getSession() {
return fSessions[0];
@@ -48,8 +49,20 @@ public class GetEventInfoDialogStub implements IGetEventInfoDialog {
}
@Override
+ public String getFilterExpression() {
+ return fFilterExpression;
+ }
+
+ @Override
public int open() {
return 0;
}
+
+ /**
+ * @param filter the filter to set
+ */
+ public void setFilterExpression(String filter) {
+ fFilterExpression = filter;
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg
index 283aa48..dece427 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg
@@ -365,6 +365,39 @@ None
</SCENARIO>
####################################################################
+# Scenario: Test "lttng list -u -f" with sample output (version 2.1.0)
+####################################################################
+<SCENARIO>
+GetUstProvider3
+<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_DEBUG_MODULE (10)) (type: tracepoint)
+ ust_tests_hello:tptest (loglevel: TRACE_INFO (6)) (type: tracepoint)
+ field: doublefield (float)
+ field: floatfield (float)
+ field: stringfield (string)
+
+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)
+ field: doublefield (float)
+ field: floatfield (float)
+ field: stringfield (string)
+
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+
+####################################################################
# Scenario: Test "lttng create <session>
####################################################################
<SCENARIO>
@@ -588,6 +621,16 @@ UST event ust_tests_hello:tptest_sighandler created in channel mychannel
</COMMAND_OUTPUT>
<COMMAND_INPUT>
+lttng enable-event ust_tests_hello:tptest_sighandler -u -s mysession2 -c mychannel --tracepoint --filter 'intfield==10'
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST event ust_tests_hello:tptest_sighandler created in channel mychannel
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
lttng enable-event -a -u -s mysession2 -c mychannel --tracepoint
</COMMAND_INPUT>
<COMMAND_RESULT>
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/ListInfoTest.cfg b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/ListInfoTest.cfg
index 824f880..19cbd15 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/ListInfoTest.cfg
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/ListInfoTest.cfg
@@ -22,7 +22,7 @@ lttng version
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
-lttng version 2.0.0 - Annedd'ale
+lttng version 2.1.0 - Basse Messe
Web site: http://lttng.org/
lttng is free software and under the GPL license and part LGPL
@@ -117,7 +117,7 @@ Channels:
output: mmap()
Events:
- ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_LINE (13)) (type: tracepoint) [disabled]
+ ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_LINE (13)) (type: tracepoint) [disabled] [with filter]
* (type: tracepoint) [enabled]
</COMMAND_OUTPUT>
@@ -149,7 +149,7 @@ Kernel events
</COMMAND_OUTPUT>
<COMMAND_INPUT>
-lttng list -u
+lttng list -u -f
</COMMAND_INPUT>
<COMMAND_RESULT>
0
@@ -161,10 +161,16 @@ UST events:
PID: 9379 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_MODULE (10)) (type: tracepoint)
ust_tests_hello:tptest (loglevel: TRACE_INFO (6)) (type: tracepoint)
+ field: doublefield (float)
+ field: floatfield (float)
+ field: stringfield (string)
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)
+ field: doublefield (float)
+ field: floatfield (float)
+ field: stringfield (string)
</COMMAND_OUTPUT>
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableEventsDialog.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableEventsDialog.java
index 542b6e6..06e88be 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableEventsDialog.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableEventsDialog.java
@@ -338,6 +338,18 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog {
}
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableUstEvents#getFilterExpression()
+ */
+ @Override
+ public String getFilterExpression() {
+ if (!fIsKernel) {
+ return fUstComposite.getFilterExpression();
+ }
+ return null;
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableUstEventsComposite.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableUstEventsComposite.java
index 8b3ff86..cfd581a 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableUstEventsComposite.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableUstEventsComposite.java
@@ -99,6 +99,11 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve
*/
private Button fLogLevelOnlyButton;
/**
+ * The filter text
+ */
+ private Text fFilterText;
+
+ /**
* The referenced trace provider group containing the UST providers
* component which contains a list of available tracepoints.
*/
@@ -139,6 +144,10 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve
* The actual selected log level.
*/
private TraceLogLevel fLogLevel;
+ /**
+ * The filter expression
+ */
+ private String fFilterExpression;
// ------------------------------------------------------------------------
// Constructors
@@ -239,6 +248,15 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve
return fLogLevelEventName;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableUstEvents#getFilterExpression()
+ */
+ @Override
+ public String getFilterExpression() {
+ return fFilterExpression;
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
@@ -257,6 +275,9 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve
// Log Level Group
createLogLevelGroup();
+ // Filter Group
+ createFilterGroup();
+
// Set default enablements
setEnablements(GroupEnum.TRACEPOINTS);
}
@@ -324,7 +345,7 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve
fLogLevel = levels[id];
}
- // initialize wildcard with the event name string
+ // initialize wildcard with null
fWildcard = null;
if (fIsWildcard) {
String tempWildcard = fWildcardText.getText();
@@ -341,6 +362,16 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve
}
}
+ // initialize filter with null
+ fFilterExpression = null;
+ if (fProviderGroup.isEventFilteringSupported()) {
+ String tempFilter = fFilterText.getText();
+
+ if(!tempFilter.matches("\\s*")) { //$NON-NLS-1$
+ fFilterExpression = tempFilter;
+ }
+ }
+
// validation successful -> call super.okPressed()
return true;
}
@@ -519,6 +550,22 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve
fLogLevelButton.setLayoutData(data);
}
+ void createFilterGroup() {
+ if (fProviderGroup.isEventFilteringSupported()) {
+ Group filterMainGroup = new Group(this, SWT.SHADOW_NONE);
+ filterMainGroup.setText(Messages.TraceControl_EnableEventsFilterGroupName);
+ GridLayout layout = new GridLayout(3, false);
+ filterMainGroup.setLayout(layout);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ filterMainGroup.setLayoutData(data);
+
+ fFilterText = new Text(filterMainGroup, SWT.LEFT);
+ fFilterText.setToolTipText(Messages.TraceControl_EnableEventsFilterTooltip);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ fFilterText.setLayoutData(data);
+ }
+ }
+
/**
* Enable/selects widgets depending on the group specified.
* @param group - group to enable.
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/GetEventInfoDialog.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/GetEventInfoDialog.java
index 36568a5..62af212 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/GetEventInfoDialog.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/GetEventInfoDialog.java
@@ -32,6 +32,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
/**
* <p>
@@ -74,6 +75,10 @@ public class GetEventInfoDialog extends Dialog implements IGetEventInfoDialog {
*/
private CCombo fChannelsCombo = null;
/**
+ * The filter text
+ */
+ private Text fFilterText;
+ /**
* The list of available sessions.
*/
private TraceSessionComponent[] fSessions;
@@ -93,6 +98,10 @@ public class GetEventInfoDialog extends Dialog implements IGetEventInfoDialog {
* List of available channels of the selected session.
*/
private TraceChannelComponent[] fChannels;
+ /**
+ * The filter expression
+ */
+ private String fFilterExpression;
// ------------------------------------------------------------------------
// Constructors
@@ -144,6 +153,14 @@ public class GetEventInfoDialog extends Dialog implements IGetEventInfoDialog {
public void setSessions(TraceSessionComponent[] sessions) {
fSessions = Arrays.copyOf(sessions, sessions.length);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IGetEventInfoDialog#getFilterExpression()
+ */
+ @Override
+ public String getFilterExpression() {
+ return fFilterExpression;
+ }
// ------------------------------------------------------------------------
// Operations
@@ -241,6 +258,21 @@ public class GetEventInfoDialog extends Dialog implements IGetEventInfoDialog {
}
});
+ // take first session to test whether events filtering is supported or not
+ if (fSessions[0].isEventFilteringSupported() && !fIsKernel) {
+ Group filterMainGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
+ filterMainGroup.setText(Messages.TraceControl_EnableEventsFilterGroupName);
+ layout = new GridLayout(2, false);
+ filterMainGroup.setLayout(layout);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ filterMainGroup.setLayoutData(data);
+
+ fFilterText = new Text(filterMainGroup, SWT.LEFT);
+ fFilterText.setToolTipText(Messages.TraceControl_EnableEventsFilterTooltip);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ fFilterText.setLayoutData(data);
+ }
+
getShell().setMinimumSize(new Point(300, 200));
return fDialogComposite;
@@ -272,18 +304,22 @@ public class GetEventInfoDialog extends Dialog implements IGetEventInfoDialog {
fSessionIndex = fSessionsCombo.getSelectionIndex();
- if ((fChannels != null) && (fChannels.length > 0) && (fChannelsCombo.getSelectionIndex() < 0)) {
- MessageDialog.openError(getShell(),
- Messages.TraceControl_EnableEventsDialogTitle,
- Messages.TraceControl_EnableEventsNoChannelError);
- return;
- }
- // Initialize fChannel to null
+ // if no channel is available or no channel is selected use default channel indicated by fChannel=null
fChannel = null;
- if ((fChannels != null) && (fChannels.length > 0)) {
+ if ((fChannels != null) && (fChannelsCombo.getSelectionIndex() >= 0)) {
fChannel = fChannels[fChannelsCombo.getSelectionIndex()];
}
+ // initialize filter with null
+ fFilterExpression = null;
+ if (fSessions[0].isEventFilteringSupported() && !fIsKernel) {
+ String tempFilter = fFilterText.getText();
+
+ if(!tempFilter.matches("\\s*")) { //$NON-NLS-1$
+ fFilterExpression = tempFilter;
+ }
+ }
+
super.okPressed();
}
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableUstEvents.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableUstEvents.java
index 035a097..c7907a6 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableUstEvents.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableUstEvents.java
@@ -1,12 +1,12 @@
/**********************************************************************
* Copyright (c) 2012 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:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs;
@@ -20,7 +20,7 @@ import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel;
* <p>
* Interface for providing information about UST events to be enabled.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public interface IEnableUstEvents {
@@ -28,12 +28,12 @@ public interface IEnableUstEvents {
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
-
+
/**
* @return a flag whether the tracepoints shall be configured.
*/
public boolean isTracepoints();
-
+
/**
* @return a flag indicating whether all tracepoints shall be enabled or not.
*/
@@ -50,12 +50,12 @@ public interface IEnableUstEvents {
public boolean isWildcard();
/**
- * @return a wildcard
+ * @return a wildcard
*/
public String getWildcard();
/**
- * @return a flag whether events using log levels should be enabled
+ * @return a flag whether events using log levels should be enabled
*/
public boolean isLogLevel();
@@ -63,7 +63,7 @@ public interface IEnableUstEvents {
* @return a log level type (loglevel or loglevel-only)
*/
public LogLevelType getLogLevelType();
-
+
/**
* @return a log level
*/
@@ -73,5 +73,10 @@ public interface IEnableUstEvents {
* @return a event name for the log level enable action
*/
public String getLogLevelEventName();
-
+
+ /**
+ * @return a filter expression
+ */
+ public String getFilterExpression();
+
} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IGetEventInfoDialog.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IGetEventInfoDialog.java
index 4a2b52c..9eb823c 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IGetEventInfoDialog.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IGetEventInfoDialog.java
@@ -1,12 +1,12 @@
/**********************************************************************
* Copyright (c) 2012 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:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs;
@@ -18,11 +18,11 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceS
* <p>
* Interface for a dialog box for collecting information about the events to enable.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public interface IGetEventInfoDialog {
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
@@ -35,19 +35,25 @@ public interface IGetEventInfoDialog {
* @return the channel the events shall be enabled. Null for default channel.
*/
public TraceChannelComponent getChannel();
-
+
/**
* Sets flag about domain.
* @param isKernel - true for kernel, false for UST
*/
public void setIsKernel(boolean isKernel);
-
+
/**
* Sets available session.
* @param sessions - a array of available sessions.
*/
public void setSessions(TraceSessionComponent[] sessions);
+ /**
+ * Returns the filter expression.
+ * @return the filter expression or null for no filtering
+ */
+ public String getFilterExpression();
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AssignEventHandler.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AssignEventHandler.java
index 8aae526..b889d43 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AssignEventHandler.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AssignEventHandler.java
@@ -100,9 +100,9 @@ public class AssignEventHandler extends BaseControlViewHandler {
TraceChannelComponent channel = dialog.getChannel();
if (channel == null) {
// enable events on default channel (which will be created by lttng-tools)
- dialog.getSession().enableEvents(eventNames, param.isKernel(), monitor);
+ dialog.getSession().enableEvents(eventNames, param.isKernel(), dialog.getFilterExpression(), monitor);
} else {
- channel.enableEvents(eventNames, monitor);
+ channel.enableEvents(eventNames, dialog.getFilterExpression(), monitor);
}
} catch (ExecutionException e) {
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableEventHandler.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableEventHandler.java
index 7b95a44..fb9d806 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableEventHandler.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableEventHandler.java
@@ -63,12 +63,14 @@ abstract public class BaseEnableEventHandler extends BaseControlViewHandler {
* - list of event names
* @param isKernel
* - true if kernel domain else false
+ * @param filterExpression
+ * - a filter expression
* @param monitor
* - a progress monitor
* @throws ExecutionException
* If the command fails for some reason
*/
- abstract public void enableEvents(CommandParameter param, List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException;
+ abstract public void enableEvents(CommandParameter param, List<String> eventNames, boolean isKernel, String filterExpression, IProgressMonitor monitor) throws ExecutionException;
/**
* Enables all syscall events.
@@ -111,12 +113,14 @@ abstract public class BaseEnableEventHandler extends BaseControlViewHandler {
* - a log level type
* @param level
* - a log level
+ * @param filterExpression
+ * - a filter expression
* @param monitor
* - a progress monitor
* @throws ExecutionException
* If the command fails for some reason
*/
- abstract public void enableLogLevel(CommandParameter param, String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException;
+ abstract public void enableLogLevel(CommandParameter param, String eventName, LogLevelType logLevelType, TraceLogLevel level, String filterExpression, IProgressMonitor monitor) throws ExecutionException;
/**
* @param param
@@ -159,14 +163,16 @@ abstract public class BaseEnableEventHandler extends BaseControlViewHandler {
Exception error = null;
try {
+ String filter = dialog.getFilterExpression();
+
// Enable tracepoint events
if (dialog.isTracepoints()) {
if (dialog.isAllTracePoints()) {
- enableEvents(param, null, dialog.isKernel(), monitor);
+ enableEvents(param, null, dialog.isKernel(), filter, monitor);
} else {
List<String> eventNames = dialog.getEventNames();
if (!eventNames.isEmpty()) {
- enableEvents(param, eventNames, dialog.isKernel(), monitor);
+ enableEvents(param, eventNames, dialog.isKernel(), filter, monitor);
}
}
}
@@ -192,13 +198,13 @@ abstract public class BaseEnableEventHandler extends BaseControlViewHandler {
eventNames.add(dialog.getWildcard());
if (!eventNames.isEmpty()) {
- enableEvents(param, eventNames, dialog.isKernel(), monitor);
+ enableEvents(param, eventNames, dialog.isKernel(), filter, monitor);
}
}
// Enable events using log level
if (dialog.isLogLevel()) {
- enableLogLevel(param, dialog.getLogLevelEventName(), dialog.getLogLevelType(), dialog.getLogLevel(), monitor);
+ enableLogLevel(param, dialog.getLogLevelEventName(), dialog.getLogLevelType(), dialog.getLogLevel(), filter, monitor);
}
} catch (ExecutionException e) {
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnChannelHandler.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnChannelHandler.java
index 2997f76..f83283b 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnChannelHandler.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnChannelHandler.java
@@ -44,12 +44,12 @@ public class EnableEventOnChannelHandler extends BaseEnableEventHandler {
// ------------------------------------------------------------------------
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseEnableEventHandler#enableEvents(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter, java.util.List, boolean, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseEnableEventHandler#enableEvents(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter, java.util.List, boolean, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void enableEvents(CommandParameter param, List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+ public void enableEvents(CommandParameter param, List<String> eventNames, boolean isKernel, String filterExression, IProgressMonitor monitor) throws ExecutionException {
if (param instanceof ChannelCommandParameter) {
- ((ChannelCommandParameter)param).getChannel().enableEvents(eventNames, monitor);
+ ((ChannelCommandParameter)param).getChannel().enableEvents(eventNames, filterExression, monitor);
}
}
@@ -77,12 +77,12 @@ public class EnableEventOnChannelHandler extends BaseEnableEventHandler {
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseEnableEventHandler#enableLogLevel(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter, java.lang.String, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.LogLevelType, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceLogLevel, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseEnableEventHandler#enableLogLevel(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter, java.lang.String, org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType, org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void enableLogLevel(CommandParameter param, String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException {
+ public void enableLogLevel(CommandParameter param, String eventName, LogLevelType logLevelType, TraceLogLevel level, String filterExression, IProgressMonitor monitor) throws ExecutionException {
if (param instanceof ChannelCommandParameter) {
- ((ChannelCommandParameter)param).getChannel().enableLogLevel(eventName, logLevelType, level, monitor);
+ ((ChannelCommandParameter)param).getChannel().enableLogLevel(eventName, logLevelType, level, filterExression, monitor);
}
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnDomainHandler.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnDomainHandler.java
index bbb47f9..0944c3c 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnDomainHandler.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnDomainHandler.java
@@ -45,10 +45,10 @@ public class EnableEventOnDomainHandler extends BaseEnableEventHandler {
// ------------------------------------------------------------------------
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseEnableEventHandler#enableEvents(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter, java.util.List, boolean, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseEnableEventHandler#enableEvents(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter, java.util.List, boolean, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void enableEvents(CommandParameter param, List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+ public void enableEvents(CommandParameter param, List<String> eventNames, boolean isKernel, String filterExression, IProgressMonitor monitor) throws ExecutionException {
if (param instanceof DomainCommandParameter) {
((DomainCommandParameter)param).getDomain().enableEvents(eventNames, monitor);
}
@@ -78,12 +78,12 @@ public class EnableEventOnDomainHandler extends BaseEnableEventHandler {
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseEnableEventHandler#enableLogLevel(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter, java.lang.String, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.LogLevelType, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceLogLevel, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseEnableEventHandler#enableLogLevel(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter, java.lang.String, org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType, org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void enableLogLevel(CommandParameter param, String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException {
+ public void enableLogLevel(CommandParameter param, String eventName, LogLevelType logLevelType, TraceLogLevel level, String filterExression, IProgressMonitor monitor) throws ExecutionException {
if (param instanceof DomainCommandParameter) {
- ((DomainCommandParameter)param).getDomain().enableLogLevel(eventName, logLevelType, level, monitor);
+ ((DomainCommandParameter)param).getDomain().enableLogLevel(eventName, logLevelType, level, filterExression, monitor);
}
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnSessionHandler.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnSessionHandler.java
index 2c82714..6cbbfd0 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnSessionHandler.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnSessionHandler.java
@@ -45,11 +45,11 @@ public class EnableEventOnSessionHandler extends BaseEnableEventHandler {
// ------------------------------------------------------------------------
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseEnableEventHandler#enableEvents(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter, java.util.List, boolean, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseEnableEventHandler#enableEvents(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter, java.util.List, boolean, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void enableEvents(CommandParameter param, List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
- param.getSession().enableEvents(eventNames, isKernel, monitor);
+ public void enableEvents(CommandParameter param, List<String> eventNames, boolean isKernel, String filterExpression, IProgressMonitor monitor) throws ExecutionException {
+ param.getSession().enableEvents(eventNames, isKernel, filterExpression, monitor);
}
/*
@@ -72,14 +72,13 @@ public class EnableEventOnSessionHandler extends BaseEnableEventHandler {
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseEnableEventHandler#enableLogLevel(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter, java.lang.String, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.LogLevelType, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceLogLevel, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseEnableEventHandler#enableLogLevel(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter, java.lang.String, org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType, org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void enableLogLevel(CommandParameter param, String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException {
- param.getSession().enableLogLevel(eventName, logLevelType, level, monitor);
+ public void enableLogLevel(CommandParameter param, String eventName, LogLevelType logLevelType, TraceLogLevel level, String filterExpression, IProgressMonitor monitor) throws ExecutionException {
+ param.getSession().enableLogLevel(eventName, logLevelType, level, filterExpression, monitor);
}
-
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseEnableEventHandler#getDomain(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter)
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java
index de3c042..20b285a 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java
@@ -154,6 +154,8 @@ final public class Messages extends NLS {
public static String TraceControl_EnableEventsLogLevelOnlyTypeTooltip;
public static String TraceControl_EnableEventsLogLevelTooltip;
public static String TraceControl_EnableEventsLoglevelEventNameTooltip;
+ public static String TraceControl_EnableEventsFilterGroupName;
+ public static String TraceControl_EnableEventsFilterTooltip;
public static String TraceControl_InvalidProbeNameError;
public static String TraceControl_InvalidWildcardError;
@@ -200,6 +202,8 @@ final public class Messages extends NLS {
public static String TraceControl_EventNamePropertyName;
public static String TraceControl_EventTypePropertyName;
public static String TraceControl_LogLevelPropertyName;
+ public static String TraceControl_FieldsPropertyName;
+ public static String TraceControl_FilterPropertyName;
public static String TraceControl_StatePropertyName;
public static String TraceControl_VersionPropertyName;
public static String TraceControl_DomainNamePropertyName;
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties
index f0d1e50..55573d4 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties
@@ -137,6 +137,8 @@ TraceControl_EnableEventsLogLevelOnlyTypeName=loglevel-only
TraceControl_EnableEventsLogLevelOnlyTypeTooltip=The tracepoint log level (only this loglevel)
TraceControl_EnableEventsLogLevelTooltip=The available log levels
TraceControl_EnableEventsLoglevelEventNameTooltip=Event name for enabling log levels
+TraceControl_EnableEventsFilterGroupName=Filter Expression
+TraceControl_EnableEventsFilterTooltip=Filter expression on event field.
TraceControl_InvalidProbeNameError=The probe name is invalid
TraceControl_InvalidWildcardError=The wild card name is invalid
@@ -183,6 +185,8 @@ TraceControl_SessionNamePropertyName=Session Name
TraceControl_EventNamePropertyName=Event Name
TraceControl_EventTypePropertyName=Event Type
TraceControl_LogLevelPropertyName=Log Level
+TraceControl_FieldsPropertyName=Fields
+TraceControl_FilterPropertyName=Filter
TraceControl_StatePropertyName=State
TraceControl_VersionPropertyName=Version
TraceControl_DomainNamePropertyName=Domain Name
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/BaseEventComponent.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/BaseEventComponent.java
index a3a34f9..fc382f7 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/BaseEventComponent.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/BaseEventComponent.java
@@ -12,6 +12,7 @@
package org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.IFieldInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEventType;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.EventInfo;
@@ -115,6 +116,26 @@ public class BaseEventComponent extends TraceControlComponent {
fEventInfo.setLogLevel(levelName);
}
+ /**
+ * @return a String containing pairs if field name and data type
+ */
+ public String getFieldString() {
+ IFieldInfo[] fields = fEventInfo.getFields();
+ if ((fields != null) && (fields.length > 0)) {
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < fields.length; i++) {
+ buffer.append(fields[i].getName());
+ buffer.append("="); //$NON-NLS-1$
+ buffer.append(fields[i].getFieldType());
+ if (i != fields.length-1) {
+ buffer.append(";"); //$NON-NLS-1$
+ }
+ }
+ return buffer.toString();
+ }
+ return null;
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
index 94a6678..8a46ce1 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
@@ -217,6 +217,14 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
return ""; //$NON-NLS-1$
}
+ /**
+ * Returns if node supports filtering of events
+ * @return <code>true</code> if node supports filtering else <code>false</code>
+ */
+ public boolean isEventFilteringSupported() {
+ return getControlService().isVersionSupported("2.1.0"); //$NON-NLS-1$
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceChannelComponent.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceChannelComponent.java
index 39ae17e..ce08553 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceChannelComponent.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceChannelComponent.java
@@ -286,7 +286,23 @@ public class TraceChannelComponent extends TraceControlComponent {
* If the command fails
*/
public void enableEvents(List<String> eventNames, IProgressMonitor monitor) throws ExecutionException {
- getControlService().enableEvents(getSessionName(), getName(), eventNames, isKernel(), monitor);
+ enableEvents(eventNames, null, monitor);
+ }
+
+ /**
+ * Enables a list of events with no additional parameters.
+ *
+ * @param eventNames
+ * - a list of event names to enabled.
+ * @param filterExpression
+ * - a filter expression
+ * @param monitor
+ * - a progress monitor
+ * @throws ExecutionException
+ * If the command fails
+ */
+ public void enableEvents(List<String> eventNames, String filterExpression, IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableEvents(getSessionName(), getName(), eventNames, isKernel(), filterExpression, monitor);
}
/**
@@ -356,12 +372,14 @@ public class TraceChannelComponent extends TraceControlComponent {
* - a log level type
* @param level
* - a log level
+ * @param filterExpression
+ * - a filter expression
* @throws ExecutionException
* If the command fails
*/
public void enableLogLevel(String eventName, LogLevelType logLevelType,
- TraceLogLevel level) throws ExecutionException {
- enableLogLevel(eventName, logLevelType, level, new NullProgressMonitor());
+ TraceLogLevel level, String filterExpression) throws ExecutionException {
+ enableLogLevel(eventName, logLevelType, level, filterExpression, new NullProgressMonitor());
}
/**
@@ -373,15 +391,17 @@ public class TraceChannelComponent extends TraceControlComponent {
* - a log level type
* @param level
* - a log level
+ * @param filterExpression
+ * - a filter expression
* @param monitor
* - a progress monitor
* @throws ExecutionException
* If the command fails
*/
public void enableLogLevel(String eventName, LogLevelType logLevelType,
- TraceLogLevel level, IProgressMonitor monitor)
+ TraceLogLevel level, String filterExpression, IProgressMonitor monitor)
throws ExecutionException {
- getControlService().enableLogLevel(getSessionName(), getName(), eventName, logLevelType, level, monitor);
+ getControlService().enableLogLevel(getSessionName(), getName(), eventName, logLevelType, level, filterExpression, monitor);
}
/**
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceDomainComponent.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceDomainComponent.java
index 7c01dd7..d088bd3 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceDomainComponent.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceDomainComponent.java
@@ -245,7 +245,7 @@ public class TraceDomainComponent extends TraceControlComponent {
public void enableEvents(List<String> eventNames, IProgressMonitor monitor)
throws ExecutionException {
getControlService().enableEvents(getSessionName(), null, eventNames,
- isKernel(), monitor);
+ isKernel(), null, monitor);
}
/**
@@ -318,12 +318,14 @@ public class TraceDomainComponent extends TraceControlComponent {
* - a log level type
* @param level
* - a log level
+ * @param filterExpression
+ * - a filter expression
* @throws ExecutionException
* If the command fails
*/
public void enableLogLevel(String eventName, LogLevelType logLevelType,
- TraceLogLevel level) throws ExecutionException {
- enableLogLevel(eventName, logLevelType, level,
+ TraceLogLevel level, String filterExpression) throws ExecutionException {
+ enableLogLevel(eventName, logLevelType, level, filterExpression,
new NullProgressMonitor());
}
@@ -336,16 +338,18 @@ public class TraceDomainComponent extends TraceControlComponent {
* - a log level type
* @param level
* - a log level
+ * @param filterExpression
+ * - a filter expression
* @param monitor
* - a progress monitor
* @throws ExecutionException
* If the command fails
*/
public void enableLogLevel(String eventName, LogLevelType logLevelType,
- TraceLogLevel level, IProgressMonitor monitor)
+ TraceLogLevel level, String filterExpression, IProgressMonitor monitor)
throws ExecutionException {
getControlService().enableLogLevel(getSessionName(), null, eventName,
- logLevelType, level, monitor);
+ logLevelType, level, filterExpression, monitor);
}
/**
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceEventComponent.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceEventComponent.java
index 14d3930..ff40447 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceEventComponent.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceEventComponent.java
@@ -169,6 +169,22 @@ public class TraceEventComponent extends TraceControlComponent {
fEventInfo.setLogLevel(levelName);
}
+ /**
+ * Returns filter expression.
+ * @return filter expression
+ */
+ public String getFilterExpression() {
+ return fEventInfo.getFilterExpression();
+ }
+
+ /**
+ * Sets the filter expression.
+ * @param filter The filter expression to set
+ */
+ public void setFilterExpression(String filter) {
+ fEventInfo.setFilterExpression(filter);
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceProviderGroup.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceProviderGroup.java
index 448dfa5..96e7f53 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceProviderGroup.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceProviderGroup.java
@@ -104,5 +104,13 @@ public class TraceProviderGroup extends TraceControlComponent {
List<ITraceControlComponent> kernelList = getChildren(KernelProviderComponent.class);
return !kernelList.isEmpty();
}
+
+ /**
+ * Returns if node supports filtering of events
+ * @return <code>true</code> if node supports filtering else <code>false</code>
+ */
+ public boolean isEventFilteringSupported() {
+ return ((TargetNodeComponent)getParent()).isEventFilteringSupported();
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java
index b02bc54..7fec67c 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java
@@ -201,6 +201,14 @@ public class TraceSessionComponent extends TraceControlComponent {
return (!providerGroups.isEmpty() ? ((TraceProviderGroup) providerGroups.get(0)).hasKernelProvider() : false);
}
+ /**
+ * Returns if node supports filtering of events
+ * @return <code>true</code> if node supports filtering else <code>false</code>
+ */
+ public boolean isEventFilteringSupported() {
+ return ((TargetNodeComponent)getParent().getParent()).isEventFilteringSupported();
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
@@ -332,12 +340,14 @@ public class TraceSessionComponent extends TraceControlComponent {
* - a list of event names to enabled.
* @param isKernel
* - a flag for indicating kernel or UST.
+ * @param filterExpression
+ * - a filter expression
* @throws ExecutionException
* If the command fails
*/
- public void enableEvent(List<String> eventNames, boolean isKernel)
+ public void enableEvent(List<String> eventNames, boolean isKernel, String filterExpression)
throws ExecutionException {
- enableEvents(eventNames, isKernel, new NullProgressMonitor());
+ enableEvents(eventNames, isKernel, filterExpression, new NullProgressMonitor());
}
/**
@@ -347,15 +357,17 @@ public class TraceSessionComponent extends TraceControlComponent {
* - a list of event names to enabled.
* @param isKernel
* - a flag for indicating kernel or UST.
+ * @param filterExpression
+ * - a filter expression
* @param monitor
* - a progress monitor
* @throws ExecutionException
* If the command fails
*/
public void enableEvents(List<String> eventNames, boolean isKernel,
- IProgressMonitor monitor) throws ExecutionException {
+ String filterExpression, IProgressMonitor monitor) throws ExecutionException {
getControlService().enableEvents(getName(), null, eventNames, isKernel,
- monitor);
+ filterExpression, monitor);
}
/**
@@ -427,12 +439,14 @@ public class TraceSessionComponent extends TraceControlComponent {
* - a log level type
* @param level
* - a log level
+ * @param filterExpression
+ * - a filter expression
* @throws ExecutionException
* If the command fails
*/
public void enableLogLevel(String eventName, LogLevelType logLevelType,
- TraceLogLevel level) throws ExecutionException {
- enableLogLevel(eventName, logLevelType, level,
+ TraceLogLevel level, String filterExpression) throws ExecutionException {
+ enableLogLevel(eventName, logLevelType, level, filterExpression,
new NullProgressMonitor());
}
@@ -445,16 +459,18 @@ public class TraceSessionComponent extends TraceControlComponent {
* - a log level type
* @param level
* - a log level
+ * @param filterExpression
+ * - a filter expression
* @param monitor
* - a progress monitor
* @throws ExecutionException
* If the command fails
*/
public void enableLogLevel(String eventName, LogLevelType logLevelType,
- TraceLogLevel level, IProgressMonitor monitor)
+ TraceLogLevel level, String filterExpression, IProgressMonitor monitor)
throws ExecutionException {
getControlService().enableLogLevel(getName(), null, eventName,
- logLevelType, level, monitor);
+ logLevelType, level, null, monitor);
}
/**
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/BaseEventPropertySource.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/BaseEventPropertySource.java
index 77b8123..733e500 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/BaseEventPropertySource.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/BaseEventPropertySource.java
@@ -46,6 +46,10 @@ public class BaseEventPropertySource extends BasePropertySource {
*/
public static final String BASE_EVENT_LOGLEVEL_PROPERTY_ID = "base.event.loglevel"; //$NON-NLS-1$
/**
+ * The base event 'fields' property ID.
+ */
+ public static final String BASE_EVENT_FIELDS_PROPERTY_ID = "base.event.fields"; //$NON-NLS-1$
+ /**
* The base event 'name' property name.
*/
public static final String BASE_EVENT_NAME_PROPERTY_NAME = Messages.TraceControl_EventNamePropertyName;
@@ -57,6 +61,10 @@ public class BaseEventPropertySource extends BasePropertySource {
* The base event 'log level' property name.
*/
public static final String BASE_EVENT_LOGLEVEL_PROPERTY_NAME = Messages.TraceControl_LogLevelPropertyName;
+ /**
+ * The base event 'fields' property name.
+ */
+ public static final String BASE_EVENT_FIELDS_PROPERTY_NAME = Messages.TraceControl_FieldsPropertyName;
// ------------------------------------------------------------------------
// Attributes
@@ -92,6 +100,9 @@ public class BaseEventPropertySource extends BasePropertySource {
if (fBaseEvent.getLogLevel() != TraceLogLevel.LEVEL_UNKNOWN) {
list.add(new TextPropertyDescriptor(BASE_EVENT_LOGLEVEL_PROPERTY_ID, BASE_EVENT_LOGLEVEL_PROPERTY_NAME));
}
+ if (fBaseEvent.getFieldString() != null) {
+ list.add(new TextPropertyDescriptor(BASE_EVENT_FIELDS_PROPERTY_ID, BASE_EVENT_FIELDS_PROPERTY_NAME));
+ }
return list.toArray(new IPropertyDescriptor[list.size()]);
}
@@ -110,6 +121,9 @@ public class BaseEventPropertySource extends BasePropertySource {
if (BASE_EVENT_LOGLEVEL_PROPERTY_ID.equals(id)) {
return fBaseEvent.getLogLevel().name();
}
+ if (BASE_EVENT_FIELDS_PROPERTY_ID.equals(id)) {
+ return fBaseEvent.getFieldString();
+ }
return null;
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceEventPropertySource.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceEventPropertySource.java
index 124890e..f38d09a 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceEventPropertySource.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceEventPropertySource.java
@@ -49,6 +49,11 @@ public class TraceEventPropertySource extends BasePropertySource {
*/
public static final String TRACE_EVENT_STATE_PROPERTY_ID = "trace.event.state"; //$NON-NLS-1$
/**
+ * The trace event 'filter' property ID.
+ */
+ public static final String TRACE_EVENT_FILTER_PROPERTY_ID = "trace.event.filter"; //$NON-NLS-1$
+
+ /**
* The trace event 'name' property name.
*/
public static final String TRACE_EVENT_NAME_PROPERTY_NAME = Messages.TraceControl_EventNamePropertyName;
@@ -64,6 +69,10 @@ public class TraceEventPropertySource extends BasePropertySource {
* The trace event 'state' property name.
*/
public static final String TRACE_EVENT_STATE_PROPERTY_NAME = Messages.TraceControl_StatePropertyName;
+ /**
+ * The trace event 'filter' property name.
+ */
+ public static final String TRACE_EVENT_FILTER_PROPERTY_NAME = Messages.TraceControl_FilterPropertyName;
// ------------------------------------------------------------------------
// Attributes
@@ -100,6 +109,9 @@ public class TraceEventPropertySource extends BasePropertySource {
if (fEvent.getLogLevel() != TraceLogLevel.LEVEL_UNKNOWN) {
list.add(new TextPropertyDescriptor(TRACE_EVENT_LOGLEVEL_PROPERTY_ID, TRACE_EVENT_LOGLEVEL_PROPERTY_NAME));
}
+ if (fEvent.getFilterExpression() != null) {
+ list.add(new TextPropertyDescriptor(TRACE_EVENT_FILTER_PROPERTY_ID, TRACE_EVENT_FILTER_PROPERTY_NAME));
+ }
return list.toArray(new IPropertyDescriptor[list.size()]);
}
@@ -121,6 +133,10 @@ public class TraceEventPropertySource extends BasePropertySource {
if (TRACE_EVENT_STATE_PROPERTY_ID.equals(id)) {
return fEvent.getState().name();
}
+ if (TRACE_EVENT_FILTER_PROPERTY_ID.equals(id)) {
+ return fEvent.getFilterExpression();
+ }
+
return null;
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java
index 753150d..4499a09 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java
@@ -38,6 +38,14 @@ public interface ILttngControlService {
public String getVersion();
/**
+ * Checks if given version is supported by this ILTTngControlService implementation.
+ *
+ * @param version The version to check
+ * @return <code>true</code> if version is supported else <code>false</code>
+ */
+ public boolean isVersionSupported(String version);
+
+ /**
* Retrieves the existing sessions names from the node.
*
* @param monitor
@@ -206,15 +214,19 @@ public interface ILttngControlService {
* 0)for all events .
* @param isKernel
* - a flag for indicating kernel or UST.
+ * @param filterExpression
+ * - a filter expression
* @param monitor
* - a progress monitor
* @throws ExecutionException
* If the command fails
*/
public void enableEvents(String sessionName, String channelName,
- List<String> eventNames, boolean isKernel, IProgressMonitor monitor)
+ List<String> eventNames, boolean isKernel, String filterExpression,
+ IProgressMonitor monitor)
throws ExecutionException;
+
/**
* Enables all syscall events.
*
@@ -265,6 +277,8 @@ public interface ILttngControlService {
* - a log level type
* @param level
* - a log level
+ * @param filterExpression
+ * - a filter expression
* @param monitor
* - a progress monitor
* @throws ExecutionException
@@ -272,6 +286,7 @@ public interface ILttngControlService {
*/
public void enableLogLevel(String sessionName, String channelName,
String eventName, LogLevelType logLevelType, TraceLogLevel level,
+ String filterExpression,
IProgressMonitor monitor) throws ExecutionException;
/**
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java
index a533cbb..af5aa74 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java
@@ -23,6 +23,7 @@ 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.IDomainInfo;
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.IProbeEventInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IUstProviderInfo;
@@ -33,6 +34,7 @@ import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.BaseEventI
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.ChannelInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.DomainInfo;
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.EventInfo;
+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.UstProviderInfo;
@@ -41,6 +43,7 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.preferences.ControlPreferences;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandResult;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandShell;
+import org.osgi.framework.Version;
/**
* <p>
@@ -51,7 +54,6 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandSh
*/
public class LTTngControlService implements ILttngControlService {
-
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
@@ -63,7 +65,7 @@ public class LTTngControlService implements ILttngControlService {
/**
* The version string.
*/
- protected String fVersion = "Unknown"; //$NON-NLS-1$
+ protected Version fVersion = null;
// ------------------------------------------------------------------------
// Constructors
@@ -88,7 +90,10 @@ public class LTTngControlService implements ILttngControlService {
*/
@Override
public String getVersion() {
- return fVersion;
+ if (fVersion == null) {
+ return "Unknown"; //$NON-NLS-1$
+ }
+ return fVersion.toString();
}
/**
@@ -96,8 +101,19 @@ public class LTTngControlService implements ILttngControlService {
* @param version - a version to set
*/
public void setVersion(String version) {
- fVersion = version;
+ fVersion = new Version(version);
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#isVersionSupported(java.lang.String)
+ */
+ @Override
+ public boolean isVersionSupported(String version) {
+ Version tmp = new Version(version);
+ return (fVersion != null && fVersion.compareTo(tmp) >= 0) ? true : false;
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
@@ -117,10 +133,8 @@ public class LTTngControlService implements ILttngControlService {
// Output:
// Available tracing sessions:
- // 1) mysession1 (/home/user/lttng-traces/mysession1-20120123-083928)
- // [inactive]
- // 2) mysession (/home/user/lttng-traces/mysession-20120123-083318)
- // [inactive]
+ // 1) mysession1 (/home/user/lttng-traces/mysession1-20120123-083928) [inactive]
+ // 2) mysession (/home/user/lttng-traces/mysession-20120123-083318) [inactive]
//
// Use lttng list <session_name> for more details
@@ -278,8 +292,14 @@ public class LTTngControlService implements ILttngControlService {
public List<IUstProviderInfo> getUstProvider(IProgressMonitor monitor) throws ExecutionException {
StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_LIST_UST);
+ if (isVersionSupported("2.1.0")) { //$NON-NLS-1$
+ command.append(LTTngControlServiceConstants.OPTION_FIELDS);
+ }
+
ICommandResult result = executeCommand(command.toString(), monitor);
+ // Note that field print-outs exists for version >= 2.1.0
+ //
// UST events:
// -------------
//
@@ -288,12 +308,18 @@ public class LTTngControlService implements ILttngControlService {
// ust_tests_hello:tptest_sighandler (loglevel: TRACE_EMERG0) (type:
// tracepoint)
// ust_tests_hello:tptest (loglevel: TRACE_EMERG0) (type: tracepoint)
+ // field: doublefield (float)
+ // field: floatfield (float)
+ // field: stringfield (string)
//
// PID: 6459 - Name:
// /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
// ust_tests_hello:tptest_sighandler (loglevel: TRACE_EMERG0) (type:
// tracepoint)
// ust_tests_hello:tptest (loglevel: TRACE_EMERG0) (type: tracepoint)
+ // field: doublefield (float)
+ // field: floatfield (float)
+ // field: stringfield (string)
List<IUstProviderInfo> allProviders = new ArrayList<IUstProviderInfo>();
IUstProviderInfo provider = null;
@@ -303,14 +329,12 @@ public class LTTngControlService implements ILttngControlService {
String line = result.getOutput()[index];
Matcher matcher = LTTngControlServiceConstants.UST_PROVIDER_PATTERN.matcher(line);
if (matcher.matches()) {
-
provider = new UstProviderInfo(matcher.group(2).trim());
provider.setPid(Integer.valueOf(matcher.group(1).trim()));
List<IBaseEventInfo> events = new ArrayList<IBaseEventInfo>();
index = getProviderEventInfo(result.getOutput(), ++index, events);
provider.setEvents(events);
allProviders.add(provider);
-
} else {
index++;
}
@@ -531,10 +555,10 @@ public class LTTngControlService implements ILttngControlService {
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#enableEvent(java.lang.String, java.lang.String, java.util.List, boolean, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#enableEvents(java.lang.String, java.lang.String, java.util.List, boolean, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void enableEvents(String sessionName, String channelName, List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+ public void enableEvents(String sessionName, String channelName, List<String> eventNames, boolean isKernel, String filterExpression, IProgressMonitor monitor) throws ExecutionException {
StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_ENABLE_EVENT);
@@ -571,6 +595,13 @@ public class LTTngControlService implements ILttngControlService {
command.append(LTTngControlServiceConstants.OPTION_TRACEPOINT);
+ if (filterExpression != null) {
+ command.append(LTTngControlServiceConstants.OPTION_FILTER);
+ command.append('\'');
+ command.append(filterExpression);
+ command.append('\'');
+ }
+
executeCommand(command.toString(), monitor);
}
@@ -634,10 +665,10 @@ public class LTTngControlService implements ILttngControlService {
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#enableLogLevel(java.lang.String, java.lang.String, java.lang.String, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.LogLevelType, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceLogLevel, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#enableLogLevel(java.lang.String, java.lang.String, java.lang.String, org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType, org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void enableLogLevel(String sessionName, String channelName, String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException {
+ public void enableLogLevel(String sessionName, String channelName, String eventName, LogLevelType logLevelType, TraceLogLevel level, String filterExpression, IProgressMonitor monitor) throws ExecutionException {
StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_ENABLE_EVENT);
command.append(eventName);
@@ -663,9 +694,10 @@ public class LTTngControlService implements ILttngControlService {
command.append(level.getInName());
executeCommand(command.toString(), monitor);
-
}
+
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#disableEvent(java.lang.String, java.lang.String, java.util.List, boolean, org.eclipse.core.runtime.IProgressMonitor)
@@ -984,6 +1016,11 @@ public class LTTngControlService implements ILttngControlService {
eventInfo.setLogLevel(matcher.group(2).trim());
eventInfo.setEventType(matcher.group(3).trim());
eventInfo.setState(matcher.group(4));
+ String filter = matcher.group(5);
+ if (filter != null) {
+ filter = filter.substring(1, filter.length() - 1); // remove '[' and ']'
+ eventInfo.setFilterExpression(filter);
+ }
events.add(eventInfo);
index++;
} else if (matcher2.matches()) {
@@ -991,6 +1028,11 @@ public class LTTngControlService implements ILttngControlService {
eventInfo.setLogLevel(TraceLogLevel.LEVEL_UNKNOWN);
eventInfo.setEventType(matcher2.group(2).trim());
eventInfo.setState(matcher2.group(3));
+ String filter = matcher2.group(4);
+ if (filter != null) {
+ filter = filter.substring(1, filter.length() - 1); // remove '[' and ']'
+ eventInfo.setFilterExpression(filter);
+ }
if (eventInfo.getEventType() == TraceEventType.PROBE) {
IProbeEventInfo probeEvent = new ProbeEventInfo(eventInfo.getName());
@@ -1078,16 +1120,49 @@ public class LTTngControlService implements ILttngControlService {
*/
protected int getProviderEventInfo(String[] output, int currentIndex, List<IBaseEventInfo> events) {
int index = currentIndex;
+ IBaseEventInfo eventInfo = null;
while (index < output.length) {
String line = output[index];
Matcher matcher = LTTngControlServiceConstants.PROVIDER_EVENT_PATTERN.matcher(line);
if (matcher.matches()) {
- // sched_kthread_stop (loglevel: TRACE_EMERG0) (type:
- // tracepoint)
- IBaseEventInfo eventInfo = new BaseEventInfo(matcher.group(1).trim());
+ // sched_kthread_stop (loglevel: TRACE_EMERG0) (type: tracepoint)
+ eventInfo = new BaseEventInfo(matcher.group(1).trim());
eventInfo.setLogLevel(matcher.group(2).trim());
eventInfo.setEventType(matcher.group(3).trim());
events.add(eventInfo);
+ index++;
+ } else if (LTTngControlServiceConstants.EVENT_FIELD_PATTERN.matcher(line).matches()) {
+ if (eventInfo != null) {
+ List<IFieldInfo> fields = new ArrayList<IFieldInfo>();
+ index = getFieldInfo(output, index, fields);
+ eventInfo.setFields(fields);
+ } else {
+ index++;
+ }
+ }
+ else if (LTTngControlServiceConstants.UST_PROVIDER_PATTERN.matcher(line).matches()) {
+ return index;
+ } else {
+ index++;
+ }
+ }
+ return index;
+ }
+
+
+ protected int getFieldInfo(String[] output, int currentIndex, List<IFieldInfo> fields) {
+ int index = currentIndex;
+ IFieldInfo fieldInfo = null;
+ while (index < output.length) {
+ String line = output[index];
+ Matcher matcher = LTTngControlServiceConstants.EVENT_FIELD_PATTERN.matcher(line);
+ if (matcher.matches()) {
+ // field: content (string)
+ fieldInfo = new FieldInfo(matcher.group(2).trim());
+ fieldInfo.setFieldType(matcher.group(3).trim());
+ fields.add(fieldInfo);
+ } else if (LTTngControlServiceConstants.PROVIDER_EVENT_PATTERN.matcher(line).matches()) {
+ return index;
} else if (LTTngControlServiceConstants.UST_PROVIDER_PATTERN.matcher(line).matches()) {
return index;
}
@@ -1096,6 +1171,8 @@ public class LTTngControlService implements ILttngControlService {
return index;
}
+
+
/**
* Formats a command parameter for the command execution i.e. adds quotes
* at the beginning and end if necessary.
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java
index d73ca76..81b01b7 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java
@@ -193,6 +193,15 @@ public class LTTngControlServiceConstants {
* Command line option for printing the help of a specif command
*/
public final static String OPTION_HELP = " -h "; //$NON-NLS-1$
+ /**
+ * Command line option for listing the fields of UST tracepoints
+ */
+ public final static String OPTION_FIELDS = " -f "; //$NON-NLS-1$
+ /**
+ * Command line option for configuring event's filter
+ */
+ public final static String OPTION_FILTER = " --filter "; //$NON-NLS-1$
+
// ------------------------------------------------------------------------
// Parsing constants
@@ -244,11 +253,11 @@ public class LTTngControlServiceConstants {
/**
* Pattern to match for event information (lttng list <session>)
*/
- public final static Pattern EVENT_PATTERN = Pattern.compile("\\s+(.*)\\s+\\(loglevel:\\s+(.*)\\s+\\(\\d*\\)\\)\\s+\\(type:\\s+(.*)\\)\\s+\\[(enabled|disabled)\\].*"); //$NON-NLS-1$
+ public final static Pattern EVENT_PATTERN = Pattern.compile("\\s+(.*)\\s+\\(loglevel:\\s+(.*)\\s+\\(\\d*\\)\\)\\s+\\(type:\\s+(.*)\\)\\s+\\[(enabled|disabled)\\]\\s*(\\[.*\\]){0,1}.*"); //$NON-NLS-1$
/**
* Pattern to match a wildcarded event information (lttng list <session>)
*/
- public final static Pattern WILDCARD_EVENT_PATTERN = Pattern.compile("\\s+(.*)\\s+\\(type:\\s+(.*)\\)\\s+\\[(enabled|disabled)\\].*"); //$NON-NLS-1$
+ public final static Pattern WILDCARD_EVENT_PATTERN = Pattern.compile("\\s+(.*)\\s+\\(type:\\s+(.*)\\)\\s+\\[(enabled|disabled)\\]\\s*(\\[.*\\]){0,1}.*"); //$NON-NLS-1$
/**
* Pattern to match a probe address information (lttng list <session>)
*/
@@ -294,6 +303,11 @@ public class LTTngControlServiceConstants {
*/
public final static Pattern PROVIDER_EVENT_PATTERN = Pattern.compile("\\s*(.*)\\s+\\(loglevel:\\s+(.*)\\s+\\(\\d*\\)\\)\\s+\\(type:\\s+(.*)\\)"); //$NON-NLS-1$
/**
+ * Pattern to match event fields
+ */
+ // field: content (string)
+ public final static Pattern EVENT_FIELD_PATTERN = Pattern.compile("\\s*(field:)\\s+(.*)\\s+\\((.*)\\)"); //$NON-NLS-1$
+ /**
* Pattern to match for UST provider information (lttng list -u)
*/
public final static Pattern UST_PROVIDER_PATTERN = Pattern.compile("\\s*PID\\:\\s+(\\d+)\\s+-\\s+Name\\:\\s+(.*)"); //$NON-NLS-1$