You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Service {% my developer_call_service service="profiler.memory" %}
55
55
56
56
<divclass='note warning'>
57
57
This service is unavailable when using Python 3.11 as the underlying guppy3 library does not yet support Python 3.11.
@@ -73,7 +73,7 @@ from guppy import hpy
73
73
hpy().pb()
74
74
```
75
75
76
-
### Service `profiler.start_log_objects`
76
+
### Service {% my developer_call_service service="profiler.start_log_objects" %}
77
77
78
78
Start logging the growth of objects in memory.
79
79
@@ -83,11 +83,11 @@ Start logging the growth of objects in memory.
83
83
84
84
Periodically log the growth of new objects in memory. This service's primary use case is finding memory leaks. This service can be run for long periods to find slow leaks. For finding fast leaks, `profiler.start_log_object_sources` is preferred; however, it is much more CPU intensive.
85
85
86
-
### Service `profiler.stop_log_objects`
86
+
### Service {% my developer_call_service service="profiler.stop_log_objects" %}
87
87
88
88
Stop logging the growth of objects in memory.
89
89
90
-
### Service `profiler.start_log_object_sources`
90
+
### Service {% my developer_call_service service="profiler.start_log_object_sources" %}
91
91
92
92
Start logging the growth of objects in memory and attempt to find the source of the new objects.
93
93
@@ -100,19 +100,32 @@ Periodically log the growth of new objects in memory. This service's primary use
100
100
101
101
This service is similar to `start_log_objects` except that it is much more CPU intensive since it will attempt to locate the source of each new object up to `max_objects` each time it logs.
102
102
103
-
### Service `profiler.stop_log_object_sources`
103
+
### Service {% my developer_call_service service="profiler.stop_log_object_sources" %}
104
104
105
105
Stop logging the growth of objects with sources in memory.
106
106
107
-
### Service `profiler.dump_log_objects`
107
+
### Service {% my developer_call_service service="profiler.dump_log_objects" %}
108
108
109
109
| Service data attribute | Optional | Description |
| `type` | no | The type of object to dump to the log.
112
112
113
113
When `start_log_objects` highlights the growth of a collection of objects in memory, this service can help investigate. The `repr` of each object that matches `type` will be logged.
114
114
115
-
### Service `profiler.log_thread_frames`
115
+
This service is useful for investigating the state of objects in memory. For example, if your system has templates that are rendering too frequently, the below example service calls shows how to find which templates are the source of the problem:
116
+
117
+
```yaml
118
+
service: profiler.dump_log_objects
119
+
data:
120
+
type: RenderInfo
121
+
```
122
+
```yaml
123
+
service: profiler.dump_log_objects
124
+
data:
125
+
type: Template
126
+
```
127
+
128
+
### Service {% my developer_call_service service="profiler.log_thread_frames" %}
116
129
117
130
To help discover run away threads, why the executor is overloaded, or other threading problems, the current frames for each running thread will be logged when this service is called.
118
131
@@ -147,14 +160,14 @@ An example is below:
147
160
sock.connect(address)
148
161
```
149
162
150
-
### Service `profiler.log_event_loop_scheduled`
163
+
### Service {% my developer_call_service service="profiler.log_event_loop_scheduled" %}
151
164
152
165
Log what is scheduled in the event loop. This can be helpful in tracking down integrations that do not stop listeners when Home Assistant stops or do not have sufficient locking to avoid scheduling updates before the previous update is finished.
153
166
154
167
Each upcoming scheduled item is logged similar to the below example:
155
168
156
169
`[homeassistant.components.profiler] Scheduled: <TimerHandle when=1528307.1818668307 async_track_point_in_utc_time.<locals>.run_action(<Job HassJobType.Coroutinefunction <bound method DataUpdateCoordinator._handle_refresh_interval of <homeassistant.components.screenlogic.ScreenlogicDataUpdateCoordinator object at 0x7f985d896d30>>>) at /usr/src/homeassistant/homeassistant/helpers/event.py:1175>`
157
170
158
-
### Service `profiler.lru_stats`
171
+
### Service {% my developer_call_service service="profiler.lru_stats" %}
159
172
160
173
Logs statistics from [lru_cache](https://docs.python.org/3/library/functools.html#functools.lru_cache) and [lru-dict](https://pypi.org/project/lru-dict/) to help tune Home Assistant and locate memory leaks.
0 commit comments