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)
- 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 Preview Render with Profiling.
- Since:
Katana 6.0v1
- CATEGORICAL_FIELDS = (Field.OP_ID, Field.OP_NAME, Field.OP_TYPE, Field.NODE_NAME, Field.NODE_TYPE)
- class Field(value)
Bases:
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,)
- class Record(data: dict)
Bases:
object
A profile results record or aggregate record.
- Parameters:
data (
dict
)
- __init__(data: dict)
Initializes an instance of the class.
- Parameters:
data (
dict
) – The underlying dictionary that contains the data.data
- property cpuTime: float | None
- Return type:
float
, orNone
- Returns:
The CPU time in the record.
- get(key, default=None) Any
- Return type:
Any
- property nodeName: str | MixedValueType | None
- Return type:
str
,MixedValue
, orNone
- Returns:
The node name in the record.
- property nodeType: str | MixedValueType | None
- Return type:
str
,MixedValue
, orNone
- Returns:
The node type in the record.
- property opId: int | MixedValueType | None
- Return type:
int
,MixedValue
, orNone
- Returns:
The Op ID in the record.
- property opName: str | MixedValueType | None
- Return type:
str
,MixedValue
, orNone
- Returns:
The Op name in the record.
- property opType: str | MixedValueType | None
- Return type:
str
,MixedValue
, orNone
- Returns:
The Op type in the record.
- __init__()
Initializes an instance of the class.
- property cpuTime: float | None
- Return type:
float
orNone
- 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) ProfileResults
Loads the profile results file.
- Return type:
- Parameters:
filepath (
str
) – Path to the profile results file.filepath
- Returns:
The newly created instance with the data loaded.
- Return type:
- classmethod fromString(content: str) ProfileResults
Parses the provided data and creates an instance of the
ProfileResults
class.- Return type:
- Parameters:
content (
str
) – Content of the profile results file.content
- Returns:
The newly created instance with the data loaded.
- Return type:
- getRecords(groupBy: Field | None = None, sortBy: Field | None = None) tuple[Record]
Gets the rows from the results object, optionally grouped and/or sorted by a field.
- Return type:
tuple
ofProfileResults.Record
- Parameters:
- Returns:
A tuple containing the records.
- Raises:
ValueError – If the field provided in
groupBy
is not a categorical field. SeeProfileResults.CATEGORICAL_FIELDS
.- Return type:
tuple
[Record
]
- property opCount: int | None
- Return type:
int
orNone
- 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: float | None
- Return type:
float
orNone
- 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.