LTTng: Show the buffer type in the domain property view
authorSimon Delisle <simon.delisle@ericsson.com>
Tue, 30 Jul 2013 20:02:46 +0000 (16:02 -0400)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Wed, 31 Jul 2013 19:53:02 +0000 (15:53 -0400)
Change-Id: I518cdb438c2e2fc6a853fe0e012c3776e41e4459
Signed-off-by: Simon Delisle <simon.delisle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/15017
Tested-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
IP-Clean: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
12 files changed:
org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki
org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/IDomainInfo.java
org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/BufferTypeConstants.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/DomainInfo.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java
org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceDomainComponent.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceDomainPropertySource.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java

index 0c390e5d1667699d9e5152e21e894b8fa5a079f9..c33626ca060459e323ccfe7507d3db3446500717 100644 (file)
@@ -1293,6 +1293,7 @@ The Control View provides property information of selected tree component. Depen
 ** '''State''': The state of the session ('''ACTIVE''' or '''INACTIVE''')
 * '''Domain''' Properties
 ** '''Domain Name''': The name of the domain.
+** '''Buffer Type''': The buffer type of the domain.
 * '''Channel''' Properties
 ** '''Channel Name''': The name of the channel.
 ** '''Number of Sub Buffers''': The number of sub-buffers of the channel.
index edb9de0aaf6869f7ba81217a8ebdf5843b41598f..f44c61f502b678e6324bf7d7ceac8773185d7f9a 100644 (file)
@@ -50,5 +50,18 @@ public interface IDomainInfo extends ITraceInfo {
      */
     void setIsKernel(boolean isKernel);
 
+    /**
+     * @return Information about the buffer type
+     */
+    String getBufferType();
+
+    /**
+     * Sets the buffer type
+     *
+     * @param bufferType
+     *            The buffer type
+     */
+    void setBufferType(String bufferType);
+
 
 }
diff --git a/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/BufferTypeConstants.java b/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/BufferTypeConstants.java
new file mode 100644 (file)
index 0000000..e80d30f
--- /dev/null
@@ -0,0 +1,41 @@
+/**********************************************************************
+ * Copyright (c) 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Simon Delisle - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng2.core.control.model.impl;
+
+/**
+ * Constants for buffer type.
+ *
+ * @author Simon Delisle
+ */
+public interface BufferTypeConstants {
+    // ------------------------------------------------------------------------
+    // Buffer type
+    // ------------------------------------------------------------------------
+    /**
+     * Buffer type : per UID
+     */
+    static final String BUFFER_PER_UID = "per UID"; //$NON-NLS-1$
+    /**
+     * Buffer type : per PID
+     */
+    static final String BUFFER_PER_PID = "per PID"; //$NON-NLS-1$
+    /**
+     * Buffer type : shared
+     */
+    static final String BUFFER_SHARED = "shared"; //$NON-NLS-1$
+    /**
+     * If the LTTng version doesn't show the buffer type
+     */
+    static final String BUFFER_TYPE_UNKNOWN = "information not unavailable"; //$NON-NLS-1$
+
+}
index 8a39349d26df83fddb4f4ff9ae2a87b24a648b66..27dc84af7bfc4aa2dce81befa8a9926c4ce69dff 100644 (file)
@@ -36,6 +36,7 @@ public class DomainInfo extends TraceInfo implements IDomainInfo {
      */
     private final List<IChannelInfo> fChannels = new ArrayList<IChannelInfo>();
     private boolean fIsKernel = false;
+    private String fBufferType = null;
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -127,6 +128,19 @@ public class DomainInfo extends TraceInfo implements IDomainInfo {
         return true;
     }
 
+    @Override
+    public String getBufferType() {
+        if (fIsKernel) {
+            return BufferTypeConstants.BUFFER_SHARED;
+        }
+        return fBufferType;
+    }
+
+    @Override
+    public void setBufferType(String bufferType) {
+        fBufferType = bufferType;
+    }
+
     @SuppressWarnings("nls")
     @Override
     public String toString() {
@@ -147,5 +161,4 @@ public class DomainInfo extends TraceInfo implements IDomainInfo {
             output.append(")]");
             return output.toString();
     }
-
 }
index d867e272600f7a5e864831314723db2b57db3bef..1205f2a38f12b32cea671638a65436b49b3c35cf 100644 (file)
@@ -26,6 +26,7 @@ import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEnablement
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEventType;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceSessionState;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.BufferTypeConstants;
 import org.eclipse.linuxtools.internal.lttng2.stubs.service.TestRemoteSystemProxy;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.BaseEventComponent;
@@ -237,6 +238,7 @@ public class TraceControlPropertiesTest {
         assertNotNull(domainSource.getPropertyDescriptors());
 
         assertEquals("Kernel", domainSource.getPropertyValue(TraceDomainPropertySource.TRACE_DOMAIN_NAME_PROPERTY_ID));
+        assertEquals(BufferTypeConstants.BUFFER_SHARED, domainSource.getPropertyValue(TraceDomainPropertySource.BUFFER_TYPE_PROPERTY_ID));
 
         ITraceControlComponent[] channels =  domains[0].getChildren();
         assertNotNull(channels);
index 46f528b3cd4d8c51a46f1178d254fa216cf84820..6b0d49c9b3ffdc63f2f708f42fe221b3974c8704 100644 (file)
@@ -27,7 +27,6 @@ public class EnableChannelDialogStub implements IEnableChannelDialog {
     // Attributes
     // ------------------------------------------------------------------------
     private TraceDomainComponent fDomain;
-    private TargetNodeComponent fTargetNodeComponent;
     private ChannelInfo fChannelInfo;
     private boolean fIsKernel;
 
@@ -84,6 +83,6 @@ public class EnableChannelDialogStub implements IEnableChannelDialog {
 
     @Override
     public void setTargetNodeComponent(TargetNodeComponent node) {
-        fTargetNodeComponent = node;
+        // Do nothing
     }
 }
\ No newline at end of file
index 760802d9cfb216496b43da43d55bbf87eaf3edc1..1d6ef941e7e8e68090d9f2fbf2949576e4921dee 100644 (file)
@@ -241,6 +241,7 @@ final public class Messages extends NLS {
     public static String TraceControl_StatePropertyName;
     public static String TraceControl_VersionPropertyName;
     public static String TraceControl_DomainNamePropertyName;
+    public static String TraceControl_BufferTypePropertyName;
     public static String TraceControl_ChannelNamePropertyName;
     public static String TraceControl_OverwriteModePropertyName;
     public static String TraceControl_SubBufferSizePropertyName;
index 121a090a86e4efbc6f6d7c39e3760c9dcffc9ed8..bc5b60ee7d2282cdd4f82fa1b8f631939d270dd3 100644 (file)
@@ -228,6 +228,7 @@ TraceControl_FilterPropertyName=Filter
 TraceControl_StatePropertyName=State
 TraceControl_VersionPropertyName=Version
 TraceControl_DomainNamePropertyName=Domain Name
+TraceControl_BufferTypePropertyName=Buffer type
 TraceControl_ChannelNamePropertyName=Channel Name
 TraceControl_OverwriteModePropertyName=Overwrite Mode
 TraceControl_SubBufferSizePropertyName=Sub Buffer Size
index 6db060992fe850defb3fab490782449944cd2f24..24be09caa25f8a825c94bced1ade91906ba93502 100644 (file)
@@ -134,6 +134,13 @@ public class TraceDomainComponent extends TraceControlComponent {
         return ((TraceSessionComponent)getParent()).getTargetNode();
     }
 
+    /**
+     * @return the buffer type
+     */
+    public String getBufferType(){
+        return fDomainInfo.getBufferType();
+    }
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
index b0ad41e2406aa31d7389991e25fe288be683ff3f..b8b1fa574a8c6e54ccbe8ee36767436263ca1035 100644 (file)
@@ -11,6 +11,7 @@
  **********************************************************************/
 package org.eclipse.linuxtools.internal.lttng2.ui.views.control.property;
 
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.BufferTypeConstants;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
 import org.eclipse.linuxtools.tmf.ui.properties.ReadOnlyTextPropertyDescriptor;
@@ -37,6 +38,14 @@ public class TraceDomainPropertySource extends BasePropertySource {
      *  The trace domain 'name' property name.
      */
     public static final String TRACE_DOMAIN_NAME_PROPERTY_NAME = Messages.TraceControl_DomainNamePropertyName;
+    /**
+     * The domain 'buffer type' property ID.
+     */
+    public static final String BUFFER_TYPE_PROPERTY_ID = "trace.domain.bufferType"; //$NON-NLS-1$
+    /**
+     * The domain 'buffer type' property name.
+     */
+    public static final String BUFER_TYPE_PROPERTY_NAME = Messages.TraceControl_BufferTypePropertyName;
 
     // ------------------------------------------------------------------------
     // Attributes
@@ -45,7 +54,7 @@ public class TraceDomainPropertySource extends BasePropertySource {
     /**
      * The trace domain component which this property source is for.
      */
-    private final TraceDomainComponent fBaseEvent;
+    private final TraceDomainComponent fDomain;
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -56,7 +65,7 @@ public class TraceDomainPropertySource extends BasePropertySource {
      * @param component - the trace domain component
      */
     public TraceDomainPropertySource(TraceDomainComponent component) {
-        fBaseEvent = component;
+        fDomain = component;
     }
 
     // ------------------------------------------------------------------------
@@ -65,14 +74,24 @@ public class TraceDomainPropertySource extends BasePropertySource {
 
     @Override
     public IPropertyDescriptor[] getPropertyDescriptors() {
+        if (fDomain.getBufferType().equals(BufferTypeConstants.BUFFER_TYPE_UNKNOWN)) {
+            return new IPropertyDescriptor[] {
+                    new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME) };
+        }
+
         return new IPropertyDescriptor[] {
-                new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME)};
+                new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME),
+                new ReadOnlyTextPropertyDescriptor(BUFFER_TYPE_PROPERTY_ID, BUFER_TYPE_PROPERTY_NAME) };
     }
 
     @Override
     public Object getPropertyValue(Object id) {
+        if(BUFFER_TYPE_PROPERTY_ID.equals(id)){
+            return fDomain.getBufferType();
+        }
+
         if(TRACE_DOMAIN_NAME_PROPERTY_ID.equals(id)) {
-            return fBaseEvent.getName();
+            return fDomain.getName();
         }
         return null;
     }
index 4517baa5bc54c3b372857ad77a195fbab33446bd..5158e96df412512f0956f2683a400632e16c5aab 100644 (file)
@@ -33,6 +33,7 @@ import org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEventType;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.BaseEventInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.BufferTypeConstants;
 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;
@@ -192,7 +193,7 @@ public class LTTngControlService implements ILttngControlService {
 
                 // in domain kernel
                 ArrayList<IChannelInfo> channels = new ArrayList<IChannelInfo>();
-                index = parseDomain(result.getOutput(), index, channels);
+                index = parseDomain(result.getOutput(), index, channels, domainInfo);
 
                 if (channels.size() > 0) {
                     // add domain
@@ -213,7 +214,7 @@ public class LTTngControlService implements ILttngControlService {
 
                 // in domain UST
                 ArrayList<IChannelInfo> channels = new ArrayList<IChannelInfo>();
-                index = parseDomain(result.getOutput(), index, channels);
+                index = parseDomain(result.getOutput(), index, channels, domainInfo);
 
                 if (channels.size() > 0) {
                     // add domain
@@ -967,9 +968,11 @@ public class LTTngControlService implements ILttngControlService {
      *            - current index in command output array
      * @param channels
      *            - list for returning channel information
+     * @param domainInfo
+     *            - The domain information
      * @return the new current index in command output array
      */
-    protected int parseDomain(String[] output, int currentIndex, List<IChannelInfo> channels) {
+    protected int parseDomain(String[] output, int currentIndex, List<IChannelInfo> channels, IDomainInfo domainInfo) {
         int index = currentIndex;
 
         // Channels:
@@ -987,6 +990,14 @@ public class LTTngControlService implements ILttngControlService {
         while (index < output.length) {
             String line = output[index];
 
+            if (isVersionSupported("2.2.0")) { //$NON-NLS-1$
+                Matcher bufferTypeMatcher = LTTngControlServiceConstants.BUFFER_TYPE_PATTERN.matcher(line);
+                if (bufferTypeMatcher.matches()) {
+                    domainInfo.setBufferType(getAttributeValue(line));
+                }
+            } else {
+                domainInfo.setBufferType(BufferTypeConstants.BUFFER_TYPE_UNKNOWN);
+            }
             Matcher outerMatcher = LTTngControlServiceConstants.CHANNELS_SECTION_PATTERN.matcher(line);
             Matcher noKernelChannelMatcher = LTTngControlServiceConstants.DOMAIN_NO_KERNEL_CHANNEL_PATTERN.matcher(line);
             Matcher noUstChannelMatcher = LTTngControlServiceConstants.DOMAIN_NO_UST_CHANNEL_PATTERN.matcher(line);
index 0e549e580b1ab3ca9b4f601bdc30b4ab391a8020..ab170766d7eaade69c9da827b39426fa441cc435 100644 (file)
@@ -284,6 +284,10 @@ public interface LTTngControlServiceConstants {
      * Pattern to match for matching warning about no UST channel
      */
     static final Pattern DOMAIN_NO_UST_CHANNEL_PATTERN = Pattern.compile("\\s*Error\\:\\s+UST\\s+channel\\s+not\\s+found.*"); //$NON-NLS-1$
+    /**
+     * Pattern to match for buffer type (lttng list <session>)
+     */
+    static final Pattern BUFFER_TYPE_PATTERN = Pattern.compile("\\s*Buffer\\s+type\\:.*"); //$NON-NLS-1$
     /**
      * Pattern to match for channels section (lttng list <session>)
      */
This page took 0.0343020000000001 seconds and 5 git commands to generate.