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

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

A profiling session: start one or more captures, run work, then export the results. Keep the session alive past any async work a capture covered; synchronize before reading or saving so late worker spans are included.

## `__init__`

```python
__init____init__(self) -> None
```

__init__(self) -> None

ProfileSession()

An empty session.

## `chrome_trace_json`

```python
chrome_trace_jsonchrome_trace_json(self) -> str
```

chrome_trace_json(self) -> str

chrome_trace_json()

Snapshot the current results as a Chrome-tracing JSON string.

## `perfetto_trace`

```python
perfetto_traceperfetto_trace(self) -> bytes
```

perfetto_trace(self) -> bytes

perfetto_trace()

Snapshot the current results as Perfetto protobuf bytes.

## `save`

```python
savesave(self, dir: str) -> None
```

save(self, dir: str) -> None

save(dir)

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

## `save_chrome_trace`

```python
save_chrome_tracesave_chrome_trace(self, path: str) -> None
```

save_chrome_trace(self, path: str) -> None

save_chrome_trace(path)

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

## `save_memory_stats`

```python
save_memory_statssave_memory_stats(self, path: str) -> None
```

save_memory_stats(self, path: str) -> None

save_memory_stats(path)

Write the memory-stats JSON to path.

## `save_report_json`

```python
save_report_jsonsave_report_json(self, path: str) -> None
```

save_report_json(self, path: str) -> None

save_report_json(path)

Write the full report JSON to path.

## `start_capture`

```python
start_capturestart_capture(self, tag: str = 'default') -> clika_runtime._core.profiler.CaptureScope
```

start_capture(self, tag: str = 'default') -> clika_runtime._core.profiler.CaptureScope

start_capture(tag='default')

Begin a capture region named tag; returns the CaptureScope that ends it.

## `summary_text`

```python
summary_textsummary_text(self) -> str
```

summary_text(self) -> str

summary_text()

Snapshot the current results as a per-op text summary.
