Profiler

Profiler

The ProfilerComponent allows you to measure the time each check, Xtend function or Xpand define needed to be executed in your workflow. It does so by acting as a callback of the CheckComponent , XtendComponent and XpandComponent where the time of each call will be stored in a profiling model. From this data the profiler eventually derives execution times with and without children, callers/callees with the corresponding call counts and finally a call graph with respect to recursive calls. A set of Xpand templates can transform the model to an HTML report or a text file in the GNU GProf format.

Figure 2. Sample HTML output of the profiler

Sample HTML output of the profiler

Use the ProfilerComponent to wrap other components inside a workflow. Denote a resultSlot where the profiler stores the model in the end. Then, refer to this component via idRef as a callback. As soon as the component-tag of the profiler closes, it stores the derived profiling model in the given slot. You are free to transform this model or you can re-use one of the templates that come with profiler.

<component id="profiler" class="org.eclipse.xtend.profiler.ProfilerComponent">
	<resultSlot value="profilingResult" />
	
	<component class="org.eclipse.xtend.check.CheckComponent">
		<vetoableCallback idRef="profiler" />
		...
	</component>
	<component class="org.eclipse.xtend.XtendComponent">
		<vetoableCallback idRef="profiler" />
		...
	</component>
	<component class="org.eclipse.xpand2.Generator">
		<vetoableCallback idRef="profiler" />
		...
	</component>
</component>

<component class="org.eclipse.xpand2.Generator" fileEncoding="ISO-8859-1">
	<metaModel idRef="mm"/>
	<expand value="org::eclipse::xtend::profiler::templates::Html::Main FOR profilingResult"/> 
	<outlet overwrite="true" path="profiling"/>
</component>
	

Currently, there are two different templates available to render the profiling model

  • org::eclipse::xtend::profiler::templates::Html::Main

  • org::eclipse::xtend::profiler::templates::GProf::Main

The Xpand Wizard will produce a workflow called workflowWithProfiler.mwe that demonstrates the capabilities of the profiler. It puts the result in the folder profiling .