Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/doc-files/basicAnalysis.py10
-rw-r--r--analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/doc-files/scriptedDataProvider.js4
-rw-r--r--doc/org.eclipse.tracecompass.incubator.scripting.doc.user/doc/User-Guide.mediawiki28
-rw-r--r--doc/org.eclipse.tracecompass.incubator.scripting.doc.user/doc/images/change_javascript_engine.pngbin0 -> 117639 bytes
4 files changed, 36 insertions, 6 deletions
diff --git a/analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/doc-files/basicAnalysis.py b/analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/doc-files/basicAnalysis.py
index 56e44a88..066a8558 100644
--- a/analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/doc-files/basicAnalysis.py
+++ b/analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/doc-files/basicAnalysis.py
@@ -40,9 +40,12 @@ def runAnalysis():
# Parse all events
event = None
while iter.hasNext():
-
+ # The python java gateway keeps a reference to the Java objects it sends to python. To avoid OutOfMemoryException, they need to be explicitly detached from the gateway when not needed anymore
+ if not(event is None):
+ gateway.detach(event)
+
event = iter.next();
-
+
# Do something when the event is a sched_switch
if event.getName() == "sched_switch":
# This function is a wrapper to get the value of field CPU in the event, or return null if the field is not present
@@ -65,7 +68,6 @@ if not(ss.waitUntilBuilt(0)):
# Get a time graph provider from this analysis, displaying all attributes (which are the cpus here)
provider = createTimeGraphProvider(analysis, {ENTRY_PATH : '*'});
-if not (provider is None):
+if not(provider is None):
# Open a time graph view displaying this provider
openTimeGraphView(provider)
-
diff --git a/analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/doc-files/scriptedDataProvider.js b/analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/doc-files/scriptedDataProvider.js
index 96f28900..495db6b9 100644
--- a/analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/doc-files/scriptedDataProvider.js
+++ b/analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/doc-files/scriptedDataProvider.js
@@ -70,7 +70,7 @@ function runAnalysis() {
if (resourceId != null) {
// Close the receiving state of the resource
quark = ss.getQuarkAbsoluteAndAdd(resourceId);
- ss.modifyAttribute(event.getTimestamp().toNanos(), null, quark);
+ ss.removeAttribute(event.getTimestamp().toNanos(), quark);
}
// We received a message, see if we can close a pending arrow
source = getFieldValue(event, "source");
@@ -108,7 +108,7 @@ function runAnalysis() {
if (resourceId != null) {
// Close the sending state of this resource
quark = ss.getQuarkAbsoluteAndAdd(resourceId);
- ss.modifyAttribute(event.getTimestamp().toNanos(), null, quark);
+ ss.removeAttribute(event.getTimestamp().toNanos(), quark);
}
}
}
diff --git a/doc/org.eclipse.tracecompass.incubator.scripting.doc.user/doc/User-Guide.mediawiki b/doc/org.eclipse.tracecompass.incubator.scripting.doc.user/doc/User-Guide.mediawiki
index e294d780..91875a2e 100644
--- a/doc/org.eclipse.tracecompass.incubator.scripting.doc.user/doc/User-Guide.mediawiki
+++ b/doc/org.eclipse.tracecompass.incubator.scripting.doc.user/doc/User-Guide.mediawiki
@@ -85,6 +85,34 @@ You can also run the script in debug mode ('''Debug As''' -> '''EASE Script''').
The Trace Compass branch downloaded above changed the ''State System Explorer'' so that it can open state system files directly, without requiring them to be linked to an analysis. The state system created by the script can thus be explored using that view.
+=== Language Specific Troubleshooting ===
+
+==== Javascript ====
+
+* Errors saying "Cannot convert <some value> to <some java type>" when calling a Java method
+
+Change the Javascript engine to '''Nashorn''' in the Run configuration..., as in the screenshot below.
+
+[[Image:images/change_javascript_engine.png | Change the Javascript Engine]]
+
+''Explanation'': This will typically happen when calling a method with multiple signatures. There are 2 javascript engines in EASE:
+
+1. '''Rhino''' which has the advantage of having a debug engine, but does not handle well methods with multiple signature.
+
+2. '''Nashorn''' which lacks a debugger but has better support of jave methods with multiple signatures.
+
+So when problems that should not be arise with '''Rhino''', a switch to '''Nashorn''' may fix the problem.
+
+==== Python ====
+
+* The script lags and eventually causes an OutOfMemoryException
+
+To avoid OutOfMemoryException, objects should be explicitly detached from the py4j gateway when not needed anymore by calling <code>gateway.detach(myUnneededObject)</code>.
+
+''Explanation'': The python java gateway keeps a reference to the Java objects it sends to the python side. In theory, those objects should be released when the python garbage collector runs. But in practice, it does not seem to work very well, and for scripts that creates a lot of objects (like an event request on a large trace), an OOME happens.
+
+See the [https://www.py4j.org/advanced_topics.html#py4j-memory-model py4j memory model documentation] for more information.
+
== Command Line Scripting ==
Apart from executing a script file, it is also possible to access a script shell in Trace Compass, and script commands from it.
diff --git a/doc/org.eclipse.tracecompass.incubator.scripting.doc.user/doc/images/change_javascript_engine.png b/doc/org.eclipse.tracecompass.incubator.scripting.doc.user/doc/images/change_javascript_engine.png
new file mode 100644
index 00000000..26d35b31
--- /dev/null
+++ b/doc/org.eclipse.tracecompass.incubator.scripting.doc.user/doc/images/change_javascript_engine.png
Binary files differ

Back to the top