# Profiling

AppFlowy uses [tokio-console](https://github.com/tokio-rs/console) to debug the Rust backend. It would be very useful when having the high CPU usage issues.

## Prerequisites

Install the tokio-console by running the following command

```shell
cargo install --locked tokio-console
```

and run locally

```shell
tokio-console
```

## Enable profiling

The `flowy-core` crate has a feature called `profiling`. Just enable this feature in the cargo.toml.

### Profiling with Tauri

![img.png](/files/qLHZvnlUQ8RqeenTfouv)

The profiling data will be displayed in terminal after the application run.

![img.png](/files/MGv8E6kIRsoCq7zFsRib)

### Profiling with Flutter

Using [Xcode instruments](https://github.com/cmyr/cargo-instruments) to profile the backend.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.appflowy.io/docs/documentation/software-contributions/architecture/backend/profiling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
