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
, orNone
- Returns
The CPU time in the record.
- property nodeName: Optional[Union[str, Performance.ProfileResults.MixedValueType]]¶
- Return type
str
,MixedValue
, orNone
- Returns
The node name in the record.
- property nodeType: Optional[Union[str, Performance.ProfileResults.MixedValueType]]¶
- Return type
str
,MixedValue
, orNone
- Returns
The node type in the record.
- property opId: Optional[Union[int, Performance.ProfileResults.MixedValueType]]¶
- Return type
int
,MixedValue
, orNone
- Returns
The Op ID in the record.
- property opName: Optional[Union[str, Performance.ProfileResults.MixedValueType]]¶
- Return type
str
,MixedValue
, orNone
- Returns
The Op name in the record.
- property opType: Optional[Union[str, Performance.ProfileResults.MixedValueType]]¶
- Return type
str
,MixedValue
, orNone
- Returns
The Op type in the record.
- __init__()¶
Initializes an instance of the class.
- property cpuTime: Optional[float]¶
- 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) → Performance.ProfileResults.ProfileResults¶
Loads the profile results file.
- Return type
- 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
- 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
ofProfileResults.Record
- Parameters
groupBy (
ProfileResults.Field
, orNone
) – The field to group the records by.sortBy (
ProfileResults.Field
, orNone
) – The field to sort the records by.
- Returns
A tuple containing the records.
- Raises
ValueError – If the field provided in
groupBy
is not a categorical field. SeeProfileResults.CATEGORICAL_FIELDS
.
- property opCount: Optional[int]¶
- 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: Optional[float]¶
- 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.