A Brief Introduction
Jörg Werner, Xceptance
Data that can be processed by XLT
What you'll get automatically:
What you could get on top:
Your tool to count how often certain things were happening during a load test
EventData data = new EventData("ProductHasNoPrice"); // sets timestamp
data.setTestCaseName("TOrder");
data.setMessage("PID: 12345");
Session.getCurrent().getDataManager().logDataRecord(data);
// even shorter
Session.logEvent("ProductHasNoPrice", "PID: 12345");
timers.csv:
E,ProductHasNoPrice,1456928543182,TOrder,PID: 12345
CustomData data = new CustomData("Foo"); // sets start time
try
{
// do the things you want to measure
}
catch (Throwable t)
{
data.setFailed(true); // mark the action as failed
throw t;
}
finally
{
data.setRunTime(); // automatically sets elapsed time as runtime
Session.getCurrent().getDataManager().logDataRecord(data);
}
timers.csv:
C,Foo,1456928543182,1234,true
double value = 0.1234; // determine the value
CustomValue data = new CustomValue("CacheHitRatio"); // also sets timestamp
data.setvalue(value);
Session.getCurrent().getDataManager().logDataRecord(data);
timers.csv:
V,CacheHitRatio,1456928543182,0.1234
public class MyValueSampler extends AbstractCustomSampler
{
public void initialize()
{
// initialize
}
public void shutdown()
{
// clean up
}
public double execute()
{
// determine the value
double value = ...;
return value;
}
}
com.xceptance.xlt.customSamplers.1.class = com.acme.MyValueSampler
com.xceptance.xlt.customSamplers.1.name = MyValue
com.xceptance.xlt.customSamplers.1.description = ...
com.xceptance.xlt.customSamplers.1.interval = 1000
com.xceptance.xlt.customSamplers.1.chart.title = My Value
com.xceptance.xlt.customSamplers.1.chart.yAxisTitle = Value
#com.xceptance.xlt.customSamplers.1.property.foo = 123
#com.xceptance.xlt.customSamplers.1.property.bar = abc
...
com.xceptance.xlt.customSamplers.9.class = ...
com.xceptance.xlt.customSamplers.9.name = ...
...
... and XLT will take care to execute it regularly.
Sometimes client-side measurements are not enough ...
General structure of the configuration file
<files>
<file source="embedded_00/CustomData/data.csv" encoding="UTF-8" parserClass="com.xceptance.xlt.api.report.external.SimpleCsvParser">
<headline>Demo CSV report</headline>
<description>This is a demo report based on data from a CSV file.</description>
<properties>
<property key="parser.dateFormat.pattern" value="dd.MM.yyyy HH:mm:ss" />
<property key="parser.dateFormat.timeZone" value="GMT+0" />
<property key="parser.csv.separator" value="," />
</properties>
<tables>...</tables>
<charts>...</charts>
</file>
</files>
How to configure the data tables
<tables>
<table title="CPU Statistics" type="minmaxavg">
<rows>
<row valueName="1" title="CPU Temperature" unit="°C" />
<row valueName="2" title="CPU Usage" unit="%" />
</rows>
</table>
<table title="Network Statistics" type="minmaxavg">
<rows>
<row valueName="3" title="Inbound Network Traffic" unit="KB/s" />
<row valueName="4" title="Outbound Network Traffic" unit="KB/s" />
</rows>
</table>
</tables>
How to configure the charts
<charts>
<chart title="QuadCore CPU" yAxisTitle="CPU Temperature [°C]" yAxisTitle2="CPU Usage [%]">
<seriesCollection>
<series valueName="1" title="CPU Temperature" axis="1" color="#00FF00" average="10" averageColor="#008400" />
<series valueName="2" title="CPU Usage" axis="2" color="#FF0000" average="10" averageColor="#840000" />
</seriesCollection>
</chart>
<chart title="Network Traffic" yAxisTitle="Throughput [KB/s]">
<seriesCollection>
<series valueName="3" title="Inbound Network Traffic" color="#00FF00" average="10" averageColor="#008400" />
<series valueName="4" title="Outbound Network Traffic" color="#0000FF" average="10" averageColor="#000084" />
</seriesCollection>
</chart>
</charts>