---
name: "rte_trace.h"
section: "3"
platform: "linux"
package: "dpdk-doc"
version: "24.11.4-0+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rte_trace.h"
---

# rte\_trace.h(3)

## NAME

rte\_trace.h

## SYNOPSIS

`#include <stdbool.h>`\
 `#include <stdio.h>`\
 `#include <rte_common.h>`\
 `#include <rte_compat.h>`\

### Enumerations

enum **rte\_trace\_mode** { **RTE\_TRACE\_MODE\_OVERWRITE**, **RTE\_TRACE\_MODE\_DISCARD** }\

### Functions

\_\_rte\_experimental bool **rte\_trace\_is\_enabled** (void)\
 static \_\_rte\_experimental **\_\_rte\_always\_inline** bool **rte\_trace\_feature\_is\_enabled** (void)\
 \_\_rte\_experimental void **rte\_trace\_mode\_set** (enum **rte\_trace\_mode** mode)\
 \_\_rte\_experimental enum **rte\_trace\_mode** **rte\_trace\_mode\_get** (void)\
 \_\_rte\_experimental int **rte\_trace\_pattern** (const char \*pattern, bool enable)\
 \_\_rte\_experimental int **rte\_trace\_regexp** (const char \*regex, bool enable)\
 \_\_rte\_experimental int **rte\_trace\_save** (void)\
 \_\_rte\_experimental int **rte\_trace\_metadata\_dump** (FILE \*f)\
 \_\_rte\_experimental void **rte\_trace\_dump** (FILE \*f)\

## Detailed Description

RTE Trace API

This file provides the trace API to RTE applications.

**Warning**

**EXPERIMENTAL:** this API may change without prior notice

Definition in file **rte\_trace.h**.

## Enumeration Type Documentation

### enum rte\_trace\_mode

Enumerate trace mode operation.

**Enumerator**

- *RTE\_TRACE\_MODE\_OVERWRITE*

  *In this mode, when no space is left in the trace buffer, the subsequent events overwrite the old events.*

- *RTE\_TRACE\_MODE\_DISCARD*

  *In this mode, when no space is left in the trace buffer, the subsequent events shall not be recorded.*

*Definition at line* **61** *of file* **rte\_trace.h***.*

## Function Documentation

### \_\_rte\_experimental bool rte\_trace\_is\_enabled (void)

*Test if trace is enabled.*

**Returns**

*true if trace is enabled, false otherwise.*

### static \_\_rte\_experimental \_\_rte\_always\_inline bool rte\_trace\_feature\_is\_enabled (void)` [static]`

**Warning**

**EXPERIMENTAL:** *this API may change, or be removed, without prior notice*

*Test if trace feature is enabled at compile time.*

**Returns**

*true if trace feature is enabled, false otherwise.*

*Definition at line* **49** *of file* **rte\_trace.h***.*

### \_\_rte\_experimental void rte\_trace\_mode\_set (enum rte\_trace\_mode mode)

*Set the trace mode.*

**Parameters**

*mode Trace mode.*

### \_\_rte\_experimental enum rte\_trace\_mode rte\_trace\_mode\_get (void)

*Get the trace mode.*

**Returns**

*The current trace mode.*

### \_\_rte\_experimental int rte\_trace\_pattern (const char \* pattern, bool enable)

*Enable/Disable a set of tracepoints based on globbing pattern.*

**Parameters**

*pattern The globbing pattern identifying the tracepoint.* \
 *enable true to enable tracepoint, false to disable the tracepoint, upon match.*

**Returns**

- •

  *0: Success and no pattern match.*

- •

  *1: Success and found pattern match.*

- •

  *(-ERANGE): Tracepoint object is not registered.*

### \_\_rte\_experimental int rte\_trace\_regexp (const char \* regex, bool enable)

*Enable/Disable a set of tracepoints based on regular expression.*

**Parameters**

*regex A regular expression identifying the tracepoint.* \
 *enable true to enable tracepoint, false to disable the tracepoint, upon match.*

**Returns**

- •

  *0: Success and no pattern match.*

- •

  *1: Success and found pattern match.*

- •

  *(-ERANGE): Tracepoint object is not registered.*

- •

  *(-EINVAL): Invalid regular expression rule.*

### \_\_rte\_experimental int rte\_trace\_save (void)

*Save the trace buffer to the trace directory.*

*By default, trace directory will be created at $HOME directory and this can be overridden by --trace-dir EAL parameter.*

**Returns**

- •

  *0: Success.*

- •

  *\<0 : Failure.*

### \_\_rte\_experimental int rte\_trace\_metadata\_dump (FILE \* f)

*Dump the trace metadata to a file.*

**Parameters**

*f A pointer to a file for output*

**Returns**

- •

  *0: Success.*

- •

  *\<0 : Failure.*

### \_\_rte\_experimental void rte\_trace\_dump (FILE \* f)

*Dump the trace subsystem status to a file.*

**Parameters**

*f A pointer to a file for output*

## Author

*Generated automatically by Doxygen for DPDK from the source code.*
