scenario.stats module

Common statistics.

class TimeStats

Bases: object

Common time statistics.

__init__()

Initializes the time statistics with None values.

_start

Start time, if specified.

_elapsed

Elapsed time, if specified.

_end

End time, if specified.

__str__()

Computes a string representation of the time interval in the ‘[%s - %s]’ form.

Returns:

String representation of the time interval.

property start

Start time getter.

property elapsed

Elapsed time getter.

property end

End time getter.

setstarttime()

Starts the time statistics with the current time.

setendtime()

Ends the time statistics with the current time.

tojson()

Converts the TimeStats instance into a JSON dictionary.

Returns:

JSON dictionary, with optional ‘start’, ‘end’ and ‘elapsed’ float fields, when the values are set.

static fromjson(json_data)

Builds a TimeStats instance from its JSON representation.

Parameters:

json_data – JSON dictionary, with optional ‘start’, ‘end’ and ‘elapsed’ float fields.

Returns:

New TimeStats instance.

class ExecTotalStats

Bases: object

Executable item statistics: number of executed items over a total count.

__init__()

Initializes the count statistics with 0.

total

Total count of executable items.

executed

Count of items executed.

__str__()

Computes a ‘%d’ or ‘%d/%d’ string representation of the statistics, depending on the args.Args.doc_only parameter.

Returns:

String representation of the statistics.

add(stats)

Integrates a tier ExecTotalStats instance into this one.

Parameters:

stats – Tier ExecTotalStats instance.

Returns:

Self (named parameter idiom).

Increments both executed and total counts with the tier’s values.

tojson()

Converts the ExecTotalStats instance into a JSON dictionary.

Returns:

JSON dictionary, with ‘executed’ and ‘total’ int fields.

static fromjson(json_data)

Builds a ExecTotalStats instance from its JSON representation.

Parameters:

json_data – JSON dictionary, with ‘executed’ and ‘total’ int fields.

Returns:

New ExecTotalStats instance.