---
title: "clika_runtime.profiler"
sidebar_label: "clika_runtime.profiler"
description: "The clika_runtime.profiler module, introspected from the installed wheel."
---

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

Profile ClikaRT compute work and export the results::

    import clika_runtime as crt

    with crt.profiler.profile("decode") as prof:
        y = (x @ w).relu()
    prof.export_chrome_trace("decode_trace.json")
    print(prof.summary())

While a capture is active, every op dispatched on the capturing thread
(and on the streams it drives) is timed automatically; no per-call
instrumentation is needed. Two timing notes:

- Async work a capture covered may finish after the block ends; its
  spans still record into the session. Synchronize before reading or
  saving so those late spans are included.
- ``crt.trace`` runs a callable once on data-free stand-ins (no kernels
  execute), so profiling around a trace call times the capture itself.
  Profile around ``graph.run(...)`` or a compiled call instead; those
  execute real ops.

The raw session/capture types are available as
:class:`~clika_runtime.profiler.ProfileSession` and
:class:`~clika_runtime.profiler.CaptureScope` for multi-capture flows.

| Name | Kind |
| --- | --- |
| [`CaptureScope`](./CaptureScope.md) | class |
| [`ProfileSession`](./ProfileSession.md) | class |
| [`profile`](./profile.md) | class |