Stats
The stats tag is capable of calculating some statistical
analysis over the events identified in the result set of the
attribute cursor
. The calculated statistics are
thrown as events to be used by the testcase as it best sees fit.
Events
cursor Event
csv_dur
This property contains a CSV contents for all of the
latencies for the events sampled including the number
of times it occurred like so:
23,455
50,412
100,20
Where the first column is the latency (duration in ms)
and the second column is the number of events that had
this duration. With this you can easily generate a
graph using gnuplot, with the following gnuplot script
and having outputted the property into a file called
"latency.data":
set title "Latency graph of some sample data"
set xdata time
set timefmt "%s"
set terminal png
set output "graph.png"
set xlabel 'Number of events'
set ylabel 'Duration (ms)'
plot 'latency.data' using 1:2 with linespoints title 'latencies'
You can also easily import the CSV file into your
favorite spreadsheet software and generate any graphs
you'd like.
MONITOR_states
Generated only when you have used the monitor attribute
and will contain a comma separated list of the various
states that specific field had. the MONITOR name is
replaced with the name of the fields you were monitoring.
max_dur
The maximum duration of any event in milliseconds
recorded will be saved in this attribute.
avg_dur
The average duration of any event in milliseconds
recorded will be saved in this attribute.
tot_dur
The total duration of any event in milliseconds recorded
will be saved in this attribute.
tot_occ
The total occurrences of this event will be saved in
this attribute.
min_dur
The minimum duration of any event in milliseconds
recorded will be saved in this attribute.
avg_occ
The number of occurrences of this event per second over
the duration of all events is recorded in this attribute.
cursor.FIELD_VALUE Event
avg_int
this event will be generated for every FIELD in the
monitors attribute and it will have the format
FIELD_VALUE.avg_int being that the VALUE is one of the
various values that FIELD had. So for each VALUE that
the FIELD can assume there will be another event
generated containing the average amount of time that the
specified field was in the VALUE state.
min_int
this event will be generated for every FIELD in the
monitors attribute and it will have the format
FIELD_VALUE.min_int being that the VALUE is one of the
various values that FIELD had. So for each VALUE that
the FIELD can assume there will be another event
generated containing the minimum interval during which
that VALUE occurred without any changes.
max_int
this event will be generated for every FIELD in the
monitors attribute and it will have the format
FIELD_VALUE.max_int being that the VALUE is one of the
various values that field had. So for each VALUE that
the FIELD can assume there will be another event
generated containing the maximum interval during which
that VALUE occurred without any changes.
tot_int
this event will be generated for every FIELD in the
monitors attribute and it will have the format
FIELD_VALUE.avg_int being that the VALUE is one of the
various values that FIELD had. So for each VALUE that
the FIELD can assume there will be another event
generated containing the total amount of time that the
specified field was in the VALUE state.
cursor.fieldname Event
tot_val
Each field of the specified event that is of a number
type will have its total value calculated and recorded
in this attribute.
max_val
Each field of the specified event that is of a number
type will have its maximum value calculated and recorded
in this attribute.
avg_val
Each field of the specified event that is of a number
type will have its average value calculated and recorded
in this attribute.
min_val
Each field of the specified event that is of a number
type will have its minimum value calculated and recorded
in this attribute.
Required Attributes
cursor
Identifies the cursor to use when calculating statistics.
event
Specifies the event name to attach the statistics that
are calculated.
Usage Examples
Example #1
<script xmlns="http://dtf.org/v1">
<query cursor="cursor1" event="dtf.event" type="${recorder.type}" uri="storage://OUTPUT/${recorder.filename}">
<where>
<eq op1="runid" op2="${runid}" />
</where>
</query>
<record type="object" uri="property://txtrecorder">
<stats cursor="cursor1" event="stats" />
</record></script>
Example #2
<script xmlns="http://dtf.org/v1">
<query cursor="cursor1" event="dtf.event" type="${recorder.type}" uri="storage://OUTPUT/${recorder.filename}" />
<record type="object" uri="property://txtrecorder">
<stats cursor="cursor1" event="stats" />
</record></script>