Class: QgsRuntimeProfiler¶
- class qgis.core.QgsRuntimeProfiler¶
Bases:
PyQt5.QtCore.QAbstractItemModel
Provides a method of recording run time profiles of operations, allowing easy recording of their overall run time.
QgsRuntimeProfiler
is not usually instantied manually, but rather accessed throughQgsApplication.profiler()
.This class is thread-safe only if accessed through
QgsApplication.profiler()
. If accessed in this way, operations can be profiled from non-main threads.QgsRuntimeProfiler() Constructor to create a new runtime profiler.
Warning
QgsRuntimeProfiler
is not usually instantied manually, but rather accessed throughQgsApplication.profiler()
.Methods
Returns the model as a multi-line text string.
Begin the group for the profiler.
Returns a list of all child groups with the specified
parent
.clear Clear all profile data.
- param parent:
- param index:
End the current profile event.
End the current active group.
Emitted when a new group has started being profiled.
Returns
True
if the specifiedgroup
is currently being logged, i.e. it has a entry which has started and not yet stopped.Returns the set of known groups.
- param section:
- param row:
- param child:
Returns the profile time for the specified
name
.Manually adds a profile event with the given name and total
time
(in seconds).- param parent:
Start a profile event with the given name.
The current total time collected in the profiler.
Returns the translated name of a standard profile
group
.- asText(self, group: str = '') str ¶
Returns the model as a multi-line text string.
- Parameters:
group (str = '') – A group name to filter the model against.
New in version 3.34.
- Return type:
str
- beginGroup(self, name: str)¶
Begin the group for the profiler. Groups will append {GroupName}/ to the front of the profile tag set using start.
- Parameters:
name (str) – The name of the group.
Deprecated since version use:
start()
instead
- beginInsertColumns(self, QModelIndex, int, int)¶
- beginInsertRows(self, QModelIndex, int, int)¶
- beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) bool ¶
- beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) bool ¶
- beginRemoveColumns(self, QModelIndex, int, int)¶
- beginRemoveRows(self, QModelIndex, int, int)¶
- beginResetModel(self)¶
- changePersistentIndex(self, QModelIndex, QModelIndex)¶
- changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])¶
- childEvent(self, QChildEvent)¶
- childGroups(self, parent: str = '', group: str = '') List[str] ¶
Returns a list of all child groups with the specified
parent
.New in version 3.14.
- Parameters:
parent (str = '') –
group (str = '') –
- Return type:
List[str]
- clear(self, group: str = '')¶
clear Clear all profile data.
- Parameters:
group (str = '') –
- columnCount(self, parent: QModelIndex = QModelIndex()) int ¶
- Parameters:
parent (QModelIndex = QModelIndex()) –
- Return type:
int
- connectNotify(self, QMetaMethod)¶
- createIndex(self, int, int, object: object = 0) QModelIndex ¶
- customEvent(self, QEvent)¶
- data(self, index: QModelIndex, role: int = Qt.DisplayRole) Any ¶
- Parameters:
index (QModelIndex) –
role (int = Qt.DisplayRole) –
- Return type:
Any
- decodeData(self, int, int, QModelIndex, QDataStream) bool ¶
- disconnectNotify(self, QMetaMethod)¶
- encodeData(self, Iterable[QModelIndex], QDataStream)¶
- end(self, group: str = '')¶
End the current profile event.
- Parameters:
group (str = '') –
- endInsertColumns(self)¶
- endInsertRows(self)¶
- endMoveColumns(self)¶
- endMoveRows(self)¶
- endRemoveColumns(self)¶
- endRemoveRows(self)¶
- endResetModel(self)¶
- groupAdded(self, group: str)¶
Emitted when a new group has started being profiled.
- Parameters:
group (str) –
- groupIsActive(self, group: str) bool ¶
Returns
True
if the specifiedgroup
is currently being logged, i.e. it has a entry which has started and not yet stopped.New in version 3.14.
- Parameters:
group (str) –
- Return type:
bool
- groups(self) Set[str] ¶
Returns the set of known groups.
- Return type:
Set[str]
- headerData(self, section: int, orientation: Qt.Orientation, role: int = Qt.DisplayRole) Any ¶
- Parameters:
section (int) –
orientation (Qt.Orientation) –
role (int = Qt.DisplayRole) –
- Return type:
Any
- index(self, row: int, column: int, parent: QModelIndex = QModelIndex()) QModelIndex ¶
- Parameters:
row (int) –
column (int) –
parent (QModelIndex = QModelIndex()) –
- Return type:
QModelIndex
- isSignalConnected(self, QMetaMethod) bool ¶
- parent(self, child: QModelIndex) QModelIndex ¶
- Parameters:
child (QModelIndex) –
- Return type:
QModelIndex
- persistentIndexList(self) List[QModelIndex] ¶
- profile¶
alias of
ScopedRuntimeProfileContextManager
- profileTime(self, name: str, group: str = '') float ¶
Returns the profile time for the specified
name
.New in version 3.14.
- Parameters:
name (str) –
group (str = '') –
- Return type:
float
- receivers(self, PYQT_SIGNAL) int ¶
- record(self, name: str, time: float, group: str = '', id: str = '')¶
Manually adds a profile event with the given name and total
time
(in seconds).The optional
id
argument can be used to provider a unique ID to disambiguate nodes with the samename
.New in version 3.34.
- Parameters:
name (str) –
time (float) –
group (str = '') –
id (str = '') –
- resetInternalData(self)¶
- rowCount(self, parent: QModelIndex = QModelIndex()) int ¶
- Parameters:
parent (QModelIndex = QModelIndex()) –
- Return type:
int
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- start(self, name: str, group: str = '', id: str = '')¶
Start a profile event with the given name. The
name
of the profile event. Will have the name of the activegroup
appended after ending.Since QGIS 3.34, the optional
id
argument can be used to provide a unique ID to disambiguate nodes with the samename
.- Parameters:
name (str) –
group (str = '') –
id (str = '') –
- timerEvent(self, QTimerEvent)¶
- totalTime(self, group: str = '') float ¶
The current total time collected in the profiler.
- Return type:
float
- Returns:
The current total time collected in the profiler.
- Parameters:
group (str = '') –
- translateGroupName(group: str) str ¶
Returns the translated name of a standard profile
group
.- Parameters:
group (str) –
- Return type:
str