Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[linuxtools-dev] TMF: pluggable state provider contribution

Hi all,

Some news on a topic that was discussed a few months ago : how to add new state system with a declarative language in TMF.

  • Results :
The defined XML structure has been used in several cases without significant loss of performance.
Complicated cases such as Linux Kernel and Windows Kernel (with ETW) are available.

Linux Kernel : http://secretaire.dorsal.polymtl.ca/~fwininger/XmlStateProvider/kernel-0.6.state-schema.xml


However I think it is more interesting to present an XML created for a simple use case.
  • Example :
This use case has been done by Simon Marchi to debug a problem with gdb. He added 4 tracepoints (Lttng  UST) to monitor start/stop of a gdb instance and he want to visualize the result in a view in TMF.
It's very easy in this case to convert the events in states with XML syntax, and you can have in less than 30 minutes your own state system in TMF.
<tmfxml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:noNamespaceSchemaLocation="http://secretaire.dorsal.polymtl.ca/~fwininger/XmlStateProvider/0.6.state-schema.xsd">
   <stateprovider analysisid="polymtl.gdb.debug">
	<stateValue name="INF_RUNNING" value="1" />
	<stateValue name="INF_STOPPED" value="0" />

	<eventHandler eventname="gdb:inf_forked">
		<stateChange>
			<attribute constant="gdb" />
			<attribute eventfield="pid" />
			<attribute constant="Status" />
			<value int="$INF_RUNNING" />
		</stateChange>
	</eventHandler>
	<eventHandler eventname="gdb:inf_stop">
		<stateChange>
			<attribute constant="gdb" />
			<attribute eventfield="pid" />
			<attribute constant="Status" />
			<value int="$INF_STOPPED" />
		</stateChange>
	</eventHandler>
	<eventHandler eventname="gdb:inf_cont">
		<stateChange>
			<attribute constant="gdb" />
			<attribute eventfield="pid" />
			<attribute constant="Status" />
			<value int="$INF_RUNNING" />
		</stateChange>
	</eventHandler>
	<eventHandler eventname="gdb:inf_step">
		<stateChange>
			<attribute constant="gdb" />
			<attribute eventfield="pid" />
			<attribute constant="Status" />
			<value int="$INF_RUNNING" />
		</stateChange>
	</eventHandler>
   </stateprovider>
</tmfxml>

  • Visualization

I am currently working on a generic view to display the state system.
It is based on the AbstractTimeGraphView and you can choose which branches to display with a XML.

Example : for the Resources View, you want to display the Thread/* branch in the state system :

<tmfxml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:noNamespaceSchemaLocation="http://secretaire.dorsal.polymtl.ca/~fwininger/XmlStateProvider/0.6.state-schema.xsd">
   <view id="polymtl.kernel.view">
	<head>
		<analysis id="polymtl.kernel.sp"/>
	</head>

	<!-- StateValues -->
	<stateValue name="PROCESS_STATUS_UNKNOWN" value="0" color="#EEEEEE"/>
	<stateValue name="PROCESS_STATUS_WAIT_BLOCKED" value="1" color="#CCCCCC"/>
	<stateValue name="PROCESS_STATUS_RUN_USERMODE" value="2" color="#118811"/>
	<stateValue name="PROCESS_STATUS_RUN_SYSCALL" value="3" color="#0000EE"/>
	<stateValue name="PROCESS_STATUS_INTERRUPTED" value="4" color="#DDDD00"/>
	<stateValue name="PROCESS_STATUS_WAIT_FOR_CPU" value="5" color="#AA0000"/>

	<!-- Resouces View -->
	<line id="Threads/*" display="Status" name="Exec_name" parent="PPID">
		<!-- Options -->
		<option name="PPID" path="PPID"/>
		<option name="TID" path=""/>
	</line>
    </view>
</tmfxml>


  • XML Specification :
All specifications can be found here:
http://secretaire.dorsal.polymtl.ca/~fwininger/XmlStateProvider/0.6.state-schema.xsd

  • Sources :
The prototype of the xml provider can be found in the xml_analysis branch here:
http://git.dorsal.polymtl.ca/~fwininger?p=linuxtools.git;a=shortlog;h=refs/heads/xml_analysis

The contribution comes with the analysis framework developed by Genevieve Bastien.
To be use you must add the XML file in this directory : runtimeWorkspace/.metadata/.plugins/
org.eclipse.linuxtools.tmf.analysis.xml/xml_files/
A easy way to import the XML files will come as soon as possible.

I am very interested to have new use cases to have more feedback on the usability and performance of this system.

Cheers,
Florian



Back to the top