---
title: XLAProfiler
description: >-
  XLA Profiler will help you debug and optimize training workload performance
  for your models using Cloud TPU

  performance tools.
canonical: >-
  https://lightning.ai/docs/pytorch/stable/optional-api/api/lightning.pytorch.profilers.XLAProfiler
---
# XLAProfiler {#xlaprofiler}

### `class lightning.pytorch.profilers.XLAProfiler(port=9012)` {#lightning.pytorch.profilers.XLAProfiler}

Bases: [`Profiler`](/docs/pytorch/2.6.6/optional-api/api/lightning.pytorch.profilers.Profiler.md#lightning.pytorch.profilers.Profiler "lightning.pytorch.profilers.profiler.Profiler")

XLA Profiler will help you debug and optimize training workload performance for your models using Cloud TPU performance tools.

Parameters:

**port** ([`int`](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")) – the port to start the profiler server on. An exception is raised if the provided port is invalid or busy.

#### `start(action_name)` {#lightning.pytorch.profilers.XLAProfiler.start}

Defines how to start recording an action.

Return type:

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

#### `stop(action_name)` {#lightning.pytorch.profilers.XLAProfiler.stop}

Defines how to record the duration once an action is complete.

Return type:

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

---

**Navigation**

- Parent: [Api](/docs/pytorch/2.6.6/optional-api/api.md)
