Class: QgsRuntimeProfiler¶
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.
Class Hierarchy¶
Base classes¶
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. |
|
End the current profile event. |
|
End the current active group. |
|
Emitted when a new group has started being profiled. |
|
Returns |
|
Returns the set of known groups. |
|
Returns the profile time for the specified name. |
|
Manually adds a profile event with the given name and total time (in seconds). |
|
Start a profile event with the given name. |
|
The current total time collected in the profiler. |
Static Methods
Returns the translated name of a standard profile group. |
- class qgis.core.QgsRuntimeProfiler[source]¶
Bases:
QAbstractItemModel
- __init__()
Constructor to create a new runtime profiler.
Warning
QgsRuntimeProfiler is not usually instantied manually, but rather accessed through
QgsApplication.profiler()
.
- asText(self, group: str | None = '') str [source]¶
Returns the model as a multi-line text string.
- Parameters:
group (Optional[str] = '') – A group name to filter the model against.
Added in version 3.34.
- Return type:
str
- beginGroup(self, name: str | None)[source]¶
Begin the group for the profiler. Groups will append {GroupName}/ to the front of the profile tag set using start.
- Parameters:
name (Optional[str]) – The name of the group.
Deprecated since version 3.40: Use
start()
instead.
- childGroups(self, parent: str | None = '', group: str | None = '') List[str] [source]¶
Returns a list of all child groups with the specified
parent
.Added in version 3.14.
- Parameters:
parent (Optional[str] = '')
group (Optional[str] = '')
- Return type:
List[str]
- clear(self, group: str | None = '')[source]¶
clear Clear all profile data.
- Parameters:
group (Optional[str] = '')
- end(self, group: str | None = '')[source]¶
End the current profile event.
- Parameters:
group (Optional[str] = '')
- endGroup(self)[source]¶
End the current active group.
Deprecated since version 3.40: Use
end()
instead.
- groupAdded(self, group: str | None)[source]¶
Emitted when a new group has started being profiled.
- Parameters:
group (Optional[str])
- groupIsActive(self, group: str | None) bool [source]¶
Returns
True
if the specifiedgroup
is currently being logged, i.e. it has a entry which has started and not yet stopped.Added in version 3.14.
- Parameters:
group (Optional[str])
- Return type:
bool
- groups(self) Set[str] ¶
Returns the set of known groups.
- Return type:
Set[str]
- profile¶
alias of
ScopedRuntimeProfileContextManager
- profileTime(self, name: str | None, group: str | None = '') float [source]¶
Returns the profile time for the specified
name
.Added in version 3.14.
- Parameters:
name (Optional[str])
group (Optional[str] = '')
- Return type:
float
- record(self, name: str | None, time: float, group: str | None = '', id: str | None = '')[source]¶
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
.Added in version 3.34.
- Parameters:
name (Optional[str])
time (float)
group (Optional[str] = '')
id (Optional[str] = '')
- start(self, name: str | None, group: str | None = '', id: str | None = '')[source]¶
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 (Optional[str])
group (Optional[str] = '')
id (Optional[str] = '')