TraceDebug.setDEBUG(false);
}
}
+
// suite.addTestSuite(StateBeforeUpdateFactory.class);
// suite.addTestSuite(StateBeforeUpdateHandlers.class);
suite.addTestSuite(LTTngStateResourceTest.class);
-
+
// $JUnit-END$
return suite;
}
import org.eclipse.linuxtools.lttng.core.control.LttngCoreProviderFactory;
import org.eclipse.linuxtools.lttng.core.event.LttngEvent;
import org.eclipse.linuxtools.lttng.core.event.LttngSyntheticEvent;
-import org.eclipse.linuxtools.lttng.core.event.LttngTimestamp;
import org.eclipse.linuxtools.lttng.core.event.LttngSyntheticEvent.SequenceInd;
+import org.eclipse.linuxtools.lttng.core.event.LttngTimestamp;
import org.eclipse.linuxtools.lttng.core.state.experiment.IStateExperimentManager;
import org.eclipse.linuxtools.lttng.core.state.experiment.StateManagerFactory;
import org.eclipse.linuxtools.lttng.core.trace.LTTngTextTrace;
import java.net.URL;
import junit.framework.TestCase;
+
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.linuxtools.lttng.core.event.LttngEventReference;
import java.net.URL;
import junit.framework.TestCase;
+
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.linuxtools.lttng.core.event.LttngEventType;
*******************************************************************************/
package org.eclipse.linuxtools.lttng.core.tests.model;
-import org.eclipse.linuxtools.lttng.core.model.LTTngTreeNode;
-
import junit.framework.TestCase;
+import org.eclipse.linuxtools.lttng.core.model.LTTngTreeNode;
+
/**
* @author alvaro
*
import junit.framework.TestCase;
-import org.eclipse.linuxtools.lttng.core.trace.LTTngTrace;
-
/**
* @author alvaro
*
org.eclipse.linuxtools.lttng.core.tracecontrol.model,
org.eclipse.linuxtools.lttng.core.tracecontrol.model.config,
org.eclipse.linuxtools.lttng.core.tracecontrol.service,
+ org.eclipse.linuxtools.lttng.core.tracecontrol.utility,
org.eclipse.linuxtools.lttng.core.util
Bundle-Localization: plugin
* <h4>LTTng trace control command to configure a network trace</h4>
*/
public static final String Lttng_Control_WriteTraceNetwork = "writeTraceNetwork";
+ /**
+ * <h4>LTTng trace control command to stop a network trace transfer</h4>
+ */
+ public static final String Lttng_Control_StopWriteTraceNetwork = "stopWriteTraceNetwork";
/**
* <h4>LTTng trace control command to start tracing.</h4>
*/
import org.eclipse.linuxtools.lttng.core.event.LttngEvent;
import org.eclipse.linuxtools.lttng.core.event.LttngTimestamp;
+import org.eclipse.linuxtools.lttng.core.tracecontrol.utility.LiveTraceManager;
import org.eclipse.linuxtools.lttng.jni.JniTrace;
import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.experiment.TmfExperimentContext;
import org.eclipse.linuxtools.tmf.core.experiment.TmfExperimentLocation;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
-import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
+import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentRangeUpdatedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
for (ITmfTrace trace : fTraces) {
if (trace instanceof LTTngTrace) {
JniTrace jniTrace = ((LTTngTrace) trace).getCurrentJniTrace();
- if (jniTrace != null && !jniTrace.isLiveTraceSupported()) {
+ if (jniTrace != null && (!jniTrace.isLiveTraceSupported() || !LiveTraceManager.isLiveTrace(jniTrace.getTracepath()))) {
updateTimeRange();
TmfExperimentRangeUpdatedSignal signal = new TmfExperimentRangeUpdatedSignal(LTTngExperiment.this, LTTngExperiment.this,
getTimeRange());
import org.eclipse.linuxtools.lttng.core.event.LttngLocation;
import org.eclipse.linuxtools.lttng.core.event.LttngTimestamp;
import org.eclipse.linuxtools.lttng.core.exceptions.LttngException;
+import org.eclipse.linuxtools.lttng.core.tracecontrol.utility.LiveTraceManager;
import org.eclipse.linuxtools.lttng.jni.JniEvent;
import org.eclipse.linuxtools.lttng.jni.JniMarker;
import org.eclipse.linuxtools.lttng.jni.JniTrace;
import org.eclipse.linuxtools.lttng.jni.common.JniTime;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
import org.eclipse.linuxtools.lttng.jni.factory.JniTraceFactory;
+import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.experiment.TmfExperiment;
+import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
+import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpoint;
private final static boolean SHOW_LTT_DEBUG_DEFAULT = false;
private final static boolean IS_PARSING_NEEDED_DEFAULT = !UniqueEvent;
private final static int CHECKPOINT_PAGE_SIZE = 50000;
+ private final static long LTTNG_STREAMING_INTERVAL = 2000; // in ms
// Reference to our JNI trace
private JniTrace currentJniTrace;
private String traceLibPath;
+ private long fStreamingInterval = 0;
+
public LTTngTrace() {
}
// Set the currentEvent to the eventContent
eventContent.setEvent(currentLttngEvent);
+ // // Bypass indexing if asked
+ // if ( bypassIndexing == false ) {
+ // indexTrace(true);
+ // }
+ // else {
+ // Even if we don't have any index, set ONE checkpoint
+ // fCheckpoints.add(new TmfCheckpoint(new LttngTimestamp(0L) , new
+ // LttngLocation() ) );
+
+ initializeStreamingMonitor();
+ }
+
+ private void initializeStreamingMonitor() {
+ JniTrace jniTrace = getCurrentJniTrace();
+ if (jniTrace == null || (!jniTrace.isLiveTraceSupported() || !LiveTraceManager.isLiveTrace(jniTrace.getTracepath()))) {
+ // Set the time range of the trace
+ TmfContext context = seekLocation(null);
+ LttngEvent event = getNextEvent(context);
+ LttngTimestamp startTime = new LttngTimestamp(event.getTimestamp());
+ LttngTimestamp endTime = new LttngTimestamp(currentJniTrace.getEndTime().getTime());
+ setTimeRange(new TmfTimeRange(startTime, endTime));
+ TmfTraceUpdatedSignal signal = new TmfTraceUpdatedSignal(this, this, getTimeRange());
+ broadcast(signal);
+ return;
+ }
+
// Set the time range of the trace
TmfContext context = seekLocation(null);
LttngEvent event = getNextEvent(context);
- LttngTimestamp startTime = new LttngTimestamp(event.getTimestamp());
- LttngTimestamp endTime = new LttngTimestamp(currentJniTrace.getEndTime().getTime());
-
- setTimeRange(new TmfTimeRange(startTime, endTime));
+ setEndTime(TmfTimestamp.BigBang);
+ final long startTime = event != null ? event.getTimestamp().getValue() : TmfTimestamp.BigBang.getValue();
+ fStreamingInterval = LTTNG_STREAMING_INTERVAL;
+
+ final Thread thread = new Thread("Streaming Monitor for trace " + getName()) { //$NON-NLS-1$
+ LttngTimestamp safeTimestamp = null;
+ TmfTimeRange timeRange = null;
+
+ @Override
+ public void run() {
+ while (!fExecutor.isShutdown()) {
+ TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment();
+ if (experiment != null) {
+ final TmfEventRequest request = new TmfEventRequest<TmfEvent>(TmfEvent.class, TmfTimeRange.Eternity, 0, ExecutionType.FOREGROUND) {
+ @Override
+ public void handleCompleted() {
+ updateJniTrace();
+ }
+ };
+ synchronized (experiment) {
+ experiment.sendRequest(request);
+ }
+ try {
+ request.waitForCompletion();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ } else {
+ updateJniTrace();
+ }
+ try {
+ Thread.sleep(LTTNG_STREAMING_INTERVAL);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private void updateJniTrace() {
+ JniTrace jniTrace = getCurrentJniTrace();
+ currentJniTrace.updateTrace();
+ long endTime = jniTrace.getEndTime().getTime();
+ LttngTimestamp startTimestamp = new LttngTimestamp(startTime);
+ LttngTimestamp endTimestamp = new LttngTimestamp(endTime);
+ if (safeTimestamp != null && safeTimestamp.compareTo(getTimeRange().getEndTime(), false) > 0) {
+ timeRange = new TmfTimeRange(startTimestamp, safeTimestamp);
+ } else {
+ timeRange = null;
+ }
+ safeTimestamp = endTimestamp;
+ if (timeRange != null) {
+ setTimeRange(timeRange);
+ }
+ }
+ };
+ thread.start();
+ }
- if (currentJniTrace == null) {
- System.out.println("Problem");
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.trace.TmfTrace#getStreamingInterval()
+ */
+ @Override
+ public long getStreamingInterval() {
+ return fStreamingInterval;
}
/**
System.out.println("seekEvent(timestamp) timestamp -> " + timestamp); //$NON-NLS-1$
}
- if (currentJniTrace == null) {
- System.out.println("aie");
- }
-
// Call JNI to seek
currentJniTrace.seekToTime(new JniTime(timestamp.getValue()));
void doneWriteTraceLocal(IToken token, Exception error, Object str);
}
- IToken writeTraceNetwork(String provider, String target, String trace, int numChannel, Boolean isAppend, Boolean isFlightRecorder, Boolean isNormalOnly, DoneWriteTraceNetwork done);
+ IToken writeTraceNetwork(String provider, String target, String trace, String path, int numChannel, Boolean isAppend, Boolean isFlightRecorder, Boolean isNormalOnly, DoneWriteTraceNetwork done);
interface DoneWriteTraceNetwork {
/**
void doneWriteTraceNetwork(IToken token, Exception error, Object str);
}
+ IToken stopWriteTraceNetwork(String provider, String target, String trace, DoneStopWriteTraceNetwork done);
+
+ interface DoneStopWriteTraceNetwork {
+ /**
+ * This method is called when stopWriteTraceNetwork() command is completed.
+ *
+ * @param token - pending command handle.
+ * @param error - null if the command is successful.
+ * @param str - response of the agent
+ */
+ void doneStopWriteTraceNetwork(IToken token, Exception error, Object str);
+ }
+
IToken allocTrace(String provider, String target, String trace, DoneAllocTrace done);
interface DoneAllocTrace {
return new Command(fProxychannel, this, LttngConstants.Lttng_Control_GetActiveTraceInfo, new Object[] { provider, target, trace }) {
@Override
public void done(Exception error, Object[] args) {
- String[] retStrArray = new String[0];
+ String[] strArray = new String[0];
Object str = null;
if (error == null) {
assert args.length == INVALID_ARG_LENGTH;
error = toDetailedError(toError(args[0]), args[1]);
str = args[1];
- String[] strArray = toStringArray(str.toString());
- retStrArray = new String[strArray.length];
-
- for (int i = 0; i < strArray.length; i++) {
- String[] tempStr = strArray[i].split(LttngConstants.Lttng_Control_GetActiveTraceInfoSeparator);
- retStrArray[i] = tempStr[1];
- }
+ strArray = toStringArray(str.toString());
}
- done.doneGetActiveTraceInfo(token, error, retStrArray);
+ done.doneGetActiveTraceInfo(token, error, strArray);
}
}.token;
}
* @see org.eclipse.linuxtools.lttng.rse.service.ILttControllerService#writeTraceNetwork(java.lang.String, java.lang.String, java.lang.String, int, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, org.eclipse.linuxtools.lttng.rse.service.ILttControllerService.DoneWriteTraceNetwork)
*/
@Override
- public IToken writeTraceNetwork(String provider, String target, String trace, int numChannel, Boolean isAppend, Boolean isFlightRecorder, Boolean isNormalOnly, final DoneWriteTraceNetwork done) {
- return new Command(fProxychannel, this, LttngConstants.Lttng_Control_WriteTraceNetwork, new Object[] { provider, target, trace, numChannel, isAppend, isFlightRecorder, isNormalOnly }) {
+ public IToken writeTraceNetwork(String provider, String target, String trace, String path, int numChannel, Boolean isAppend, Boolean isFlightRecorder, Boolean isNormalOnly, final DoneWriteTraceNetwork done) {
+ return new Command(fProxychannel, this, LttngConstants.Lttng_Control_WriteTraceNetwork, new Object[] { provider, target, trace, path, numChannel, isAppend, isFlightRecorder, isNormalOnly }) {
@Override
public void done(Exception error, Object[] args) {
Object str = null;
}.token;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.rse.service.ILttControllerService#stopWriteTraceNetwork(java.lang.String, java.lang.String, java.lang.String, org.eclipse.linuxtools.lttng.rse.service.ILttControllerService.DoneWriteTraceNetwork)
+ */
+ @Override
+ public IToken stopWriteTraceNetwork(String provider, String target, String trace, final DoneStopWriteTraceNetwork done) {
+ return new Command(fProxychannel, this, LttngConstants.Lttng_Control_StopWriteTraceNetwork, new Object[] { provider, target, trace }) {
+ @Override
+ public void done(Exception error, Object[] args) {
+ Object str = null;
+ if (error == null) {
+ assert args.length == INVALID_ARG_LENGTH;
+ error = toDetailedError(toError(args[0]), args[1]);
+ str = args[1];
+ }
+ done.doneStopWriteTraceNetwork(token, error, str);
+ }
+ }.token;
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.lttng.rse.service.ILttControllerService#startTrace(java.lang.String, java.lang.String, java.lang.String, org.eclipse.linuxtools.lttng.rse.service.ILttControllerService.DoneStartTrace)
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011 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:
+ * Patrick Tasse - Initial API and implementation
+ *
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.lttng.core.tracecontrol.utility;
+
+import java.util.HashSet;
+
+public class LiveTraceManager {
+
+ private static final HashSet<String> fLiveTraceSet = new HashSet<String>();
+
+ public static void setLiveTrace(String tracePath, boolean live) {
+ if (live) {
+ fLiveTraceSet.add(tracePath);
+ } else {
+ fLiveTraceSet.remove(tracePath);
+ }
+ }
+
+ public static boolean isLiveTrace(String tracePath) {
+ return fLiveTraceSet.contains(tracePath);
+ }
+}
<b>make</b>. This will generate the
<b>LTTng Agent Manual</b> in HTML format. Please follow the instructions in this manual for the manual installation of the agent.
</p>
+ <p><b>NOTE:</b> For TOSIDE release 0.8, the git source code in the <b>lttng-agent/agent</b>
+ subdirectory must be replaced with the source code found in the TOSIDE installation
+ archive before performing the manual installation.
+ </p>
<p>To install an agent on Ubuntu using a PPA package follow the instruction of the web site
<a href="https://launchpad.net/~lttng/+archive/ppa">LTTng PPA</a>. However, this version won't always include the latest bugfixes. To get the latest version, the user should download the source code, compile and install the agent manually.
</p>
--- /dev/null
+bin
+@dot
+javaCompiler...args
+build.xml
+target
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.lttng.releng-site</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.UpdateSiteBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.UpdateSiteNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<site
+ mirrorsURL="http://www.eclipse.org/downloads/download.php?file=/technology/linuxtools/updates-nightly/site.xml&format=xml">
+ <description url="http://download.eclipse.org/technology/linuxtools/updates-nightly">
+ Nightly builds of Linux Tools project.
+ </description>
+ <feature url="features/org.eclipse.linuxtools.lttng_0.4.0.qualifier.jar" id="org.eclipse.linuxtools.lttng" version="0.4.0.qualifier" os="linux" ws="*" arch="*">
+ <category name="LTTng"/>
+ </feature>
+ <category-def name="LTTng" label="Linux Tools LTTng">
+ <description>
+ Eclipse Linux Tools LTTng
+ </description>
+ </category-def>
+</site>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2011 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:
+ Ericsson - initial implementation
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>linuxtools-lttng-parent</artifactId>
+ <groupId>org.eclipse.linuxtools.lttng</groupId>
+ <version>0.10.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.eclipse.linuxtools.lttng.releng-site</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <name>Linux Tools LTTng Repository</name>
+ <packaging>eclipse-repository</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>deploy</id>
+ <phase>install</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <delete includeemptydirs="false">
+ <fileset
+ dir="/var/www/technology/linuxtools/lttng/update-nightly/">
+ <include name="**" />
+ </fileset>
+ </delete>
+ <copy includeemptydirs="false"
+ todir="/var/www/technology/linuxtools/lttng/update-nightly/">
+ <fileset dir="target/repository">
+ <include name="**" />
+ </fileset>
+ </copy>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
/**
*
*/
- private static final long serialVersionUID = 216576768443708259L;
+ @SuppressWarnings("unused")
+ private static final long serialVersionUID = 216576768443708259L;
/**
* @param value
org.eclipse.core.runtime;bundle-version="3.7.0",
org.eclipse.linuxtools.tmf.core;bundle-version="0.4.0",
org.eclipse.linuxtools.tmf.ui;bundle-version="0.4.0",
- org.eclipse.linuxtools.lttng.core;bundle-version="0.4.0",
org.eclipse.tm.tcf.core;bundle-version="0.4.0",
org.eclipse.rse.core;bundle-version="3.2.0",
org.eclipse.rse.services;bundle-version="3.2.100",
org.eclipse.rse.subsystems.files.core;bundle-version="3.2.100",
- org.eclipse.rse.ui;bundle-version="3.2.0"
+ org.eclipse.rse.ui;bundle-version="3.2.0",
+ org.eclipse.linuxtools.lttng.core;bundle-version="0.4.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
id="actions.trace.pause"
label="%action.pause.label"
menubarPath="additions"
- tooltip="%action.puase.tooltip">
+ tooltip="%action.pause.tooltip">
<enablement>
<and>
<objectClass
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.ProviderResource;
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.TargetResource;
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.TraceResource;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.model.TraceAdapterFactory;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.lttng.ui.tracecontrol.model.TraceAdapterFactory;
import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.SystemBasePlugin;
\r
import org.eclipse.linuxtools.lttng.core.state.model.LttngTraceState;\r
\r
+\r
/**\r
* @author alvaro\r
* \r
package org.eclipse.linuxtools.lttng.ui.tracecontrol;
+
@SuppressWarnings("nls")
public class TraceControlConstants {
public static final String Lttng_Control_Unwrite_Trace_Data_Event = "unwrite_trace_data";
public static final String Lttng_Control_Trace_Done_Event = "trace_done";
+ // the parameter names have to be coordinated with lttctltraceinfo.c in lttng-agent
+ public static final String ACTIVE_TRACE_INFO_PARAM_DESTINATION = "destination";
+ public static final String ACTIVE_TRACE_INFO_PARAM_NUM_THREAD = "numThread";
+ public static final String ACTIVE_TRACE_INFO_PARAM_NORMAL_ONLY = "normal_only";
+ public static final String ACTIVE_TRACE_INFO_PARAM_FLIGHT_ONLY = "flight_only";
+ public static final String ACTIVE_TRACE_INFO_PARAM_ENABLED = "enabled";
+
+ // the destination prefixes have to be coordinated with lttctlkerntransfer.c in lttng-agent
+ public static final String ACTIVE_TRACE_INFO_DESTINATION_PREFIX_LOCAL = "local:";
+ public static final String ACTIVE_TRACE_INFO_DESTINATION_PREFIX_NETWORK = "network:";
+
// Default timeout for TCF tasks (in seconds)
public static final int DEFAULT_TCF_TASK_TIMEOUT = 10;
}
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.TargetResource;
import org.eclipse.linuxtools.lttng.core.tracecontrol.service.ILttControllerService;
import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.dialogs.ConfigureMarkersDialog;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.config.TraceConfig;
import org.eclipse.linuxtools.lttng.core.tracecontrol.service.ILttControllerService;
import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.wizards.ConfigureTraceWizard;
import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
public void run() {
// Setup trace location using Lttng controller service proxy
- service.writeTraceNetwork(targetResource.getParent().getName(), targetResource.getName(), traceConfig.getTraceName(),
+ service.writeTraceNetwork(targetResource.getParent().getName(), targetResource.getName(), traceConfig.getTracePath(), traceConfig.getTraceName(),
traceConfig.getNumChannel(), traceConfig.getIsAppend(), traceConfig.getMode() == TraceConfig.FLIGHT_RECORDER_MODE,
traceConfig.getMode() == TraceConfig.NORMAL_MODE, new ILttControllerService.DoneWriteTraceNetwork() {
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.TraceResource;
+import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.dialogs.ImportTraceDialog;
+import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.ISubSystem;
/*
* Method to create a symbolic link to a trace residing on the local host.
*/
- public static void linkTrace(Shell shell, TraceResource trace, IProject project, String traceName) {
- IFolder traceFolder = project.getFolder(TRACE_FOLDER_NAME);
- if (!traceFolder.exists()) {
- MessageDialog.openWarning(shell,
- Messages.ImportToProject_ImportFailed,
- Messages.ImportToProject_NoProjectTraceFolder);
- return;
- }
-
- IFolder folder = traceFolder.getFolder(traceName);
- if (folder.exists()) {
- MessageDialog.openWarning(shell,
- Messages.ImportToProject_ImportFailed,
- Messages.ImportToProject_AlreadyExists);
- return;
- }
-
- File sourceFolder = new File(trace.getTraceConfig().getTracePath());
-
- try {
- folder.createLink(sourceFolder.toURI(), IResource.REPLACE, null);
- } catch (CoreException e) {
- MessageDialog.openWarning(shell,
- Messages.ImportToProject_ImportFailed,
- e.getMessage());
- }
- }
+ public static void linkTrace(Shell shell, TraceResource trace, IProject project, String traceName) {
+ IFolder traceFolder = project.getFolder(TRACE_FOLDER_NAME);
+ if (!traceFolder.exists()) {
+ MessageDialog.openWarning(shell,
+ Messages.ImportToProject_ImportFailed,
+ Messages.ImportToProject_NoProjectTraceFolder);
+ return;
+ }
+
+ IFolder folder = traceFolder.getFolder(traceName);
+ if (folder.exists()) {
+ MessageDialog.openWarning(shell,
+ Messages.ImportToProject_ImportFailed,
+ Messages.ImportToProject_AlreadyExists);
+ return;
+ }
+
+ File sourceFolder = new File(trace.getTraceConfig().getTracePath());
+
+ try {
+ folder.createLink(sourceFolder.toURI(), IResource.REPLACE, null);
+ // Set the trace properties for this resource
+ // FIXME: update from extenstion point properties
+ folder.setPersistentProperty(TmfTraceElement.TRACEBUNDLE, LTTngUiPlugin.PLUGIN_ID);
+ folder.setPersistentProperty(TmfTraceElement.TRACETYPE, "org.eclipse.linuxtools.lttng.tracetype.kernel");
+ folder.setPersistentProperty(TmfTraceElement.TRACEICON, "icons/obj16/tux2.png");
+ } catch (CoreException e) {
+ MessageDialog.openWarning(shell,
+ Messages.ImportToProject_ImportFailed,
+ e.getMessage());
+ }
+ }
/*
* (non-Javadoc)
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.TraceResource.TraceState;
import org.eclipse.linuxtools.lttng.core.tracecontrol.service.ILttControllerService;
import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.TraceResource.TraceState;
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.config.TraceConfig;
import org.eclipse.linuxtools.lttng.core.tracecontrol.service.ILttControllerService;
+import org.eclipse.linuxtools.lttng.core.tracecontrol.utility.LiveTraceManager;
import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
trace.setTraceState(TraceState.STARTED);
+ if (trace.isNetworkTraceAndStarted()) {
+ LiveTraceManager.setLiveTrace(trace.getTraceConfig().getTracePath(), true);
+ }
+
// Refresh display
ISystemRegistry registry = SystemStartHere.getSystemRegistry();
registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED, trace, trace.getParent(), subSystem, null);
service.writeTraceNetwork(trace.getParent().getParent().getName(),
trace.getParent().getName(),
traceConfig.getTraceName(),
+ traceConfig.getTracePath(),
traceConfig.getNumChannel(),
traceConfig.getIsAppend(),
false,
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.TraceResource.TraceState;
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.config.TraceConfig;
import org.eclipse.linuxtools.lttng.core.tracecontrol.service.ILttControllerService;
+import org.eclipse.linuxtools.lttng.core.tracecontrol.utility.LiveTraceManager;
import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
}}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
trace.setTraceState(TraceState.STOPPED);
-
+
+ if (trace.getTraceConfig() != null) {
+ LiveTraceManager.setLiveTrace(trace.getTraceConfig().getTracePath(), false);
+ }
+
ISystemRegistry registry = SystemStartHere.getSystemRegistry();
registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED, trace, trace.getParent(), subSystem, null);
service.writeTraceNetwork(trace.getParent().getParent().getName(),
trace.getParent().getName(),
traceConfig.getTraceName(),
+ traceConfig.getTracePath(),
traceConfig.getNumChannel(),
traceConfig.getIsAppend(),
true, // write only flight recorder channels
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
import org.eclipse.linuxtools.lttng.core.LttngConstants;
import org.eclipse.linuxtools.lttng.core.tracecontrol.service.ILttControllerService;
import org.eclipse.linuxtools.lttng.core.tracecontrol.service.LttControllerServiceProxy;
+import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.utility.DownloadProxy;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.TargetResource;
import org.eclipse.linuxtools.lttng.core.tracecontrol.service.ILttControllerService;
import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.ProviderResource;
import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
import org.eclipse.rse.ui.SystemMenuManager;
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.TargetResource;
import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
import org.eclipse.rse.ui.SystemMenuManager;
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.TraceResource.PropertyInfo;
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.TraceResource.TraceState;
import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.ui.SystemMenuManager;
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
*******************************************************************************/
package org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems;
+import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Vector;
import org.eclipse.linuxtools.lttng.core.tracecontrol.model.config.TraceConfig;
import org.eclipse.linuxtools.lttng.core.tracecontrol.service.ILttControllerService;
import org.eclipse.linuxtools.lttng.core.tracecontrol.service.LttControllerServiceProxy;
+import org.eclipse.linuxtools.lttng.core.tracecontrol.utility.LiveTraceManager;
import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
+import org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.ImportToProject;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.PauseTrace;
import org.eclipse.linuxtools.lttng.ui.tracecontrol.connectorservice.TraceConnectorService;
import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
// get trace info
TraceConfig traceConfig;
- // Currently, if a trace is active then all the setup commands have been executed
- // and it's either started or paused. However, currently there is no means to retrieve
- // the state (paused or started). So we set it to state started (even if trace is not actually
- // started on target the command pause will be successful. However, the use will have the wrong
- // impression that the trace is started) Therefore ... the state needs to be retrievable.
- // TODO update to correct state if there is a possibility to retrieve the correct state.
- trace.setTraceState(TraceState.STARTED);
try {
final ILttControllerService service = getControllerService();
traceConfig = new TCFTask<TraceConfig>() {
service.getActiveTraceInfo(target.getParent().getName(), target.getName(), trace.getName(), new ILttControllerService.DoneGetActiveTraceInfo() {
@Override
- public void doneGetActiveTraceInfo(IToken token, Exception error, String[] str) {
+ public void doneGetActiveTraceInfo(IToken token, Exception error, String[] strArray) {
if (error != null) {
// Notify with error
error(error);
}
TraceConfig config = new TraceConfig();
+ config.setTraceName(trace.getName());
+ config.setTraceTransport(TraceControlConstants.Lttng_Trace_Transport_Relay);
config.setIsAppend(false);
- if (str[3].equals("true")) { //$NON-NLS-1$
- config.setMode(TraceConfig.FLIGHT_RECORDER_MODE);
- }
- else if (str[1].equals("true")) { //$NON-NLS-1$
- config.setMode(TraceConfig.NORMAL_MODE);
+ for (String pair : strArray) {
+ String[] pairArray = pair.split(LttngConstants.Lttng_Control_GetActiveTraceInfoSeparator);
+ if (pairArray.length != 2) {
+ continue;
+ }
+ String param = pairArray[0];
+ String value = pairArray[1];
+ if (param.equals(TraceControlConstants.ACTIVE_TRACE_INFO_PARAM_DESTINATION)) {
+ if (value.startsWith(TraceControlConstants.ACTIVE_TRACE_INFO_DESTINATION_PREFIX_LOCAL)) {
+ config.setNetworkTrace(false);
+ config.setTracePath(value.substring(TraceControlConstants.ACTIVE_TRACE_INFO_DESTINATION_PREFIX_LOCAL.length()));
+ } else if (value.startsWith(TraceControlConstants.ACTIVE_TRACE_INFO_DESTINATION_PREFIX_NETWORK)) {
+ config.setNetworkTrace(true);
+ config.setTracePath(value.substring(TraceControlConstants.ACTIVE_TRACE_INFO_DESTINATION_PREFIX_NETWORK.length()));
+ }
+ } else if (param.equals(TraceControlConstants.ACTIVE_TRACE_INFO_PARAM_NUM_THREAD)) {
+ config.setNumChannel(Integer.valueOf(value));
+ } else if (param.equals(TraceControlConstants.ACTIVE_TRACE_INFO_PARAM_NORMAL_ONLY)) {
+ if (value.equals(Boolean.toString(true))) {
+ config.setMode(TraceConfig.NORMAL_MODE);
+ }
+ } else if (param.equals(TraceControlConstants.ACTIVE_TRACE_INFO_PARAM_FLIGHT_ONLY)) {
+ if (value.equals(Boolean.toString(true))) {
+ config.setMode(TraceConfig.FLIGHT_RECORDER_MODE);
+ }
+ } else if (param.equals(TraceControlConstants.ACTIVE_TRACE_INFO_PARAM_ENABLED)) {
+ if (value.equals(Boolean.toString(true))) {
+ trace.setTraceState(TraceState.STARTED);
+ } else {
+ trace.setTraceState(TraceState.PAUSED);
+ }
+ }
}
- if (str[5].equals(TraceConfig.InvalidTracePath)) {
- config.setNetworkTrace(true);
- }
- else {
- config.setNetworkTrace(false);
- }
- config.setNumChannel(Integer.valueOf(str[0]));
- config.setTraceName(trace.getName());
- config.setTracePath(str[5]);
- config.setTraceTransport(TraceControlConstants.Lttng_Trace_Transport_Relay);
-
// Notify with active trace list
done(config);
}
});
}}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+ trace.setTraceConfig(traceConfig);
+ if (traceConfig != null) {
+ if (traceConfig.isNetworkTrace()) {
+ // stop and restart the network transfer since TCF channel may be different
+ if (fProviders == null) { // do this only on startup, not on refresh
+ restartTraceNetwork(service, trace, traceConfig);
+ }
+ LiveTraceManager.setLiveTrace(traceConfig.getTracePath(), true);
+ }
+ }
} catch (Exception e) {
if (e instanceof SystemMessageException) throw (SystemMessageException)e;
throw new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));
}
- trace.setTraceConfig(traceConfig);
}
}
}
public LttControllerServiceProxy getControllerService() throws Exception {
return ((TraceConnectorService)getConnectorService()).getControllerService();
}
+
+ /*
+ * Stop and restart the network transfer. Only normal channels are written while trace is started.
+ */
+ private void restartTraceNetwork(final ILttControllerService service, final TraceResource trace, final TraceConfig traceConfig) throws Exception {
+ File newDir = new File(traceConfig.getTracePath());
+ if (!newDir.exists()) {
+ boolean created = newDir.mkdirs();
+ if (!created) {
+ throw new Exception(Messages.Lttng_Control_ErrorCreateTracePath + ": " + traceConfig.getTracePath()); //$NON-NLS-1$
+ }
+ if (traceConfig.getProject() != null) {
+ ImportToProject.linkTrace(getShell(), trace, traceConfig.getProject(), traceConfig.getTraceName());
+ }
+ }
+
+ // stop the previous lttd
+ boolean ok = new TCFTask<Boolean>() {
+ @Override
+ public void run() {
+
+ // Setup trace transport using Lttng controller service proxy
+ service.stopWriteTraceNetwork(trace.getParent().getParent().getName(),
+ trace.getParent().getName(),
+ traceConfig.getTraceName(),
+ new ILttControllerService.DoneStopWriteTraceNetwork() {
+
+ @Override
+ public void doneStopWriteTraceNetwork(IToken token, Exception error, Object str) {
+ if (error != null) {
+ // Notify with error
+ error(error);
+ return;
+ }
+
+ // Notify about success
+ done(true);
+ }
+ });
+ }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+
+ if (!ok) {
+ return;
+ }
+
+ // lttd will only perform the shutdown after stopWriteTraceNetwork
+ // when it receives the next on_read_subbuffer callback
+
+ if (trace.getTraceState() == TraceState.PAUSED) {
+ // we need to start the trace to make sure that the network transfer is stopped
+ ok = new TCFTask<Boolean>() {
+ @Override
+ public void run() {
+
+ // Start the trace
+ service.startTrace(trace.getParent().getParent().getName(),
+ trace.getParent().getName(),
+ traceConfig.getTraceName(),
+ new ILttControllerService.DoneStartTrace() {
+
+ @Override
+ public void doneStartTrace(IToken token, Exception error, Object str) {
+ if (error != null) {
+ // Notify with error
+ error(error);
+ return;
+ }
+
+ // Notify about success
+ done(true);
+ }
+ });
+ }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+
+ if (!ok) {
+ return;
+ }
+
+ trace.setTraceState(TraceState.STARTED);
+
+ // wait for the lttd shutdown
+ Thread.sleep(1000);
+
+ // return to paused state
+ ok = new TCFTask<Boolean>() {
+ @Override
+ public void run() {
+
+ // Pause the trace
+ service.pauseTrace(trace.getParent().getParent().getName(),
+ trace.getParent().getName(),
+ traceConfig.getTraceName(),
+ new ILttControllerService.DonePauseTrace() {
+
+ @Override
+ public void donePauseTrace(IToken token, Exception error, Object str) {
+ if (error != null) {
+ // Notify with error
+ error(error);
+ return;
+ }
+
+ // Notify about success
+ done(true);
+ }
+ });
+ }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+
+ if (!ok) {
+ return;
+ }
+
+ trace.setTraceState(TraceState.PAUSED);
+
+ } else {
+ // wait for the lttd shutdown
+ Thread.sleep(1000);
+ }
+
+ // start a new lttd
+ new TCFTask<Boolean>() {
+ @Override
+ public void run() {
+
+ // Setup trace transport using Lttng controller service proxy
+ service.writeTraceNetwork(trace.getParent().getParent().getName(),
+ trace.getParent().getName(),
+ traceConfig.getTraceName(),
+ traceConfig.getTracePath(),
+ traceConfig.getNumChannel(),
+ traceConfig.getIsAppend(),
+ false,
+ true, // write only normal channels
+ new ILttControllerService.DoneWriteTraceNetwork() {
+
+ @Override
+ public void doneWriteTraceNetwork(IToken token, Exception error, Object str) {
+ if (error != null) {
+ // Notify with error
+ error(error);
+ return;
+ }
+
+ // Notify about success
+ done(true);
+ }
+ });
+ }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+ }
}
if (trace != null) {
TraceConfig conf = trace.getTraceConfig();
FileOutputStream fos = null;
- if (!TraceConfig.InvalidTracePath.equals(conf.getTracePath())) {
+ if (conf != null && !TraceConfig.InvalidTracePath.equals(conf.getTracePath())) {
String fileName = conf.getTracePath() + "/" + args[3].toString(); //$NON-NLS-1$
try {
fos = new FileOutputStream(fileName, true);
@Override
public void handleCancel() {
- fHistogram.clear();
super.handleCancel();
}
private boolean fStatisticsUpdatePending = false;
private TmfTimeRange fStatisticsUpdateRange = null;
private final Object fStatisticsUpdateSyncObj = new Object();
+ private boolean fClearData = true;
+ // Flag to force request the data from trace
+ private boolean fRequestData = false;
/**
* Contains all the information necessary to build a column of the table.
@SuppressWarnings({ "rawtypes", "unchecked" })
TmfExperimentSelectedSignal<?> signal = new TmfExperimentSelectedSignal(this, experiment);
+ fRequestData = true;
experimentSelected(signal);
} else {
// The experiment root is already present
StatisticsTreeNode experimentTreeNode = StatisticsTreeRootFactory.getStatTreeRoot(experimentName);
- ITmfTrace[] traces = experiment.getTraces();
+ @SuppressWarnings("rawtypes")
+ ITmfTrace[] traces = experiment.getTraces();
LTTngTreeNode expNode = StateManagerFactory.getExperimentManager().getSelectedExperiment();
}
// if the data is not available or has changed, reload it
- requestData(experiment, experiment.getTimeRange(), true);
+ fClearData = true;
+ if(fRequestData) {
+ requestData(experiment, experiment.getTimeRange(), fClearData);
+ fRequestData = false;
+ }
}
}
return;
}
- requestData(experiment, signal.getRange(), false);
+ requestData(experiment, signal.getRange(), fClearData);
+ fClearData = false;
}
/**
}
// send the initial request, to start filling up model
- //eventRequest(fStatisticsUpdateIndex, nbRequested, fStatisticsUpdateStartTime, clearingData, ExecutionType.BACKGROUND);
eventRequest(index, range, clearingData, ExecutionType.BACKGROUND);
} else {
TraceDebug.debug("No selected experiment information available"); //$NON-NLS-1$
protected void newCoalescedDataRequest(ITmfDataRequest<T> request) {
synchronized (fLock) {
- TmfCoalescedDataRequest<T> coalescedRequest = new TmfCoalescedDataRequest<T>(fType, request.getIndex(),
+ TmfCoalescedDataRequest<T> coalescedRequest = new TmfCoalescedDataRequest<T>(request.getDataType(), request.getIndex(),
request.getNbRequested(), request.getBlockSize(), request.getExecType());
coalescedRequest.addRequest(request);
if (Tracer.isRequestTraced()) {
while (data != null && !isCompleted(request, data, nbRead)) {
if (fLogData)
Tracer.traceEvent(provider, request, data);
- request.handleData(data);
+ if (request.getDataType().isInstance(data)) {
+ request.handleData(data);
+ }
// To avoid an unnecessary read passed the last data
// requested
@Override
public void handleData(T data) {
super.handleData(data);
- request.handleData(data);
+ if (request.getDataType().isInstance(data)) {
+ request.handleData(data);
+ }
if (getNbRead() > CHUNK_SIZE[0]) {
System.out.println("ERROR - Read too many events"); //$NON-NLS-1$
}
@Override
public void handleData(T data) {
super.handleData(data);
- request.handleData(data);
+ if (request.getDataType().isInstance(data)) {
+ request.handleData(data);
+ }
if (this.getNbRead() > CHUNK_SIZE[0]) {
System.out.println("ERROR - Read too many events"); //$NON-NLS-1$
}
import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentDisposedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentRangeUpdatedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentSelectedSignal;
// Indexing
// ------------------------------------------------------------------------
+ private synchronized void initializeStreamingMonitor() {
+ if (getStreamingInterval() == 0) {
+ TmfContext context = seekLocation(null);
+ TmfEvent event = getNext(context);
+ if (event == null) {
+ return;
+ }
+ TmfTimeRange timeRange = new TmfTimeRange(event.getTimestamp(), TmfTimestamp.BigCrunch);
+ TmfExperimentRangeUpdatedSignal signal = new TmfExperimentRangeUpdatedSignal(this, this, timeRange);
+ broadcast(signal);
+ return;
+ }
+
+ final Thread thread = new Thread("Streaming Monitor for experiment " + getName()) { //$NON-NLS-1$
+ TmfTimestamp safeTimestamp = null;
+ TmfTimeRange timeRange = null;
+
+ @Override
+ public void run() {
+ while (!fExecutor.isShutdown()) {
+ if (!isIndexingBusy()) {
+ TmfTimestamp startTimestamp = TmfTimestamp.BigCrunch;
+ TmfTimestamp endTimestamp = TmfTimestamp.BigBang;
+ for (ITmfTrace<T> trace : fTraces) {
+ if (trace.getStartTime().compareTo(startTimestamp) < 0) {
+ startTimestamp = trace.getStartTime();
+ }
+ if (trace.getStreamingInterval() != 0 && trace.getEndTime().compareTo(endTimestamp) > 0) {
+ endTimestamp = trace.getEndTime();
+ }
+ }
+ if (safeTimestamp != null && safeTimestamp.compareTo(getTimeRange().getEndTime(), false) > 0) {
+ timeRange = new TmfTimeRange(startTimestamp, safeTimestamp);
+ } else {
+ timeRange = null;
+ }
+ safeTimestamp = endTimestamp;
+ if (timeRange != null) {
+ TmfExperimentRangeUpdatedSignal signal =
+ new TmfExperimentRangeUpdatedSignal(TmfExperiment.this, TmfExperiment.this, timeRange);
+ broadcast(signal);
+ }
+ }
+ try {
+ Thread.sleep(getStreamingInterval());
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ };
+ thread.start();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.trace.ITmfTrace#getStreamingInterval()
+ */
+ @Override
+ public long getStreamingInterval() {
+ long interval = 0;
+ for (ITmfTrace<T> trace : fTraces) {
+ interval = Math.max(interval, trace.getStreamingInterval());
+ }
+ return interval;
+ }
+
/*
* The experiment holds the globally ordered events of its set of traces. It is expected to provide access to each
* individual event by index i.e. it must be possible to request the Nth event of the experiment.
protected boolean fIndexing = false;
protected TmfTimeRange fIndexingPendingRange = TmfTimeRange.Null;
+ private Integer fEndSynchReference;
+
// private static BufferedWriter fEventLog = null;
// private static BufferedWriter openLogFile(String filename) {
// BufferedWriter outfile = null;
protected void notifyListeners() {
broadcast(new TmfExperimentUpdatedSignal(this, this)); // , null));
- broadcast(new TmfExperimentRangeUpdatedSignal(this, this, fTimeRange)); // , null));
+ //broadcast(new TmfExperimentRangeUpdatedSignal(this, this, fTimeRange)); // , null));
}
// ------------------------------------------------------------------------
TmfExperiment<?> experiment = signal.getExperiment();
if (experiment == this) {
setCurrentExperiment(experiment);
- indexExperiment(false);
+ fEndSynchReference = new Integer(signal.getReference());
+ }
+ }
+
+ @TmfSignalHandler
+ public void endSync(TmfEndSynchSignal signal) {
+ if (fEndSynchReference != null && fEndSynchReference.intValue() == signal.getReference()) {
+ fEndSynchReference = null;
+ initializeStreamingMonitor();
}
+
}
@TmfSignalHandler
public void experimentUpdated(TmfExperimentUpdatedSignal signal) {
}
+ @TmfSignalHandler
+ public void experimentRangeUpdated(TmfExperimentRangeUpdatedSignal signal) {
+ indexExperiment(false, (int) fNbEvents, signal.getRange());
+ }
+
@TmfSignalHandler
public void traceUpdated(TmfTraceUpdatedSignal signal) {
for (ITmfTrace<T> trace : fTraces) {
boolean ok = request.getIndex() == getIndex();
ok &= request.getNbRequested() == getNbRequested();
ok &= request.getExecType() == getExecType();
+ //ok &= request.getDataType() == getDataType();
return ok;
}
if (getClass() == TmfCoalescedDataRequest.class) {
for (ITmfDataRequest<T> request : fRequests) {
if (!request.isCompleted()) {
- request.handleData(data);
+ if (request.getDataType().isInstance(data)) {
+ request.handleData(data);
+ }
}
}
}
boolean ok = getNbRequested() == request.getNbRequested();
ok &= getIndex() == request.getIndex();
ok &= getExecType() == request.getExecType();
+ //ok &= getDataType() == request.getDataType();
if (ok) {
TmfTimestamp startTime = ((ITmfEventRequest<T>) request).getRange().getStartTime();
TmfTimestamp endTime = ((ITmfEventRequest<T>) request).getRange().getEndTime();
// ------------------------------------------------------------------------
@Override
- public void handleData(T data) {
- super.handleData(data);
- for (ITmfDataRequest<T> request : fRequests) {
- if (data == null) {
- request.handleData(null);
- } else {
- if (request instanceof TmfEventRequest<?>) {
- TmfEventRequest<T> req = (TmfEventRequest<T>) request;
- if (!req.isCompleted()) {
- TmfTimestamp ts = data.getTimestamp();
- if (req.getRange().contains(ts)) {
- req.handleData(data);
- }
- }
- }
- else {
- TmfDataRequest<T> req = (TmfDataRequest<T>) request;
- if (!req.isCompleted()) {
- req.handleData(data);
- }
- }
- }
- }
+ public void handleData(T data) {
+ super.handleData(data);
+ for (ITmfDataRequest<T> request : fRequests) {
+ if (data == null) {
+ request.handleData(null);
+ } else {
+ if (request instanceof TmfEventRequest<?>) {
+ TmfEventRequest<T> req = (TmfEventRequest<T>) request;
+ if (!req.isCompleted()) {
+ TmfTimestamp ts = data.getTimestamp();
+ if (req.getRange().contains(ts)) {
+ if (req.getDataType().isInstance(data)) {
+ req.handleData(data);
+ }
+ }
+ }
+ }
+ else {
+ TmfDataRequest<T> req = (TmfDataRequest<T>) request;
+ if (!req.isCompleted()) {
+ if (req.getDataType().isInstance(data)) {
+ req.handleData(data);
+ }
+ }
+ }
+ }
+ }
}
// ------------------------------------------------------------------------
*/
static int fSignalId = 0;
static public synchronized void dispatchSignal(TmfSignal signal) {
- fSignalId++;
- sendSignal(new TmfStartSynchSignal(fSignalId));
- signal.setReference(fSignalId);
+ int signalId = fSignalId++;
+ sendSignal(new TmfStartSynchSignal(signalId));
+ signal.setReference(signalId);
sendSignal(signal);
- sendSignal(new TmfEndSynchSignal(fSignalId));
+ sendSignal(new TmfEndSynchSignal(signalId));
}
static private void sendSignal(TmfSignal signal) {
public TmfTimestamp getEndTime();
+ /**
+ * @return the streaming interval in ms (0 if not streaming)
+ */
+ public long getStreamingInterval();
+
/**
* Positions the trace at the first event with the specified timestamp or index (i.e. the nth event in the trace).
*
return fEndTime;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.trace.ITmfTrace#getStreamingInterval()
+ */
+ @Override
+ public long getStreamingInterval() {
+ return 0;
+ }
+
@SuppressWarnings("unchecked")
public Vector<TmfCheckpoint> getCheckpoints() {
return (Vector<TmfCheckpoint>) fCheckpoints.clone();
public class CustomTxtTrace extends TmfTrace<CustomTxtEvent> {\r
\r
private static final TmfLocation<Long> NULL_LOCATION = new TmfLocation<Long>((Long) null);\r
- \r
+ private static final int CACHE_SIZE = 100;\r
+\r
private CustomTxtTraceDefinition fDefinition;\r
private CustomTxtEventType fEventType;\r
\r
fEventType = new CustomTxtEventType(fDefinition);\r
}\r
\r
- @Override\r
+ @Override\r
+ public void initTrace(String path, Class<CustomTxtEvent> eventType, boolean indexTrace) throws FileNotFoundException {\r
+ super.initTrace(path, eventType, CACHE_SIZE, indexTrace);\r
+ }\r
+\r
+ @Override\r
@SuppressWarnings({ "unchecked", "rawtypes" })\r
public ITmfTrace copy() {\r
// TODO Auto-generated method stub\r
\r
@Override\r
public TmfContext seekLocation(ITmfLocation<?> location) {\r
- //System.out.println(Thread.currentThread().getName() + "::" + getName() + " seekLocation(" + ((location == null || location.getLocation() == null) ? "null" : location) + ")");\r
- //new Throwable().printStackTrace();\r
CustomTxtTraceContext context = new CustomTxtTraceContext(NULL_LOCATION, ITmfContext.INITIAL_RANK);\r
if (NULL_LOCATION.equals(location) || !new File(getPath()).isFile()) {\r
return context;\r
\r
@Override\r
public TmfEvent parseEvent(TmfContext tmfContext) {\r
- //System.out.println(Thread.currentThread().getName() + ":: " + getName() + " parseEvent(" + tmfContext.getRank() + " @ " + (tmfContext.getLocation().getLocation() == null ? "null" : tmfContext.getLocation()));\r
if (!(tmfContext instanceof CustomTxtTraceContext)) {\r
return null;\r
}\r
public class CustomXmlTrace extends TmfTrace<CustomXmlEvent> {\r
\r
private static final TmfLocation<Long> NULL_LOCATION = new TmfLocation<Long>((Long) null);\r
- \r
+ private static final int CACHE_SIZE = 100;\r
+\r
private CustomXmlTraceDefinition fDefinition;\r
private CustomXmlEventType fEventType;\r
private InputElement fRecordInputElement;\r
fRecordInputElement = getRecordInputElement(fDefinition.rootInputElement);\r
}\r
\r
+ @Override\r
+ public void initTrace(String path, Class<CustomXmlEvent> eventType, boolean indexTrace) throws FileNotFoundException {\r
+ super.initTrace(path, eventType, CACHE_SIZE, indexTrace);\r
+ }\r
+\r
@Override\r
public TmfContext seekLocation(ITmfLocation<?> location) {\r
- //System.out.println(Thread.currentThread().getName() + "::" + getName() + " seekLocation(" + ((location == null || location.getLocation() == null) ? "null" : location) + ")");\r
- //new Throwable().printStackTrace();\r
CustomXmlTraceContext context = new CustomXmlTraceContext(NULL_LOCATION, ITmfContext.INITIAL_RANK);\r
if (NULL_LOCATION.equals(location) || !new File(getPath()).isFile()) {\r
return context;\r
\r
@Override\r
public TmfEvent parseEvent(TmfContext tmfContext) {\r
- //System.out.println(Thread.currentThread().getName() + ":: " + getName() + " parseEvent(" + tmfContext.getRank() + " @ " + (tmfContext.getLocation().getLocation() == null ? "null" : tmfContext.getLocation()));\r
if (!(tmfContext instanceof CustomXmlTraceContext)) {\r
return null;\r
}\r
// Instantiate the experiment's traces
List<TmfTraceElement> traceEntries = fExperiment.getTraces();
int nbTraces = traceEntries.size();
+ int cacheSize = Integer.MAX_VALUE;
ITmfTrace<?>[] traces = new ITmfTrace[nbTraces];
for (int i = 0; i < nbTraces; i++) {
TmfTraceElement element = traceEntries.get(i);
ITmfTrace trace = element.instantiateTrace();
TmfEvent traceEvent = element.instantiateEvent();
try {
- trace.initTrace(element.getLocation().getPath(), traceEvent.getClass());
+ trace.initTrace(element.getLocation().getPath(), traceEvent.getClass(), false);
} catch (FileNotFoundException e) {
displayErrorMsg(""); //$NON-NLS-1$
}
+ cacheSize = Math.min(cacheSize, trace.getCacheSize());
traces[i] = trace;
}
// Create the experiment and signal
- TmfExperiment experiment = new TmfExperiment(traces[0].getClass(), fExperiment.getName(), traces, traces[0].getCacheSize());
+ TmfExperiment experiment = new TmfExperiment(TmfEvent.class, fExperiment.getName(), traces, cacheSize);
TmfExperiment.setCurrentExperiment(experiment);
TmfSignalManager.dispatchSignal(new TmfExperimentSelectedSignal(this, experiment));
import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterAndNode;\r
import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterMatchesNode;\r
import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterNode;\r
+import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;\r
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;\r
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;\r
-import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;\r
-import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentRangeUpdatedSignal;\r
+import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentUpdatedSignal;\r
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;\r
import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;\r
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal;\r
// }\r
\r
@TmfSignalHandler\r
- public void experimentUpdated(TmfExperimentRangeUpdatedSignal signal) {\r
+ public void experimentUpdated(TmfExperimentUpdatedSignal signal) {\r
if ((signal.getExperiment() != fTrace) || fTable.isDisposed())\r
return;\r
// Perform the refresh on the UI thread\r
import org.eclipse.linuxtools.tmf.core.filter.model.ITmfFilterTreeNode;\r
import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterAndNode;\r
import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterCompareNode;\r
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterCompareNode.Type;\r
import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterContainsNode;\r
import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterEqualsNode;\r
import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterEventTypeNode;\r
import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterNode;\r
import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterOrNode;\r
import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterRootNode;\r
-import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterCompareNode.Type;\r
import org.eclipse.linuxtools.tmf.core.util.TmfTraceType;\r
import org.eclipse.linuxtools.tmf.ui.internal.Messages;\r
import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTraceDefinition.OutputColumn;\r
import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtEvent;\r
-import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTrace;\r
import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTraceDefinition;\r
import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlEvent;\r
-import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTrace;\r
import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTraceDefinition;\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.custom.SashForm;\r
protected TmfTimeRange fStatisticsUpdateRange = null;
protected final Object fStatisticsUpdateSyncObj = new Object();
+ // Flag to force request the data from trace
+ protected boolean fRequestData = false;
+
+
// Object to store the cursor while waiting for the experiment to load
private Cursor fWaitCursor = null;
// Number of this instance. Used as an instance ID
private int fInstanceNb;
+
/**
* Constructor of a statistics view.
// Read current data if any available
TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment();
if (experiment != null) {
+ fRequestData = true;
// Insert the statistics data into the tree
@SuppressWarnings({ "rawtypes", "unchecked" })
TmfExperimentSelectedSignal<?> signal = new TmfExperimentSelectedSignal(this, experiment);
// set input to a clean data model
fTreeViewer.setInput(treeModelRoot);
-
- // if the data is not available or has changed, reload it
- requestData(experiment, experiment.getTimeRange());
+
+ if (fRequestData) {
+ requestData(experiment, experiment.getTimeRange());
+ fRequestData = false;
+ }
}
}
<module>org.eclipse.linuxtools.lttng.core.tests</module>
</modules>
</profile>
-
+
+ <profile>
+ <id>lttngPackage</id>
+ <modules>
+ <module>org.eclipse.linuxtools.lttng.releng-site</module>
+ </modules>
+ </profile>
+
</profiles>
<build>