From ca8c54b3e91a1562a8bbc34e92a516f34ba532ab Mon Sep 17 00:00:00 2001 From: Simon Delisle Date: Tue, 30 Jul 2013 16:02:46 -0400 Subject: [PATCH] LTTng: Show the buffer type in the domain property view Change-Id: I518cdb438c2e2fc6a853fe0e012c3776e41e4459 Signed-off-by: Simon Delisle Reviewed-on: https://git.eclipse.org/r/15017 Tested-by: Hudson CI Reviewed-by: Bernd Hufmann IP-Clean: Bernd Hufmann Tested-by: Bernd Hufmann --- .../doc/User-Guide.mediawiki | 1 + .../core/control/model/IDomainInfo.java | 13 ++++++ .../model/impl/BufferTypeConstants.java | 41 +++++++++++++++++++ .../core/control/model/impl/DomainInfo.java | 15 ++++++- .../component/TraceControlPropertiesTest.java | 2 + .../dialogs/EnableChannelDialogStub.java | 3 +- .../ui/views/control/messages/Messages.java | 1 + .../control/messages/messages.properties | 1 + .../model/impl/TraceDomainComponent.java | 7 ++++ .../property/TraceDomainPropertySource.java | 27 ++++++++++-- .../control/service/LTTngControlService.java | 17 ++++++-- .../service/LTTngControlServiceConstants.java | 4 ++ 12 files changed, 122 insertions(+), 10 deletions(-) create mode 100644 org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/BufferTypeConstants.java diff --git a/org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki b/org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki index 0c390e5d16..c33626ca06 100644 --- a/org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki +++ b/org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki @@ -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. diff --git a/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/IDomainInfo.java b/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/IDomainInfo.java index edb9de0aaf..f44c61f502 100644 --- a/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/IDomainInfo.java +++ b/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/IDomainInfo.java @@ -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 index 0000000000..e80d30fd98 --- /dev/null +++ b/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/BufferTypeConstants.java @@ -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$ + +} diff --git a/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/DomainInfo.java b/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/DomainInfo.java index 8a39349d26..27dc84af7b 100644 --- a/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/DomainInfo.java +++ b/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/DomainInfo.java @@ -36,6 +36,7 @@ public class DomainInfo extends TraceInfo implements IDomainInfo { */ private final List fChannels = new ArrayList(); 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(); } - } diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java index d867e27260..1205f2a38f 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java @@ -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); diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java index 46f528b3cd..6b0d49c9b3 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java @@ -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 diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java index 760802d9cf..1d6ef941e7 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java @@ -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; diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties index 121a090a86..bc5b60ee7d 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties @@ -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 diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceDomainComponent.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceDomainComponent.java index 6db060992f..24be09caa2 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceDomainComponent.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceDomainComponent.java @@ -134,6 +134,13 @@ public class TraceDomainComponent extends TraceControlComponent { return ((TraceSessionComponent)getParent()).getTargetNode(); } + /** + * @return the buffer type + */ + public String getBufferType(){ + return fDomainInfo.getBufferType(); + } + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceDomainPropertySource.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceDomainPropertySource.java index b0ad41e240..b8b1fa574a 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceDomainPropertySource.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceDomainPropertySource.java @@ -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; } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java index 4517baa5bc..5158e96df4 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java @@ -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 channels = new ArrayList(); - 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 channels = new ArrayList(); - 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 channels) { + protected int parseDomain(String[] output, int currentIndex, List 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); diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java index 0e549e580b..ab170766d7 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java @@ -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 ) + */ + static final Pattern BUFFER_TYPE_PATTERN = Pattern.compile("\\s*Buffer\\s+type\\:.*"); //$NON-NLS-1$ /** * Pattern to match for channels section (lttng list ) */ -- 2.34.1