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 through QgsApplication.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 through QgsApplication.profiler().

Methods

asText

Returns the model as a multi-line text string.

beginGroup

Begin the group for the profiler.

beginInsertColumns

beginInsertRows

beginMoveColumns

beginMoveRows

beginRemoveColumns

beginRemoveRows

beginResetModel

changePersistentIndex

changePersistentIndexList

childEvent

childGroups

Returns a list of all child groups with the specified parent.

clear

clear Clear all profile data.

columnCount

param parent:

connectNotify

createIndex

customEvent

data

param index:

decodeData

disconnectNotify

encodeData

end

End the current profile event.

endGroup

End the current active group.

endInsertColumns

endInsertRows

endMoveColumns

endMoveRows

endRemoveColumns

endRemoveRows

endResetModel

groupAdded

Emitted when a new group has started being profiled.

groupIsActive

Returns True if the specified group is currently being logged, i.e. it has a entry which has started and not yet stopped.

groups

Returns the set of known groups.

headerData

param section:

index

param row:

isSignalConnected

parent

param child:

persistentIndexList

profileTime

Returns the profile time for the specified name.

receivers

record

Manually adds a profile event with the given name and total time (in seconds).

resetInternalData

rowCount

param parent:

sender

senderSignalIndex

start

Start a profile event with the given name.

timerEvent

totalTime

The current total time collected in the profiler.

translateGroupName

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 = '') –

endGroup(self)

End the current active group.

Deprecated since version use: end() instead

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 specified group 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 same name.

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 active group appended after ending.

Since QGIS 3.34, the optional id argument can be used to provide a unique ID to disambiguate nodes with the same name.

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