> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/plugins/api-plugin/stage_instrumentation.md).

# Stage Instrumentation

Macros that register statement execution stages, set the current stage, and report stage progress (work completed and work estimated) to the Performance Schema.

> [`Instrumentation Interface`](/docs/server/reference/plugins/api-plugin/instrumentation_interface.md)

## Macros

| Name                                                                | Description                                                                           |
| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| [`mysql_stage_register`](#mysql_stage_register)                     | Stage registration.                                                                   |
| [`MYSQL_SET_STAGE`](#mysql_set_stage)                               | Set the current stage. Use this API when the file and line is passed from the caller. |
| [`mysql_set_stage`](#mysql_set_stage-1)                             | Set the current stage.                                                                |
| [`mysql_end_stage`](#mysql_end_stage)                               | End the last stage                                                                    |
| [`mysql_stage_set_work_completed`](#mysql_stage_set_work_completed) |                                                                                       |
| [`mysql_stage_get_work_completed`](#mysql_stage_get_work_completed) |                                                                                       |
| [`mysql_stage_inc_work_completed`](#mysql_stage_inc_work_completed) |                                                                                       |
| [`mysql_stage_set_work_estimated`](#mysql_stage_set_work_estimated) |                                                                                       |
| [`mysql_stage_get_work_estimated`](#mysql_stage_get_work_estimated) |                                                                                       |

***

### mysql\_stage\_register

```cpp
#define mysql_stage_register(P1, P2, P3, P1, P2, P3) do {} while (0)
```

Defined in psi/mysql\_stage.h:51

Stage registration.

***

### MYSQL\_SET\_STAGE

```cpp
#define MYSQL_SET_STAGE(K, F, L, K, F, L) NULL
```

Defined in psi/mysql\_stage.h:69

Set the current stage. Use this API when the file and line is passed from the caller.

#### Returns

the current stage progress

#### Parameters

| Parameter | Type | Description          |
| --------- | ---- | -------------------- |
| `K`       |      | the stage key        |
| `F`       |      | the source file name |
| `L`       |      | the source file line |
| `K`       |      | the stage key        |
| `F`       |      | the source file name |
| `L`       |      | the source file line |

***

### mysql\_set\_stage

```cpp
#define mysql_set_stage(K, K) NULL
```

Defined in psi/mysql\_stage.h:83

Set the current stage.

#### Returns

the current stage progress

#### Parameters

| Parameter | Type | Description   |
| --------- | ---- | ------------- |
| `K`       |      | the stage key |
| `K`       |      | the stage key |

***

### mysql\_end\_stage

```cpp
#define mysql_end_stage() do {} while (0)
```

Defined in psi/mysql\_stage.h:95

End the last stage

***

### mysql\_stage\_set\_work\_completed

```cpp
#define mysql_stage_set_work_completed(P1, P2, P1, P2) do {} while (0)
```

Defined in psi/mysql\_stage.h:131

***

### mysql\_stage\_get\_work\_completed

```cpp
#define mysql_stage_get_work_completed(P1, P1) do {} while (0)
```

Defined in psi/mysql\_stage.h:134

***

### mysql\_stage\_inc\_work\_completed

```cpp
#define mysql_stage_inc_work_completed(P1, P2, P1, P2) do {} while (0)
```

Defined in psi/mysql\_stage.h:142

***

### mysql\_stage\_set\_work\_estimated

```cpp
#define mysql_stage_set_work_estimated(P1, P2, P1, P2) do {} while (0)
```

Defined in psi/mysql\_stage.h:153

***

### mysql\_stage\_get\_work\_estimated

```cpp
#define mysql_stage_get_work_estimated(P1, P1) do {} while (0)
```

Defined in psi/mysql\_stage.h:156
