---
title: "profile"
sidebar_label: "profile"
description: "The clika_runtime.profiler profile class."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

One session with one named capture, scoped to a ``with`` block.

    The capture ends when the block exits; the session stays readable on
    the returned object, so exports and summaries run after the block::

        with crt.profiler.profile("step") as prof:
            run_model()
        prof.save("profile_out")
    

## `__init__`

```python
__init__(self, name: 'str' = 'default') -> 'None'
```

Initialize self.  See help(type(self)) for accurate signature.

## `add_marker`

```python
add_marker(self, label: 'str') -> 'None'
```

Drop a named instant event at this point; the capture must be
active (inside the ``with`` block).

## `export_chrome_trace`

```python
export_chrome_trace(self, path: 'PathLike') -> 'None'
```

Write the Chrome-tracing timeline JSON to ``path`` (open it in
``chrome://tracing`` or Perfetto).

## `save`

```python
save(self, dir: 'PathLike') -> 'None'
```

Write the standard set into ``dir`` (created if missing):
``chrome_trace.json``, ``report.json``, ``memory_stats.json``,
``summary.txt``.

## `summary`

```python
summary(self) -> 'str'
```

The per-op text summary of everything captured so far.
