---
title: thunder.common.CompileStats
description: A class holding statistics and caches for a compiled function.
canonical: >-
  https://lightning.ai/docs/thunder/stable/api-reference/generated/thunder.common.CompileStats
---
# thunder.common.CompileStats {#thunder-common-compilestats}

### `class thunder.common.CompileStats` {#thunder.common.CompileStats}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py#L65-L173)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object "(in Python v3.15)")

A class holding statistics and caches for a compiled function.

Note

It is highly recommended that some attributes such as [`CompileStats.last_traces`](#thunder.common.CompileStats.last_traces "thunder.common.CompileStats.last_traces") and [`CompileStats.last_backward_traces`](#thunder.common.CompileStats.last_backward_traces "thunder.common.CompileStats.last_backward_traces") via [`thunder.last_traces()`](/docs/thunder/generated/thunder.last_traces#thunder.last_traces "thunder.last_traces") and [`thunder.last_backward_traces()`](/docs/thunder/generated/thunder.last_backward_traces#thunder.last_backward_traces "thunder.last_backward_traces"), respectively. See [`thunder`](/docs/thunder/thunder#module-thunder "thunder") for more of such utility functions.

#### `last_computation` {#thunder.common.CompileStats.last_computation}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

Callable

#### `last_traces` {#thunder.common.CompileStats.last_traces}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

Sequence\[[TraceCtx](/docs/thunder/core/generated/thunder.core.trace.TraceCtx#thunder.core.trace.TraceCtx "thunder.core.trace.TraceCtx")\]

#### `last_prologue` {#thunder.common.CompileStats.last_prologue}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[TraceCtx](/docs/thunder/core/generated/thunder.core.trace.TraceCtx#thunder.core.trace.TraceCtx "thunder.core.trace.TraceCtx")

#### `last_prologue_traces` {#thunder.common.CompileStats.last_prologue_traces}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

Sequence\[[TraceCtx](/docs/thunder/core/generated/thunder.core.trace.TraceCtx#thunder.core.trace.TraceCtx "thunder.core.trace.TraceCtx")\]

#### `last_interpreted_instructions` {#thunder.common.CompileStats.last_interpreted_instructions}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

Generator\[dist.Instruction, None, None\] | None

#### `last_interpreter_log` {#thunder.common.CompileStats.last_interpreter_log}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[list](https://docs.python.org/3/builtins/stdtypes.html#list "(in Python v3.15)")\[InterpreterLogItem\] | None

#### `last_backward_traces` {#thunder.common.CompileStats.last_backward_traces}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

Sequence\[[TraceCtx](/docs/thunder/core/generated/thunder.core.trace.TraceCtx#thunder.core.trace.TraceCtx "thunder.core.trace.TraceCtx")\]

#### `last_trace_host_start` {#thunder.common.CompileStats.last_trace_host_start}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `last_trace_host_stop` {#thunder.common.CompileStats.last_trace_host_stop}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `last_trace_cache_start` {#thunder.common.CompileStats.last_trace_cache_start}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `last_trace_cache_stop` {#thunder.common.CompileStats.last_trace_cache_stop}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `last_trace_tracing_start` {#thunder.common.CompileStats.last_trace_tracing_start}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `last_trace_tracing_stop` {#thunder.common.CompileStats.last_trace_tracing_stop}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `last_trace_host_execution_start` {#thunder.common.CompileStats.last_trace_host_execution_start}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `last_trace_host_execution_stop` {#thunder.common.CompileStats.last_trace_host_execution_stop}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `last_prologue_transformation_start` {#thunder.common.CompileStats.last_prologue_transformation_start}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `last_prologue_transformation_stop` {#thunder.common.CompileStats.last_prologue_transformation_stop}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `last_prologue_execution_start` {#thunder.common.CompileStats.last_prologue_execution_start}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `last_prologue_execution_stop` {#thunder.common.CompileStats.last_prologue_execution_stop}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `last_computation_execution_start` {#thunder.common.CompileStats.last_computation_execution_start}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `last_computation_execution_stop` {#thunder.common.CompileStats.last_computation_execution_stop}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `cache` {#thunder.common.CompileStats.cache}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[dict](https://docs.python.org/3/builtins/stdtypes.html#dict "(in Python v3.15)")

#### `interpreter_cache` {#thunder.common.CompileStats.interpreter_cache}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[list](https://docs.python.org/3/builtins/stdtypes.html#list "(in Python v3.15)")

#### `calls` {#thunder.common.CompileStats.calls}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `cache_hits` {#thunder.common.CompileStats.cache_hits}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `cache_misses` {#thunder.common.CompileStats.cache_misses}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[int](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `last_compile_reasons` {#thunder.common.CompileStats.last_compile_reasons}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py)

Type:

[dict](https://docs.python.org/3/builtins/stdtypes.html#dict "(in Python v3.15)")

#### `__init__()` {#thunder.common.CompileStats.__init__}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/common.py#L104-L141)

Methods

- [`__init__()`](#thunder.common.CompileStats.__init__)
- `last_cache_lookup_time()` — rtype:int
- `last_computation_execution_time()` — rtype:int
- `last_prologue_execution_time()` — rtype:int
- `last_prologue_transformation_time()` — rtype:int
- `last_trace_construction_time()` — rtype:int

---

**Navigation**

- Parent: [Generated](/docs/thunder/0.2.6/api-reference/generated.md)
