Class: QgsRuntimeProfiler

class qgis.core.QgsRuntimeProfiler

Bases: PyQt5.QtCore.QAbstractItemModel

Constructor to create a new runtime profiler.

Warning

QgsRuntimeProfiler is not usually instantied manually, but rather accessed through QgsApplication.profiler().

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.

Methods

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

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.

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

QgsRuntimeProfiler.beginInsertColumns(self, QModelIndex, int, int)
QgsRuntimeProfiler.beginInsertRows(self, QModelIndex, int, int)
QgsRuntimeProfiler.beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
QgsRuntimeProfiler.beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
QgsRuntimeProfiler.beginRemoveColumns(self, QModelIndex, int, int)
QgsRuntimeProfiler.beginRemoveRows(self, QModelIndex, int, int)
beginResetModel(self)
QgsRuntimeProfiler.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)
QgsRuntimeProfiler.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

QgsRuntimeProfiler.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 qgis.core.additions.runtimeprofiler.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
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 = '')

Start a profile event with the given name.

Parameters
  • name (str) – The name of the profile event. Will have the name of the active group appended after ending.

  • group (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