Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tracecompass-dev] Script example without trace data

Hi Christian,


This is an interesting use case. Indeed in Trace Compass, a trace is one of the central concepts and without a trace, there isn't much that can be done. Analyses belong to traces and state systems belong to analyses. And the view's time range is the range of the currently active trace.

It is true that with data providers and now scripting, the concept of trace is not mandatory if we just want to populate views. But we had not seen this use case yet and core changes to Trace Compass would need to be made to support this.

But what about your internal data model? Can it become a trace? Could you extract trace data from this model? There's probably timestamps in this model? If so, you could have a script that gets the earliest and latest timestamps from your data and simply writes a file like this

<earliest time> dummyEvent

<latest time> dummyEvent

Then you can import it to Trace Compass (manually, the scripted method to import a trace is still under review) and create a custom text parser for it, like the one I'm attaching here (You can import this parser when right-clicking on the trace, selecting "Select Trace Type" and "Manage Custom Parsers". This will give you a trace with 2 events and the given time range.

This way, you'll be able to get an analysis and a state system and have the script populate analyses and views that span that time range.

Also, if you want to turn all your internal data into a trace with more than 2 events, that's also possible. That would be a 2-steps process though: 1- create the trace, 2- Do the scripted analysis on that trace. There's a few builtin trace format available (ctf, btf, pcap, also as add-ons trace-event (json)), but they are not easy to produce. But here's the documentation for the custom trace parsers [1], so you can turn any text file into a trace.


If you would just like to see the examples working with trace data, you can look at the tutorial at [2]. The lab numbered 204 is the one that was presented at Eclipse Con and the trace archive in the repo contains a trace for which the tutorial works (203-custom-application/mpi-ring), but also many kernel traces, on which the other examples in the doc will work.


[1] https://archive.eclipse.org/tracecompass/doc/stable/org.eclipse.tracecompass.doc.user/Trace-Compass-Main-Features.html#Custom_Parsers

[2] https://github.com/tuxology/tracevizlab/tree/master/labs


I hope this helps. Let us know if anything is not too clear.

Geneviève



On 2019-10-25 4:28 a.m., Christian Pontesegger wrote:
Hi,

I would like to create a state chart similar to the one shown @ ECE:
https://www.eclipsecon.org/sites/default/files/slides/EclipseConEurope2019-TraceCompass-EASE.pdf
on page 24

I do not have a trace file to parse, all my data resides in an internal
data model. Therefore I would need to be able to create an empty trace
first and then populate it via API. Is there an example available for
this use case?

Checking out the examples from:
https://archive.eclipse.org/tracecompass.incubator/doc/javadoc/apidocs/org/eclipse/tracecompass/incubator/scripting/core/doc-files/examples.html
does not help much as they all seem to rely on some data files which I
was not able to find:

	var analysis = getAnalysis("mpiring.js");

	if (analysis == null) {
		print("Trace is null");
		exit();
	}

always exists as analysis is null.

Is there a way to create an analysis from scratch, add some data
programmatically and plot that stuff?

thanks
Christian



_______________________________________________
tracecompass-dev mailing list
tracecompass-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/tracecompass-dev
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<CustomTxtTraceDefinitionList>
<Definition category="Custom Text" name="SimpleText">
<TimeStampOutputFormat>TTT.SSS SSS SSS</TimeStampOutputFormat>
<InputLine>
<Cardinality max="2147483647" min="0"/>
<RegEx>([\d.]*)\s*(.*\S)</RegEx>
<InputData action="0" format="TTT.SSSSSSSSSS" name="Timestamp" tag="TIMESTAMP"/>
<InputData action="0" format="" name="Message" tag="MESSAGE"/>
</InputLine>
<OutputColumn name="Timestamp" tag="TIMESTAMP"/>
<OutputColumn name="Message" tag="MESSAGE"/>
</Definition>
</CustomTxtTraceDefinitionList>

Back to the top