import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceDomainType;
import org.eclipse.tracecompass.internal.lttng2.control.core.model.IBaseEventInfo;
import org.eclipse.tracecompass.internal.lttng2.control.core.model.IChannelInfo;
import org.eclipse.tracecompass.internal.lttng2.control.core.model.IDomainInfo;
// Create Domain
IDomainInfo domainInfo = new DomainInfo(Messages.TraceControl_KernelDomainDisplayName);
- // set kernel flag
- domainInfo.setIsKernel(true);
+ // set kernel domain
+ domainInfo.setDomain(TraceDomainType.KERNEL);
// in domain kernel
ArrayList<IChannelInfo> channels = new ArrayList<>();
if (matcher.matches()) {
IDomainInfo domainInfo = new DomainInfo(Messages.TraceControl_UstGlobalDomainDisplayName);
- // set kernel flag
- domainInfo.setIsKernel(false);
+ // set kernel domain
+ domainInfo.setDomain(TraceDomainType.UST);
// in domain UST
ArrayList<IChannelInfo> channels = new ArrayList<>();
}
@Override
- public void enableChannels(String sessionName, List<String> channelNames, boolean isKernel, IChannelInfo info, IProgressMonitor monitor) throws ExecutionException {
+ public void enableChannels(String sessionName, List<String> channelNames, TraceDomainType domain, IChannelInfo info, IProgressMonitor monitor) throws ExecutionException {
// no channels to enable
if (channelNames.isEmpty()) {
command.add(toCsv(channelNames));
- if (isKernel) {
+ switch (domain) {
+ case KERNEL:
command.add(LTTngControlServiceConstants.OPTION_KERNEL);
- } else {
+ break;
+ case UST:
command.add(LTTngControlServiceConstants.OPTION_UST);
+ break;
+ case JUL:
+ case LOG4J:
+ case PYTHON:
+ case UNKNOWN:
+ default:
+ break;
}
command.add(LTTngControlServiceConstants.OPTION_SESSION);
if (isVersionSupported("2.2.0")) { //$NON-NLS-1$
// --buffers-uid Every application sharing the same UID use the
// same buffers --buffers-pid Buffers are allocated per PID
- if (!isKernel) {
+ if (domain.equals(TraceDomainType.UST)) {
if (info.getBufferType() == BufferType.BUFFER_PER_PID) {
command.add(LTTngControlServiceConstants.OPTION_PER_PID_BUFFERS);
}
@Override
- public void disableChannels(String sessionName, List<String> channelNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+ public void disableChannels(String sessionName, List<String> channelNames, TraceDomainType domain, IProgressMonitor monitor) throws ExecutionException {
// no channels to enable
if (channelNames.isEmpty()) {
command.add(toCsv(channelNames));
- if (isKernel) {
+ switch (domain) {
+ case KERNEL:
command.add(LTTngControlServiceConstants.OPTION_KERNEL);
- } else {
+ break;
+ case UST:
command.add(LTTngControlServiceConstants.OPTION_UST);
+ break;
+ case JUL:
+ case LOG4J:
+ case PYTHON:
+ case UNKNOWN:
+ default:
+ break;
+
}
command.add(LTTngControlServiceConstants.OPTION_SESSION);
}
@Override
- public void enableEvents(String sessionName, String channelName, List<String> eventNames, boolean isKernel, String filterExpression, List<String> excludedEvents, IProgressMonitor monitor) throws ExecutionException {
+ public void enableEvents(String sessionName, String channelName, List<String> eventNames, TraceDomainType domain, String filterExpression, List<String> excludedEvents, IProgressMonitor monitor) throws ExecutionException {
ICommandInput command = createCommand(LTTngControlServiceConstants.COMMAND_ENABLE_EVENT);
boolean isAllEvents = ALL_EVENTS.equals(eventNames);
command.add(toCsv(eventNames));
}
- if (isKernel) {
+ switch (domain) {
+ case KERNEL:
command.add(LTTngControlServiceConstants.OPTION_KERNEL);
- } else {
+ break;
+ case UST:
command.add(LTTngControlServiceConstants.OPTION_UST);
+ break;
+ case JUL:
+ case LOG4J:
+ case PYTHON:
+ case UNKNOWN:
+ default:
+ break;
}
command.add(LTTngControlServiceConstants.OPTION_SESSION);
}
@Override
- public void disableEvent(String sessionName, String channelName, List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+ public void disableEvent(String sessionName, String channelName, List<String> eventNames, TraceDomainType domain, IProgressMonitor monitor) throws ExecutionException {
ICommandInput command = createCommand(LTTngControlServiceConstants.COMMAND_DISABLE_EVENT);
if (eventNames == null) {
command.add(eventNameParameter.toString());
}
- if (isKernel) {
+ switch (domain) {
+ case KERNEL:
command.add(LTTngControlServiceConstants.OPTION_KERNEL);
- } else {
+ break;
+ case UST:
command.add(LTTngControlServiceConstants.OPTION_UST);
+ break;
+ case JUL:
+ case LOG4J:
+ case PYTHON:
+ case UNKNOWN:
+ default:
+ break;
}
command.add(LTTngControlServiceConstants.OPTION_SESSION);
}
@Override
- public void addContexts(String sessionName, String channelName, String eventName, boolean isKernel, List<String> contextNames, IProgressMonitor monitor) throws ExecutionException {
+ public void addContexts(String sessionName, String channelName, String eventName, TraceDomainType domain, List<String> contextNames, IProgressMonitor monitor) throws ExecutionException {
ICommandInput command = createCommand(LTTngControlServiceConstants.COMMAND_ADD_CONTEXT);
command.add(LTTngControlServiceConstants.OPTION_SESSION);
command.add(eventName);
}
- if (isKernel) {
+ switch (domain) {
+ case KERNEL:
command.add(LTTngControlServiceConstants.OPTION_KERNEL);
- } else {
+ break;
+ case UST:
command.add(LTTngControlServiceConstants.OPTION_UST);
+ break;
+ case JUL:
+ case LOG4J:
+ case PYTHON:
+ case UNKNOWN:
+ default:
+ break;
}
for (Iterator<String> iterator = contextNames.iterator(); iterator.hasNext();) {
int index = currentIndex;
// if kernel set the buffer type to shared
- if (domainInfo.isKernel()) {
+ if (domainInfo.getDomain().equals(TraceDomainType.KERNEL)) {
domainInfo.setBufferType(BufferType.BUFFER_SHARED);
}