Profile Results

New in Katana 6

Module that contains functions and definitions for handling profile results.

class Performance.ProfileResults.MixedValueType(*args, **kwargs)

Bases: object

Singleton class that represents an unspecified value that is the result of a number of mixed values.

static __new__(cls, *args, **kwargs)

Create and return a new object. See help(type) for accurate signature.

class Performance.ProfileResults.ProfileResults

Bases: object

A container of the results of a profiling session.

These files are the JSON documents generated as a result of a B{Preview Render with Profiling}.

Since

Katana 6.0v1

CATEGORICAL_FIELDS = (<Field.OP_ID: 'opId'>, <Field.OP_NAME: 'opName'>, <Field.OP_TYPE: 'opType'>, <Field.NODE_NAME: 'nodeName'>, <Field.NODE_TYPE: 'nodeType'>)
class Field(value)

Bases: enum.Enum

Available fields in every record.

OP_ID = 'opId'
OP_NAME = 'opName'
OP_TYPE = 'opType'
NODE_NAME = 'nodeName'
NODE_TYPE = 'nodeType'
CPU_TIME = 'cpuTime'
QUANTITATIVE_FIELDS = (<Field.CPU_TIME: 'cpuTime'>,)
class Record(data: dict)

Bases: object

A profile results record or aggregate record.

__init__(data: dict)

Initializes an instance of the class.

Parameters

data (dict) – The underlying dictionary that contains the data.

property cpuTime: Optional[float]
Return type

float, or None

Returns

The CPU time in the record.

property nodeName: Optional[Union[str, Performance.ProfileResults.MixedValueType]]
Return type

str, MixedValue, or None

Returns

The node name in the record.

property nodeType: Optional[Union[str, Performance.ProfileResults.MixedValueType]]
Return type

str, MixedValue, or None

Returns

The node type in the record.

property opId: Optional[Union[int, Performance.ProfileResults.MixedValueType]]
Return type

int, MixedValue, or None

Returns

The Op ID in the record.

property opName: Optional[Union[str, Performance.ProfileResults.MixedValueType]]
Return type

str, MixedValue, or None

Returns

The Op name in the record.

property opType: Optional[Union[str, Performance.ProfileResults.MixedValueType]]
Return type

str, MixedValue, or None

Returns

The Op type in the record.

__init__()

Initializes an instance of the class.

property cpuTime: Optional[float]
Return type

float or None

Returns

The accumulated CPU time (in seconds) of each of the cooked locations, as defined in the profile results file. If not available, None is returned. This value is equivalent to the sum of the cook time of every cooked location.

classmethod fromFile(filepath: str)Performance.ProfileResults.ProfileResults

Loads the profile results file.

Return type

ProfileResults

Parameters

filepath (str) – Path to the profile results file.

Returns

The newly created instance with the data loaded.

classmethod fromString(content: str)Performance.ProfileResults.ProfileResults

Parses the provided data and creates an instance of the ProfileResults class.

Return type

ProfileResults

Parameters

content (str) – Content of the profile results file.

Returns

The newly created instance with the data loaded.

getRecords(groupBy: Optional[Performance.ProfileResults.ProfileResults.Field] = None, sortBy: Optional[Performance.ProfileResults.ProfileResults.Field] = None)tuple

Gets the rows from the results object, optionally grouped and/or sorted by a field.

Return type

tuple of ProfileResults.Record

Parameters
Returns

A tuple containing the records.

Raises

ValueError – If the field provided in groupBy is not a categorical field. See ProfileResults.CATEGORICAL_FIELDS.

property opCount: Optional[int]
Return type

int or None

Returns

The number of Ops in the Op Tree in the profiling session. If the value is not defined in the profile results file, None is returned. This value generally matches the number of records in the file when grouped by Op ID or Op name, provided that no Op has not been collapsed as part of the Op Tree optimizations.

property wallTime: Optional[float]
Return type

float or None

Returns

The total time (in seconds) between the profiling session start and the profiling session end. If the value is not defined in the profile results file, None is returned.