Add profiler integration (#14856)

This commit is contained in:
J. Nick Koston 2020-10-05 08:57:26 -05:00 committed by GitHub
parent 3508166068
commit e9803f7371
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,35 @@
---
title: Profiler
description: Profile Home Assistant.
ha_category:
- Utility
ha_release: 0.117
ha_quality_scale: internal
ha_domain: profiler
---
The Profiler integration provides a profile which is a set of statistics that identifies how much time each part of Home Assistant is taking. It can help track down a performance issue or provide insight about a misbehaving integration.
## Configuration
To add `Profiler` to your installation, go to **Configuration** >> **Integrations** in the UI, click the button with `+` sign and from the list of integrations select **Profiler**.
### Service `profiler.start`
Start the profiler for the specified number of seconds.
| Service data attribute | Optional | Description |
| ---------------------- | -------- | ----------- |
| `seconds` | yes | The number of seconds to run the profile. Defaults to 60.0
When the profile is complete, Profiler will generate a Python `cprof` and a `callgrind.out` file in your configuration directory. The exact path to these files will appear in a persistent notification so they can be easily located and copied to your desktop.
The `cprof` file can be viewed with:
[SnakeViz](https://jiffyclub.github.io/snakeviz/)
[Gprof2dot](https://github.com/jrfonseca/gprof2dot)
Additionally, the profiler will generate a `callgrind.out` file that can be viewed with:
[kcachegrind](https://kcachegrind.github.io/) or qcachegrind