> For the complete documentation index, see [llms.txt](https://webside.gitbook.io/webside/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://webside.gitbook.io/webside/api/profilers.md).

# Profilers

A profiler is just a process observing another with the purpose of gathering statistics about executed code.\
In this sense, the API proposes to treat a profiler as an asynchronous evaluation (see [\evaluations](/webside/api/evaluations/post.md#asyncrhonous-evaluations) for more information).\
The proposed workflow is the following:

1. Issue a profiler, either by a `POST` to `/profilers`, or by using `profile=true` on a `POST` to `/evaluations` (see [evaluations](/webside/api/evaluations/post.md)).
2. Follow the progress of the profiler by polling `/profilers/{id}` with profiler's ID (much as an evaluation progress is followed)
3. Once the profiler state is `finished`, results can be retrieved from `/profilers/{id}/tree` and `/profilers/{id}/ranking`.

Endpoints to manage profilers and access their results.

| Method | Path                                                       | Description                                      | Parameters | Payload      |
| :----: | ---------------------------------------------------------- | ------------------------------------------------ | :--------: | ------------ |
|  POST  | [/profilers](/webside/api/profilers/post.md)               | Create a new profiler on a given expression      |      -     | `expression` |
|   GET  | [/profilers](/webside/api/profilers/get.md)                | Retrieve active profilers                        |      -     | -            |
|   GET  | [/profilers/{id}](/webside/api/profilers/get-1.md)         | Retrieve the profiler with a given ID            |      -     | -            |
|   GET  | [/profilers/{id}/tree](/webside/api/profilers/get-3.md)    | Retrieve a tree-like results of a given profiler |      -     | -            |
|   GET  | [/profilers/{id}/ranking](/webside/api/profilers/get-2.md) | Retrieve ranked results of a given profiler      |      -     | -            |
| DELETE | [/profilers/{id}](/webside/api/profilers/delete.md)        | Delete a given profiler                          |      -     | -            |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://webside.gitbook.io/webside/api/profilers.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.
